Diagnostics: the card's time by kind of list in ordinary runs (VICTORY_LIST_STAMPS=1), and what declares the widest shader writes (VICTORY_WRITE_DECLARERS=1) #453

Open
Jesper-Andersson wants to merge 1 commit from upstream-pr/453 into main
Jesper-Andersson commented 2026-11-27 10:30:36 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Jesper-Andersson on 2026-11-27T10:30:36Z.


Refs #221.

The timing run from #106 (VICTORY_GPU_TIMING) sends each list of a submission on its own and waits for it, with the relay off. Each list costs one ExecuteCommandLists call plus a CPU wake, about 45 us (13.5 ms a frame over 294 lists here), and nothing overlaps. Its sums by kind of list are therefore not those of the frames we play, and that run overstated our own share of the card's time. This adds a way to get the same split in an ordinary run. It also adds a line that names what declares the widest shader-write ranges, which the compare after each submission hashes whole.

Change

  • VICTORY_LIST_STAMPS=1 (diagnostics builds only, off by default), crates/victory-gpu/src/host/liststamps.rs. For a submission sent ahead, a timestamp list goes ahead of each run of lists of one kind (a prelude, the title's list, our steps on the card, the compare) and one goes behind the last. They go inside the same ExecuteCommandLists calls the lists always use, and moved() keeps a run's stamp with it across the cuts at parts. The frame-rate line gets "the card's time by kind of list, as the lists ordinarily go": preludes, the title's lists, steps on the card, compares, others of ours. It also gives the time between submissions: our sends up to copies in the card's memory, a present's lists, and the card standing. The stamp lists come from a ring of 4,096 prebuilt lists (one query heap, one readback buffer), and a slot is handed out again only after its fence. When the ring is full the submission is left out and counted on the line, so it is never stalled. A missing or backward stamp makes that submission's stamps "unread" (counted, not summed).
  • VICTORY_WRITE_DECLARERS=1 (diagnostics builds only, off by default; off, a declaration costs one flag load). host::declared_by is called next to wide_write from draw::readable (views in tables; draw.rs notes the stage's shader in a thread-local while its tables are walked) and from State::root_uav's write path (root views, by pipeline). At each frame-rate line, declarers_line gives the widest declared ranges since the last line. For each range it lists its declarers (a view in a table of shader <hash>, or a root view of pipeline <hashes>), how often a frame, and whether those shaders can store to buffers at all and by raw address. Only declarations of 1 MB or more are counted, as for wide_write.
  • Neither changes what is sent or how: the stamps are extra lists in the same calls, and the declarers are counts.

Where it does nothing

  • Release builds, and diagnostics builds without the switches. Submissions not sent ahead (late false) get no stamps.

Measured

From a local branch (main plus about 50 PRs, not main), RTX 2070 SUPER 8 GB (driver 621.14), Ryzen 7 5800X, 32 GB, Windows 11, diag build, Series S + DLSS, in the world:

per frame VICTORY_LIST_STAMPS=1
card time in the submissions' lists 96 ms
the title's lists 90.1 ms (94 %)
compares 5.3 ms
preludes 0.4 ms
steps on the card 0.3 ms
between submissions 7-10 ms

The VICTORY_GPU_TIMING run on the same build costs about 13.5 ms a frame by itself and put our own lists at about 48 ms. With stamps, our own lists (compares, preludes and steps) come to about 6 ms. The declarer line showed that the widest range is the title's 174 MB heap buffer, compared whole twice a frame, and that it is declared by table views of two shaders. Root views don't declare it. That points any narrowing at the table-view path (draw::readable).

Checks

  • cargo test -p victory-gpu --lib --locked --features diagnostics -- liststamps declarers_tests: 6 passed (6 new: a_stamp_goes_ahead_of_each_run_and_behind_the_last, a_runs_first_moves_to_its_stamp, runs_get_the_ticks_up_to_the_next_stamp, a_missing_or_backward_stamp_is_not_read, the_widest_range_comes_first_with_its_most_frequent_declarer, narrow_declarations_are_not_kept)
  • cargo clippy -p victory-gpu --all-targets --locked --features diagnostics: no warnings in changed code (6 warnings already on main: texture.rs, host/panel.rs, host/place.rs, host/rtstamps.rs x2, watch.rs)
  • cargo xtask policy: 3 files ok
  • In game: the original commits ran on the local branch above, where the declarer line was always on in diagnostics builds; the switch is new in this port. This port onto main has not been run in game.

Not checked

  • AMD cards (wave 64, raw twins), Linux/Proton. Timestamp frequency is read from the queue (GetTimestampFrequency), so the numbers should carry over.
  • Runs with VICTORY_LIST_STAMPS=1 and VICTORY_GPU_TIMING together: the stamps go only into submissions sent ahead.
  • #106 (merged) adds the timing run's sums by kind of list (VICTORY_GPU_TIMING). This gives the same split without the timing run's per-list sends and waits. It reuses #106's copystat::Timed kinds and the marks it records.
  • #429 (open) adds "the card busy" from the fence clock to the fps line: one total per frame. This one splits the card's time by kind of list.
  • #387 (open) changes the card-clock counters of the frame line. They don't overlap.
  • Narrowing the 174 MB compare is not part of this PR. The exact ways found elsewhere: shaders that mark the 64 KiB pages they write through views (Marvisak/VIctory cd94d353), or only the root views an operation writes (Marvisak/VIctory PR #2948, after DexNom/VIctory bc3cd4b, written_root_uavs).

This change was made with AI assistance (Claude Code).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5525100317 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/453). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-27T10:30:36Z. --- Refs #221. The timing run from #106 (`VICTORY_GPU_TIMING`) sends each list of a submission on its own and waits for it, with the relay off. Each list costs one `ExecuteCommandLists` call plus a CPU wake, about 45 us (13.5 ms a frame over 294 lists here), and nothing overlaps. Its sums by kind of list are therefore not those of the frames we play, and that run overstated our own share of the card's time. This adds a way to get the same split in an ordinary run. It also adds a line that names what declares the widest shader-write ranges, which the compare after each submission hashes whole. ## Change - `VICTORY_LIST_STAMPS=1` (diagnostics builds only, off by default), `crates/victory-gpu/src/host/liststamps.rs`. For a submission sent ahead, a timestamp list goes ahead of each run of lists of one kind (a prelude, the title's list, our steps on the card, the compare) and one goes behind the last. They go inside the same `ExecuteCommandLists` calls the lists always use, and `moved()` keeps a run's stamp with it across the cuts at `parts`. The frame-rate line gets "the card's time by kind of list, as the lists ordinarily go": preludes, the title's lists, steps on the card, compares, others of ours. It also gives the time between submissions: our sends up to copies in the card's memory, a present's lists, and the card standing. The stamp lists come from a ring of 4,096 prebuilt lists (one query heap, one readback buffer), and a slot is handed out again only after its fence. When the ring is full the submission is left out and counted on the line, so it is never stalled. A missing or backward stamp makes that submission's stamps "unread" (counted, not summed). - `VICTORY_WRITE_DECLARERS=1` (diagnostics builds only, off by default; off, a declaration costs one flag load). `host::declared_by` is called next to `wide_write` from `draw::readable` (views in tables; `draw.rs` notes the stage's shader in a thread-local while its tables are walked) and from `State::root_uav`'s write path (root views, by pipeline). At each frame-rate line, `declarers_line` gives the widest declared ranges since the last line. For each range it lists its declarers (a view in a table of shader `<hash>`, or a root view of pipeline `<hashes>`), how often a frame, and whether those shaders can store to buffers at all and by raw address. Only declarations of 1 MB or more are counted, as for `wide_write`. - Neither changes what is sent or how: the stamps are extra lists in the same calls, and the declarers are counts. ## Where it does nothing - Release builds, and diagnostics builds without the switches. Submissions not sent ahead (`late` false) get no stamps. ## Measured From a local branch (main plus about 50 PRs, not `main`), RTX 2070 SUPER 8 GB (driver 621.14), Ryzen 7 5800X, 32 GB, Windows 11, diag build, Series S + DLSS, in the world: | per frame | `VICTORY_LIST_STAMPS=1` | |---|---| | card time in the submissions' lists | 96 ms | | the title's lists | 90.1 ms (94 %) | | compares | 5.3 ms | | preludes | 0.4 ms | | steps on the card | 0.3 ms | | between submissions | 7-10 ms | The `VICTORY_GPU_TIMING` run on the same build costs about 13.5 ms a frame by itself and put our own lists at about 48 ms. With stamps, our own lists (compares, preludes and steps) come to about 6 ms. The declarer line showed that the widest range is the title's 174 MB heap buffer, compared whole twice a frame, and that it is declared by table views of two shaders. Root views don't declare it. That points any narrowing at the table-view path (`draw::readable`). ## Checks - `cargo test -p victory-gpu --lib --locked --features diagnostics -- liststamps declarers_tests`: 6 passed (6 new: `a_stamp_goes_ahead_of_each_run_and_behind_the_last`, `a_runs_first_moves_to_its_stamp`, `runs_get_the_ticks_up_to_the_next_stamp`, `a_missing_or_backward_stamp_is_not_read`, `the_widest_range_comes_first_with_its_most_frequent_declarer`, `narrow_declarations_are_not_kept`) - `cargo clippy -p victory-gpu --all-targets --locked --features diagnostics`: no warnings in changed code (6 warnings already on main: `texture.rs`, `host/panel.rs`, `host/place.rs`, `host/rtstamps.rs` x2, `watch.rs`) - `cargo xtask policy`: 3 files ok - In game: the original commits ran on the local branch above, where the declarer line was always on in diagnostics builds; the switch is new in this port. This port onto main has not been run in game. ## Not checked - AMD cards (wave 64, raw twins), Linux/Proton. Timestamp frequency is read from the queue (`GetTimestampFrequency`), so the numbers should carry over. - Runs with `VICTORY_LIST_STAMPS=1` and `VICTORY_GPU_TIMING` together: the stamps go only into submissions sent ahead. ## Related - #106 (merged) adds the timing run's sums by kind of list (`VICTORY_GPU_TIMING`). This gives the same split without the timing run's per-list sends and waits. It reuses #106's `copystat::Timed` kinds and the `marks` it records. - #429 (open) adds "the card busy" from the fence clock to the fps line: one total per frame. This one splits the card's time by kind of list. - #387 (open) changes the card-clock counters of the frame line. They don't overlap. - Narrowing the 174 MB compare is not part of this PR. The exact ways found elsewhere: shaders that mark the 64 KiB pages they write through views (Marvisak/VIctory cd94d353), or only the root views an operation writes (Marvisak/VIctory PR #2948, after DexNom/VIctory bc3cd4b, `written_root_uavs`). This change was made with AI assistance (Claude Code).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/453:upstream-pr/453'
git switch 'upstream-pr/453'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/453'
git switch 'upstream-pr/453'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/453'
git switch 'upstream-pr/453'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/453'
git switch 'main'
git merge --squash 'upstream-pr/453'
git switch 'main'
git merge --ff-only 'upstream-pr/453'
git switch 'main'
git merge 'upstream-pr/453'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
avatarmanz/VIctory-7900XTX!453
No description provided.