Skip to content

perf(gpu): hash tracked texture subresources with a 128-bit digest - #476

Closed
romainhedouin wants to merge 1 commit into
pragyaangaur:mainfrom
romainhedouin:perf/texture-digest-128
Closed

romainhedouin wants to merge 1 commit into
pragyaangaur:mainfrom
romainhedouin:perf/texture-digest-128

Conversation

@romainhedouin

@romainhedouin romainhedouin commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Tracked texture subresources (VICTORY_FAULT_TRACKING=1 only) are now compared by a 128-bit digest instead of blake3::hash; untracked memory (the Rosetta default) is still compared byte for byte. The digest is not cryptographic (a change confined to one 16-byte lane must repeat that lane's 64-bit state, so the effective bound there is about 2^-64, not 2^-128): a collision would leave one subresource stale until its next change. blake3 stays a dependency (used elsewhere).

Hashing 1 MiB of texture bytes blake3 digest
native timing, Apple M4, standalone model (not Rosetta/Wine) 0.45 ms 0.034 ms (about 13x)
model, 1M+ structured edits (bit pairs, swaps, XOR-cancelling pairs, zero padding, lane-confined flips) n/a 0 collisions in 128 bits; 32-bit slices match chance; avalanche 64.0 of 128 bits

Tested: Windows clippy (both configs) clean and the two new unit tests pass in a standalone copy; not run under CrossOver, and the share of a frame spent hashing is unmeasured. Will conflict textually with #415, #416 and #417, which edit the same lines.

🤖 Generated with Claude Code

blake3 took 0.45 ms a MiB on the arm64 NEON path; the digest takes 0.034
ms (native model, M4, same code, about 13x). Only tracked textures hash
(VICTORY_FAULT_TRACKING=1): with fault tracking off, the Rosetta default,
they are compared byte for byte. The digest is not cryptographic; a
collision leaves one subresource stale until its next change.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@romainhedouin
romainhedouin force-pushed the perf/texture-digest-128 branch from 6fea78e to 8c2e7e4 Compare November 27, 2026 01:11
@pragyaangaur

Copy link
Copy Markdown
Owner

Thanks. This now conflicts with main after today's merges. Could you merge or rebase main into it and rerun the checks? I will merge it once CI is green.

@pragyaangaur

Copy link
Copy Markdown
Owner

Thank you. #415 changed the same code: main now tracks each subresource as AllZero or a BLAKE3 hash (TrackedSubresource) and remembers unmapped pages, so the plain hash this PR speeds up is gone. Rebasing it would mean rewriting it for the new structure. If the 128-bit digest still measures faster on the new path, please open a fresh PR against main with the numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants