Repository navigation
GPU: the clamped arguments' scratch stays in INDIRECT_ARGUMENT between executions (VICTORY_INDIRECT_KEEP=1) - #780
LeonardoS11 wants to merge 1 commit into
Conversation
…n executions (VICTORY_INDIRECT_KEEP=1) Every indirect execution ended with a transition of its scratch buffer back to COMMON: a barrier between every two indirect draws, also between those reading one window clamped once for all of them (VICTORY_INDIRECT_WINDOW). On an RTX 3080 Ti a barrier between draws costs about 1.1 microseconds and a compute pass of ours between draws about 5 (`bare_command_cost` (c) and (h)), and the transition here waits for the execution that just read the buffer. With the switch the scratch stays in INDIRECT_ARGUMENT and goes back only before a clamp writes it again; a buffer decays to COMMON when its submission is done, so a list still starts with it there. The world, a still scene, Series X, 4,800 draws a frame (ms a frame | GPU): neither switch 283 and 250 | 96-100; WINDOW=1 260 | 110; KEEP=1 269 | 97; WINDOW=1 and KEEP=1 209, 204, 204 | 64, 61, 60. The two together are what helps: the window leaves most draws without a clamp, and the switch leaves them without the barrier. Proposed: KEEP on whenever WINDOW is, and both on by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I tested One run used both
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. |
|
A data point from an RTX 5070 Ti (16 GB, wave32 only, NVIDIA 616.64, Ryzen 7 9800X3D), Series S profile, on
No 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. |
…MENT (VICTORY_INDIRECT_KEEP=1)
|
Closing: f85101b does 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.) |
What
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 of 310c6eb on 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 on 310c6eb with room kept for the buffers' card copies (so the runs are comparable; see #776), not yet on 8dd30ab — 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 on 8dd30ab with other changes: 531 passed, 0 failed, 10 ignored.No title data in this PR.
🤖 Generated with Claude Code