Replay: --skip-clamps and --batch-clamps leave a capture's batched clamps alone #629
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/Belobug--VIctory-Belobug-AMD!629
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-629"
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?
@adrianmjim on GitHub · 2026-11-27 15:10 UTC · original
adrianmjim:replay/batched-clamps→a-publier· +219 −15 · 2 files · 2 commits · openFixes #621. On a capture whose clamp passes are batched (the host's way unless it was recorded with
VICTORY_INDIRECT_BATCH=0),victory replay --skip-clampsstopped withclamp capture has no completed scratch transition in its command list, and--batch-clampsput the batches into batches again and drew another picture. With this change both switches edit the plain clamps only and say how many batched passes of the capture they left as they are.Machine: RX 7900 XT (RDNA 3), driver 32.0.32029.2010, Windows 11 26300, a-publier
4eb6cfd.Cause
The host names its two clamp pipelines alike (indirect.rs#L356), and the replay took every pass of that name for a plain clamp: constants at parameter 0, where it writes at parameter 3 (edit.rs#L175). A batched pass has another root signature, with its fourth source at parameter 3 (indirect/batch.rs#L33). #621 has the rest.
#621's title calls batching
play.ps1's default. It is the host's too: unset and=1batch as=2does, and only=0turns it off (draw.rs#L338-L345).Change
It is in the replay only, so captures already recorded work too. #621 proposed a name of its own for the batched pipeline; a capture already recorded has the old name, so the replay tells the two apart by their parameters instead.
edit::find_clampstells the two apart by what is bound at the dispatch: a pass with a compute root view at parameter 5 or 6 since its pipeline was bound is a batch. The plain root signature has parameters 0-4 only (indirect.rs#L46); the batched one sets 5 and 6 before every dispatch (indirect/batch.rs#L290-L291). It returns the plain clamps and the number of batches it met.batch_clampsgoes by the pipelines of the plain clamps found, so a recorded batch passes through as any other dispatch does.--skip-clamps: 118 clamp passes of the capture are batches already (not recorded with VICTORY_INDIRECT_BATCH=0) and stay as they are. The existing notes keep their wording and now count plain clamps only.argument clamps (ours)still counts both kinds, by the code: it goes by the name, and those lines are not touched (play.rs#L2457-L2458).docs/replay.mdalone because #521 and #528 are open on it. Its two rows could say that batches of the capture stay.Tested
cargo test --locked -p victory-gpu --features diagnostics --lib replay::edit: 8 passed. Three are new or extended: a list with a plain clamp and a batch in both orders, a list of batches only, and a recorded batch followed by a plain clamp under--batch-clamps. They need no card.replay::play::tests::reportshas the note's text: 1 passed.--batch-clampsone).cargo clippy --locked -p victory-gpu --features diagnostics --tests -- -D warnings: clean.cargo test --locked -p victory-gpu --features diagnostics --test replay, on this commit with #550's two commits on top (the tree of the replays below; not run on this branch alone): 1 passed. That test records plain clamps, and its "3 clamp passes" check under--skip-clampsstill holds.--skip-clamps: completes;0 clamp passes, 0 KB of arguments kept from a first runand the note above; picture 57.5 dB against the presented one.--batch-clamps: completes;0 clamp passes became 0, of 0 recordsand its note; 57.0 dB.--compare --skip-clamps: completes, with the same two notes on the edited side.--comparerun gave 65.9, 57.0 and 57.4 dB in its three loops, so the 57.0 dB above is within what the recorded commands give. The card was shared with other work during these runs, so I give no times.Not tested
VICTORY_INDIRECT_BATCH=0, or a mixed list. By the code the host can make mixed lists with batching on: an execution with a count buffer, or with more than one record, still gets a plain clamp (draw.rs#L4054). The unit tests cover those shapes; I have no such capture. On the card, plain clamps ran under--skip-clampsin the integration test's own frame only;--batch-clampsover plain clamps ran in the unit test only.--batch-clamps 2, and a--timingrun.@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-27 15:14 UTC · original · reviewed
🟡 Changes recommended
A compute indirect command can leave replay batch tracking unchanged, allowing a later clamp to move ahead of the compute work that produces its arguments even across a global UAV barrier.
1 open issue
What changed in this PR
This PR addresses #621 by distinguishing plain clamp passes from recorded batches, so replay’s
--skip-clampsand--batch-clampsswitches target only plain clamps.Changes:
crates/victory-gpu/src/replay/play.rscrates/victory-gpu/src/replay/edit.rsReview effort: Balanced
@ -379,0 +404,4 @@done.left = left;// The pipelines of the clamps found: not the one of batches.let psos: HashSet<u32> = found.iter().map(|c| c.pso).collect();let scratches: HashSet<u32> = found.iter().map(|c| c.scratch).collect();@Copilot on GitHub · 2026-11-27 15:14 UTC · original
In a mixed list, a compute
Cmd::Indirectusing a recorded batch's arguments falls through without settingwrittenordirty. If it runs between two plain clamps while a replay batch is open, even a subsequent global UAV barrier can leave that batch open, moving the second clamp ahead of the compute work that produces its arguments. Before the fallback dispatch arm at line 608, add aCmd::Indirect { .. } if compute.contains(&bound)arm that sets both flags totrueand pushes the command unchanged; add a regression test for this ordering.@ANDREANIADS on GitHub · 2026-11-27 15:50 UTC · original
Independent replay test on an NVIDIA RTX 3070 (driver 621.40). The synthetic capture contains three plain clamp passes and three batched clamp passes with the seven-parameter layout. On base commit
4eb6cfd,--skip-clampsfailed with the missing scratch-transition error. With the PR change, I tested skip, batch sizes 1 and 2, and skip combined with batch. Across three replay loops, both pixel output and readback matched the reference. This covers the synthetic replay case. Game performance and ray tracing were outside the scope of this test.Regression fixture: https://github.com/ANDREANIADS/VIctory-Belobug-AMD/commit/1ddbeebb2813284e112cdf51e89cb2cfa2685ae1
@ -379,0 +404,4 @@done.left = left;// The pipelines of the clamps found: not the one of batches.let psos: HashSet<u32> = found.iter().map(|c| c.pso).collect();let scratches: HashSet<u32> = found.iter().map(|c| c.scratch).collect();@adrianmjim on GitHub · 2026-11-27 16:14 UTC · original
Right, and it comes with this change: before it, every execution in the list had a clamp's arguments. Done in
3b046bb. An indirect dispatch whose arguments no plain clamp gave now marks the list written and dirty, as the dispatches and the clamped indirect dispatches already do, and goes through unchanged.The regression case is at the end of
clamps_are_batched: a recorded batch, a plain clamp and its draw, an indirect dispatch on the recorded batch's records, a wait of the title's, then a second plain clamp. With the fix the second clamp gets a batch of its own (2 batches); without the new arm it joins the first (1), and the test fails on that count.cargo test --locked -p victory-gpu --features diagnostics --lib replay::edit: 8 passed. Clippy (-p victory-gpu --features diagnostics --tests -- -D warnings) is clean. No card is needed for these.@adrianmjim on GitHub · 2026-11-27 16:14 UTC · original
Thanks. A capture with both layouts is the case I could not test: mine has batched passes only.
3b046bb, pushed after your run, changes--batch-clampsin mixed lists only (review comment above): an indirect dispatch that reads a recorded batch's records now ends an open batch at the next wait. If you run the fixture again, the--batch-clampsvariants are the ones it could touch.On the fixture: I have not run it. I would rather not add an env-gated case to this PR on my own. If the maintainer wants it here I can take your commit as it is, with you as author; or it can go in as a follow-up of yours.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.