GPU: the clamped arguments' scratch stays in INDIRECT_ARGUMENT between executions (VICTORY_INDIRECT_KEEP=1) #780
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!780
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/780/head"
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?
@LeonardoS11 on GitHub · 2026-11-25 07:26 UTC · original
LeonardoS11:pr/indirect-keep→main· +103 −0 · 2 files · 1 commits · closed without mergingWhat
VICTORY_INDIRECT_KEEP=1(off by default): the scratch buffer that holds clamped indirect arguments stays inINDIRECT_ARGUMENTbetween indirect executions and goes back toCOMMONonly right before a clamp writes it again. Together withVICTORY_INDIRECT_WINDOW=1it takes about 40 ms a frame off the wait for the card on an RTX 3080 Ti (250–283 → 204–209 ms a frame in a still scene).Why
indirect::done(), a transition of the scratch back toCOMMON. That is a barrier between every two indirect draws — about 4,400 a frame in the world — also between draws that read one window clamped once for all of them.bare_command_costtest of310c6ebon this card: a barrier pair between draws about 1.1 µs, a compute pass of ours between draws about 5 µs. Here the transition also has to wait for the execution that just read the buffer.A buffer decays to
COMMONwhen its submission is done, so the next list starts as before.Numbers
Windows 11, RTX 3080 Ti 12 GB, 64 GB RAM,
diagbuild withdiagnostics. A still scene in the prologue (the room with the window onto the yard), about 4,800 draws a frame, 300 s a run, averages of the last 8 frame-rate lines. Measured on310c6ebwith room kept for the buffers' card copies (so the runs are comparable; see #776), not yet on8dd30ab— I will add those.VICTORY_INDIRECT_WINDOW=1VICTORY_INDIRECT_KEEP=1"dropped … indirect" is 1 a frame in all of them, so the window refuses nothing more than the per-draw path. The picture was compared by eye at 295 s and shows no difference that follows the switches.
Something I tried and dropped, in case it saves someone the time: moving all of a list's clamps into its prelude (one pass, no compute among the draws) by cutting the list after a dispatch that writes arguments. It clamped about 4,050 calls in 35 passes a frame and did not lower the wait at all — the cuts send the rest of the submission down the per-part path, and that costs what the clamps saved.
Suggestion
KEEPon wheneverWINDOWis, and both on by default. I left both as they are so the default does not change with this PR.Tested
cargo test -p victory-gpu --lib indirect::on the card above: 8 passed. The new test,kept_scratch_goes_back_before_a_clamp_and_at_reset: after an execution the scratch is marked as kept; the next clamp takes it back toCOMMONbefore writing; a list may close with it kept and runs; a reset forgets it; without the switch nothing is kept.cargo test --workspaceon a branch of ours that carries this commit on8dd30abwith other changes: 531 passed, 0 failed, 10 ignored.No title data in this PR.
🤖 Generated with Claude Code
@SkillIssueXO on GitHub · 2026-11-25 08:13 UTC · original
I tested
68620edon top of current fork main9376fd6with a desktop RTX 5070 Ti 16 GB, NVIDIA 621.40, Ryzen 7 9850X3D, 32 GB RAM, and Windows 11. Both runs use the same diagnostics executable, Series X profile, copied warm caches, reported 1080p display mode, levels on demand, late wait 3, 70% texture room, and in-flight card fetch off.One run used both
VICTORY_INDIRECT_WINDOW=1andVICTORY_INDIRECT_KEEP=1. The control had both off. I left the camera at the prison window after the game handed over control. I timed three intervals between captures.Across the 443 timed presents per run, throughput went from 3.99 to 4.55 FPS. In the last interval the median frame time went from 260.28 to 209.63 ms and p95 from 320.49 to 224.92 ms. Median host wait for the GPU went from 134.7 to 93.9 ms per frame. Preparation stayed near 77 ms. The meter reported one indirect drop per frame in both runs. Both runs rendered walls, window mesh, and the yard, with the existing lower-screen blocks present. I stopped both after the sample, and neither logged device removal.
These are single runs with the same camera and different yard animation and draw counts. They measure the two switches together. Nine indirect tests passed on the same source tree, with the benchmark left ignored.
AI-assisted testing and analysis. Settings and aggregate measurements only.
@HLVM04 on GitHub · 2026-11-25 09:26 UTC · original
A data point from an RTX 5070 Ti (16 GB, wave32 only, NVIDIA 616.64, Ryzen 7 9800X3D), Series S profile, on
9376fd6+ #798 + #783 + #799. Scripted Enter input, first gameplay scene, numbers from the frame lines.VICTORY_INDIRECT_KEEP=1+VICTORY_INDIRECT_WINDOW=1No device loss in 4 runs. The scene is not identical between runs, so the median gain is small and could partly be variance; the mean and the preparing time moved more.
@LeonardoS11 on GitHub · 2026-11-25 10:42 UTC · original
Closing:
f85101bdoes this and a little more — the scratch stays in INDIRECT_ARGUMENT after a clamp until the next clamp takes it straight to unordered access, and goes back once when the list closes, so the executions record no barrier of their own. The numbers here and the two reports above (thanks, both) stand as a confirmation of that change on three NVIDIA cards. (Written with Claude Code.)Pull request closed