Card copies: their piece hashes are slices of shared buffers, not a buffer each #3592
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3592"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fl4rion on 2026-11-30T01:25:06Z.
What it changes
A title buffer's copy in the card's memory keeps a 128-bit hash of each 64 KiB piece on the card, so that the compare after a submission can find the pieces its shaders wrote. That is a few hundred bytes for most copies. But each copy's hashes were a committed buffer of their own, made on the submitting thread the first time shaders were declared to write the copy: a driver allocation, a residency wait and at least 64 KiB of VRAM each.
When an area streams in, thousands of copies get their hashes at once. In an RTX 5070 Ti play log (3,686 copies made as the world came in), the card copies' summary line put up to 871 ms of a frame on the submitting thread under "first whole copies", which is this allocation. The hashes also held about 240 MB of VRAM for well under 1 MB of data, while textures were waiting for room on the card.
Shadow) is dropped. That is after the card ran the last submission that used it, because the submission'sCardPlanholds the copies it used (_synced) until the submission has run. It's the same point at which the per-copy buffer used to be released, so no timed delay is needed.card_before_gpu); they now get the slice's address. Slices start on 256-byte boundaries.card_sides()still returns the resource, but callers only check whether it is there.How it was tested
shadow::hash_pool_tests::bench_hash_places(ignored; release build), the hashes' places of 2,000 copies of 1 MiB, three rounds: a buffer each 697 / 871 / 1,461 ms (518 / 1,686 / 10,488 ms in another run, growing every round); shared slices 0.69 / 0.12 / 0.08 ms, from one shared buffer.hash_classes, andhash_slices_lie_apart_and_come_back(slices taken together don't overlap; one given back is the next of its size taken).cargo test -p victory-gpu --lib: 923 passed, 1 failed. The failure,shader_cache::tests::every_switch_of_the_translator_is_in_the_key, fails on main as well.cargo build --release -p victoryand clippy: nothing new.Checked for overlap
I searched the open pull requests for the same issue and for the files this touches. Related: #945 by @Robotniq, which first put these hashes in shared slots (1 MiB buffers, behind
VICTORY_PACK_HASHES=1, off by default, with a 10 s delay before a slot is reused), and which has its own measurements of the VRAM cost. This PR covers the same goal, with these differences:#945's live-card-buffer log line is not part of this PR. If the maintainers prefer #945, I'm glad to close this one in its favour.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:50:41Z.
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed