Card copies' hashes in shared 1 MiB buffers (VICTORY_PACK_HASHES=1, off by default); live card buffers in the log #945
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!945
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-945"
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?
@Robotniq on GitHub · 2026-11-28 09:38 UTC · original
Robotniq:pr-hashes→main· +254 −10 · 2 files · 1 commits · openWhat was wrong
Every card copy of a title buffer that shaders are declared to write gets a committed buffer of its own for the hashes of its 64 KiB pieces (
Shadow::card_make_before, made withHost::uav_buffer(card_hash_bytes(size))):(size / 64 KiB + 2) * 16bytes, 48 bytes for most copies. WithVICTORY_CARD_BUFFERS_MIN_KB=64, which both launchers set, there are thousands of them: onmainat63b902fwith the launcher as shipped, about 3,150 were alive near the end of a 5-minute run on my 8 GB card (see the table below).On this card a committed buffer takes far more than it asks for. The ignored test in this branch makes some and reads DXGI's
CurrentUsage: 2,000 buffers of 256 bytes raised it by 73 MB, about 36 KiB each. As a check, 20 buffers of 1 MiB read as about 947 KiB each, so these readings are approximate. If a 48-byte buffer costs what a 256-byte one does, the hashes held about 110 MB of the card.No line of the log shows this. "host copies in the card's memory: ... their bytes from before" counts the 48 bytes (it says 0 MB), and "made so far: ... card buffers" counts what was made since the start, not what is alive.
What changes
VICTORY_PACK_HASHES=1(off by default; unset, every copy keeps a buffer of its own, as now). Hashes of up to 32 KiB lie in slots of shared 1 MiB buffers, one set per size class (256 B, 512 B ... 32 KiB); larger ones keep their own buffer. A slot goes back when its copy goes and is taken again 10 s later at the earliest. A copy that gets a slot has all its pieces hashed into it first, as with a new buffer.Shadow::card_sidesnow gives the hashes' address on the card (Option<u64>) instead of a buffer, and the twoSetComputeRootUnorderedAccessView(2, ...)calls take it as it is. The hashes are only reached through that root view, and the barrier before the compare is a UAV barrier on no resource, so no barrier names a shared buffer (the reasoning ofVICTORY_BUDGET_PACK's slots). The shared buffers stay until the end of the run.Host::uav_buffermade that are alive, by the size asked for (4 KiB or less, over 4 KiB up to 64 KiB, larger), each with the bytes asked for rounded up to a multiple of 64 KiB (so more than the ~36 KiB measured above for the small ones). A buffer is counted until its last release, through a COM object kept as its private data, the waybook.rslearns when its objects go. No switch: it costs a box and oneSetPrivateDataInterfacecall per buffer made.small_buffers_cost_the_card, an ignored test for the cost above (cargo test -p victory-gpu small_buffers_cost_the_card -- --ignored --nocapture).small_buffers_costinhost/place.rsmeasures buffers of 64 KiB; this one measures 256 bytes against 1 MiB.With the switch unset, nothing changes but the new line.
Measured
RTX 3070 Ti 8 GB, i7-13700F, 32 GB RAM, Windows 11, driver 621.40. Series S profile, DLSS Quality, the title's ray tracing off (its 43 ray-tracing pipelines left out with
VICTORY_SKIP_PIPELINES),VICTORY_CARD_ROOM_FOR_TARGETS_MB=1600,VICTORY_TEXTURE_ROOM_PERCENT=85, diagnostics build throughplay-foxhound.ps1 -Build diag. The same save each time, keys sent by a script, 300 s from when the world starts. fps is the median of the frame-rate lines after the first minute and moves about ±1 between runs.On
mainat63b902fwith this branch, the launcher as shipped (memory stack on,VICTORY_INDIRECT_CARD_BUDGETat its default), one run each after a warm-up run; the two runs' switch lists differ only in this switch:VICTORY_PACK_HASHES=1presentCommon()line, which every run hasVICTORY_INDIRECT_CARD_BUDGET=0removes those, and this change does not touch them.Earlier, on my own tree (based on
0cef07ewith the fxceless/victory-fork tree of 27 November merged in and changes of my own), the same switch took the count from 3,214 to 1 withVICTORY_INDIRECT_CARD_BUDGET=0, fps 25.4 and 24.9 (one pair), and every later run that day had it on with no device loss. A review of the change by another AI model (GPT, through Codex) found no lifetime problem: when fences complete normally, a slot cannot be taken again while a submission that wrote it is in flight.Tests
cargo clippy --workspace --all-targets --locked -- -D warnings, plain and with--all-features: no warning from this change. On63b902fclippy already stops on three warnings of main's own (clippy::let_and_returninvictory-shader/src/emit/mod.rs,clippy::manual_is_multiple_ofinvictory-gpu/src/shadow.rsand, with--all-features, invictory-gpu/src/descriptor.rs), the ones #705 clears.cargo test --workspace --locked: all pass, no failure (victory-gpu: 453 passed, 37 ignored).small_buffers_cost_the_cardby hand on the RTX 3070 Ti: the 73 MB and 947 KiB above.Not tested
Notes
BudgetSlotgives its slots back throughretire. I kept the 10 s wait because that is what ran; I can switch toretireif you prefer.VICTORY_CARD_BUFFERS_MIN_KB=64still holds.Host::uav_buffer. Whichever lands second moves the onecount_uavcall to where the card buffer is made.Measured with AI assistance (Claude Code); the runs were made on my machine.
🤖 Generated with Claude Code
https://claude.ai/code/session_017D5NZ3Fd7undwVFyu8fQN1
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.