Skip to content

Where the frame time goes on an AMD RX 6600: indirect group counts in the timing run, GPU timing needs DRED, a guide to slow shaders - #614

Open
Andry018 wants to merge 2 commits into
fxceless:mainfrom
Andry018:perf/frame-time
Open

Andry018 wants to merge 2 commits into
fxceless:mainfrom
Andry018:perf/frame-time

Conversation

@Andry018

@Andry018 Andry018 commented Nov 25, 2026 •

Copy link
Copy Markdown

Where the frame time goes on an AMD card, and how to find it

Measurements on an AMD Radeon RX 6600, plus two small changes that make them reproducible: a diagnostic in the timing run and a README fix. No change to what release builds render or how fast they run, apart from the clamp's extra atomics noted below.

Changes

  • Timing run: indirect dispatch group counts. The argument clamp notes, in each list's budget buffer, the largest group count an indirect compute dispatch asked for (x, y, z), the groups run after the clamp, and how many dispatches the clamp changed. With VICTORY_GPU_TIMING every slow host list line now carries indirect_groups_asked, indirect_groups_run and indirect_bounded. This tells a dispatch running far too much work because its arguments were never written (bounded) from one that asks for that much on purpose. The words are only read in the timing run. The clamp's extra atomics (at most five per indirect compute record) run in every build.
  • README: VICTORY_GPU_TIMING times individual commands only together with VICTORY_D3D12_DRED=1. Commands get timestamps only when they are noted, and they are noted only with device-removed data on. Without it, only whole lists are timed. The row said "with the above", but the row above it is VICTORY_SKIP_PIPELINES.
  • docs/finding-slow-shaders.md: how to go from the frame-rate line to the commands that take the card's time, get an upper bound with VICTORY_SKIP_PIPELINES, and read a translated program's register use offline with Radeon GPU Analyzer (including a root signature RGA accepts).

Related: #465 times the layer's own passes on the card; this PR is about the title's commands and does not overlap with it.

Results (RX 6600)

Windows 11, Ryzen 7 9700X, Radeon RX 6600 8 GB (gfx1032, driver 32.0.21045.1000), 32 GB RAM. Base commit c96b4f2. Standing still in the first gameplay scene; medians of the last minute of frame-rate lines.

Run ms per frame
defaults of c96b4f2 1,100
defaults before c96b4f2 (VICTORY_RELAY=0 VICTORY_WIDE_BACK=0 VICTORY_CARD_BUFFERS_MIN_MB=16 VICTORY_CARD_BUFFERS_MB=512 VICTORY_LATE_WAIT_LISTS=128) 1,385
VICTORY_SHADER_LOOP_LIMIT=256 1,160
four compute programs left out with VICTORY_SKIP_PIPELINES (picture wrong) 345
  • The new defaults help on AMD too: about 20% faster than the old ones.

  • The card is the limit:

    • the submitting thread prepares for about 112 ms of each frame and waits for the card about 960 ms;
    • the card is about 90% busy;
    • translated loops are not the cause: limiting them changes nothing.
  • Four compute programs take most of the card's time. In the timing run (VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1) the card spends 800-840 ms a frame on the title's commands. Four compute programs, each run once a frame, take about 668 ms of that (82%):

    • three indirect dispatches of about 290, 110 and 90 ms;
    • one direct dispatch of 3,600 groups of about 177 ms.

    The indirect ones ask for about 9,000 groups each (about 50,000 per list), and the clamp never bounds them. So the arguments are not garbage: the work is real, and each group is slow.

  • Why each group is slow: register spills. Radeon GPU Analyzer for gfx1032 gives each of the four translated programs all 256 VGPRs and 2,080-5,632 bytes of scratch per thread. The largest program also spills SGPRs into VGPR lanes. The console programs themselves use 49 to 128 VGPRs. The pressure comes from the translation: in the program examined, about 160 VGPRs are live on average, and at the peaks the code copies dozens of values between registers before each branch.

  • What did not help:

    • marking scalar-load results wave-uniform (WaveReadLaneFirst);
    • VICTORY_SHADER_OPT=0.

    Neither changed the registers or the scratch.

Bringing these programs under the register limit looks like the largest single gain available on this card (the upper bound above is about 3x). I have not tried it yet; this PR only makes it measurable.

Testing

  • cargo test -p victory-gpu indirect: 7 passed, including the WARP clamp tests.
  • cargo clippy -p victory-gpu --features diagnostics: no new findings.
  • cargo xtask policy: ok.
  • Diagnostics build run in game with VICTORY_GPU_TIMING=1 VICTORY_D3D12_DRED=1: the new fields appear in the slow-list lines; no device loss.

No title data in this PR: counts and times only, no shader hashes.

Andry018 and others added 2 commits November 25, 2026 04:05
The argument clamp now notes, in the list's budget buffer (words 3-7),
the largest group count an indirect compute dispatch asked for in x, y
and z, the groups run after the clamp, and how many dispatches the clamp
changed. With VICTORY_GPU_TIMING each list runs on its own, so a `slow
host list` line can carry its own counts: indirect_groups_asked,
indirect_groups_run, indirect_bounded. That tells a dispatch that runs
far too much work because its arguments were never written (bounded)
from one that asks for that much work on purpose.

The words are read only in the timing run (diagnostics builds); the
clamp's extra atomics run in every build (five at most per indirect
compute record).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds DRED

README: VICTORY_GPU_TIMING times commands only with VICTORY_D3D12_DRED=1
(only noted commands get timestamps, and commands are noted only with
device-removed data on); without it whole lists are timed. Its row also
says that submissions are not sent ahead in that run.

docs/finding-slow-shaders.md: from the frame-rate line to the commands
that take the card's time, an upper bound with VICTORY_SKIP_PIPELINES,
and reading a translated program's register use offline with AMD's
Radeon GPU Analyzer (with a root signature that works for it). With the
results on an RX 6600: the new defaults are about 20% faster than the
old ones (1,100 against 1,385 ms a frame); four compute programs take
82% of the card's time; translated, each uses all 256 VGPRs and spills
2-5.6 KB per thread, where the console programs use at most 128.

No title data: counts and times only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Dathinel

Copy link
Copy Markdown
Contributor

One boundary condition for the slow-shader guide: on current main (9c184b3), if a single command list has 4,096 or more DRED notes, the time attributed to its 4,095th command includes the untimed tail of the list. The same interval feeds both the slow-list warning and the pipeline sums. The number of draws across a whole frame does not establish that any one list hit this limit.

I reproduced the index error using a synthetic clock with one tick per command. With 4,096 commands the final resolved boundary is tick 4,096, expected 4,095. The writer records starts only at slots 0..4094 and records slot 4095 at close. The correction is to also stamp slot 4095 before command 4096 and only write a close stamp while a slot is still available. The reader can keep its existing 4,095-interval limit.

I checked 0, 1, 4,095, 4,096 and 4,196 commands locally; the diagnostics GPU-crate suite passed (202 passed, 6 ignored). This is a timestamp-attribution check, not evidence that the reported RX 6600 measurements hit the limit. AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants