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
github-bot wants to merge 1 commit from github-bot/gh-453 into main AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-27 10:30 UTC · original
Jesper-Andersson:list-stamps → main · +516 −0 · 3 files · 1 commits · open

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).

**@⁠Jesper-Andersson** on GitHub · 2026-11-27 10:30 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/453) `Jesper-Andersson:list-stamps` → `main` · +516 −0 · 3 files · 1 commits · open 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).
Two diagnostics lines, diagnostics builds only, both off by default.

VICTORY_LIST_STAMPS=1. The timing run (VICTORY_GPU_TIMING) sends and
waits for every list on its own, with the relay off: about 45 us of
sending and waking per list (13.5 ms a frame over 294 lists in one run on
an RTX 2070 SUPER) and no overlap, so its sums by kind are not those of
the frames we play. Here a timestamp list goes ahead of each run of lists
of one kind and behind the last, inside the same ExecuteCommandLists calls
of a submission sent ahead; cuts keep a run's stamp with it. 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,
and the time between submissions (our sends up to copies in the card's
memory, a present's lists, the card standing). A ring of 4096 prebuilt
stamp lists (host/liststamps.rs); a slot is handed out again only after
its fence.

VICTORY_WRITE_DECLARERS=1. The compare after a submission hashes every
64 KiB piece of each range its shaders are declared to write; one range
(the title's 174 MB heap buffer) was compared whole twice a frame here.
Before narrowing it, we need to know how it is declared: through views in
tables (`draw::readable`) or through root views (`State::root_uav`), and
by which shaders. The line names, at each frame-rate line, the widest
declared ranges since the last line, and for each its declarers (a view
in a table of shader <hash>, or a root view of pipeline <hashes>), how
often per frame, and whether their shaders can store to buffers at all
and by raw address. Only declarations of 1 MB or more are counted, as for
`wide_write`. Off, a declaration costs a flag's load.

This change was made with AI assistance (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:39:02 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/453/head:github-bot/gh-453'
git switch 'github-bot/gh-453'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-453'
git switch 'github-bot/gh-453'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-453'
git switch 'github-bot/gh-453'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-453'
git switch 'main'
git merge --squash 'github-bot/gh-453'
git switch 'main'
git merge --ff-only 'github-bot/gh-453'
git switch 'main'
git merge 'github-bot/gh-453'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.