Replay: with --compare each report has the picture of its own runs #551
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!551
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-551"
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 11:11 UTC · original
adrianmjim:replay/compare-picture→a-publier· +94 −38 · 3 files · 2 commits · openWith
victory replay --compare, the "unchanged" report'spicture:line, itsnote: picture ... (blake3 ...)line andreplay-unchanged.pngare the experiment's picture, not the unchanged run's. This PR makes each report use the picture its own last run left.Why
Seen on RX 7900 XT (RDNA 3), driver 32.0.32029.2010, Windows 11 26300, with a build of a-publier
4eb6cfdplus #550 (see the end). One capture of a world frame (39 submissions, 274 lists, 42,198 resources, 1,024 pipelines), 8 runs with--compare --loops 11.With
--compare --no-barriers(shortened: other lines left out, paths cut):picture:line says 29.2 dB.cba51fc6), not of its own last loop (802cd0f4).replay-unchanged.pngandreplay.pngheld the same picture.On this capture every loop's picture had a different hash (176 loops in the 8 runs, 176 hashes), so the hash tells which run a picture came from. The "unchanged" note had the experiment's in all 8 compare runs:
--compare --loops 11plus)--shaders-b X(control)89d24cb28d3b749289d24cb2--shaders X --shaders-b Yf33a615b263e162cf33a615b--shaders Y --shaders-b X3c72d21aeb19eefa3c72d21a--shaders X --shaders-b Z5a7f64c355641e345a7f64c3--shaders Z --shaders-b Xcc20d3ef8324aed1cc20d3ef--skip-hash-passesa53b16b49d2f9ba0a53b16b4--merge-barriers08360c49792409c708360c49--no-barrierscba51fc6802cd0f4cba51fc6X, Y and Z are folders of retranslated shaders (X by a-publier's translator, Y and Z by builds of #422 and #502; for Z I added a local switch, described in my comment there). Nothing here depends on what is in them. Rows 2 and 4 also had
--timing detailed.Not affected, by the code:
pictures of the loopsline. It is read right after each run.--compare. In the 5 plain runs of this capture that completed, the note's hash is the last loop's.Cause:
replay()runs the two sets of lists turn by turn and makes both reports after the loop: play.rs#L497-L502. The last run on the card is the experiment's.finish()callspicture()(#L3173), which reads the presented texture off the card at that moment (#L3275).finish()for "unchanged" reads what the experiment left and saves it asreplay-unchanged.png.picture_now()right after each run (#L3131).What
picture_now()returns aShownstruct instead of a tuple: dB, same bytes or not, hash, the recorded picture's hash, pixels.once()stores it in the set of lists it ran (Sends::shown). Only the last run's is kept.finish()hands it topicture(), which writes the PNG and the report lines from it. There is no second read-back at the end.picture()reads the card only when no picture was kept, and keeps the three existing notes for those cases.diverge.rsonly follows the new return type.--comparegets the picture of its last run, as before, with one read-back fewer.send()has returned the run's timestamps.a_frame_is_recorded_and_replayed(crates/victory-gpu/tests/replay.rs). It runs--comparewith an experiment that skips what the test scene'sa drawing pipelinedraws (skip_shaders: ["a drawing"], 2 loops) and asserts:replay-unchanged.pngandreplay.pngdiffer;picturenote is the hash of the report's own last loop.Tested
Same machine, branch on
4eb6cfd:cargo test --locked -p victory-gpu --features diagnostics --test replay: 1 passed, 0 failed (3 runs of 3 on the final code).cargo test --locked -p victory-gpu --features diagnostics --lib replay::: 25 passed, 0 failed (none of them new).play.rsanddiverge.rsback at4eb6cfdand the new case kept, the test fails attests/replay.rs:1885withthe unchanged run's picture is the presented one(2 runs of 2, the second with the final test file). So it covers the bug.cargo clippy --locked -p victory-gpu --features diagnostics --tests -- -D warnings: no warnings.--compare --no-barriers(5 loops) with #550 and this change together:521258ad, its own last loop;e8238169, its own last loop;Not tested:
--features diagnostics. The replay module is only built with it.Relation to #550
This is independent of #550, in which the replayer drops
D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT. The two change different parts ofplay.rsand oftests/replay.rs, and they merge without conflicts. With both together: the integration test passes (2 runs of 2),--lib replay::gives 26 passed, and clippy has no warnings.On this card, replays of the two captures I made on a-publier lose the device before any report is printed (in the one I traced, while the contents are loaded), so here a real capture needs #550 to run at all. The 8 compare runs in the table were made with an earlier build of the fix in #550, without this change. The integration test here does not need #550.
#526 (open) changes the path lines of
picture(), next to lines changed here. I did not try that merge, and will rebase on whichever is merged first.Not fixed here, same kind of thing: with
--comparethe noteN copies of what the CPU wrote to memory the card writes: ...is the same line in both reports, with counts about twice a plain run's (156,046 words put in each report of the--no-barriersrun, 74,639 in a plain run of the same capture). By the code each set of lists numbers its copies from zero again (merge.rs#L147-L151), so both sets add into the same slots of the one counts buffer. I left it out to keep this to the picture.@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-27 11:13 UTC · original · reviewed
🟢 Approval recommended
No active review issues are reported for the fix to per-replay report and PNG picture selection.
No open issues 🎉
What changed in this PR
Fixes
victory replay --compareso each report and PNG uses its own last run’s picture, rather than both using the experiment’s final picture.Changes:
Shownreturn type.crates/victory-gpu/tests/replay.rscrates/victory-gpu/src/replay/play/diverge.rsShownstructure.crates/victory-gpu/src/replay/play.rsReview effort: Balanced
@gut0to on GitHub · 2026-11-27 13:12 UTC · original · reviewed
AI-assisted review. I checked the fallback path for runs without a captured Shown image and left one readback-efficiency suggestion inline.
@ -3286,0 +3293,4 @@.push("the presented format is not shown".into());return Ok(());}let Some(shown) = self.picture_now()? else {@gut0to on GitHub · 2026-11-27 13:12 UTC · original
AI-assisted review: In this fallback, picture() has already loaded bytes and checked that gpu::rgb can display them, then picture_now() loads the presented contents again to build Shown. Could the fallback construct Shown from the bytes already read (and load the recorded image once)? That avoids a duplicate resource read and ensures the validation and saved PNG use the same snapshot.
@adrianmjim on GitHub · 2026-11-27 13:33 UTC · original
On
crates/victory-gpu/src/replay/play.rsline 3296 (outdated):Done in
f393087. The fallback now makes the picture from the bytes it has just read (shown_of, whichpicture_now()uses too). That is one read of the card and one of the recorded picture, and the PNG saved is of the bytes that were looked at.On the RX 7900 XT:
--test replaypasses (3 runs of 3),--lib replay::gives 25 passed, clippy (-p victory-gpu --features diagnostics --tests -- -D warnings) is clean.--skip-clampsand--batch-clampsread a capture's batched clamp passes (VICTORY_INDIRECT_BATCH,play.ps1's default) as plain ones #621@MamaLeVrai on GitHub · 2026-11-27 15:56 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
f393087:victory-gpu396 passed, 0 failed, 34 ignored.AI-assisted (Claude Code); no game data.
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.