Repository navigation
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
Conversation
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>
d3d26ef to
fe3cec2
Compare
|
One boundary condition for the slow-shader guide: on current main ( 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. |
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
VICTORY_GPU_TIMINGeveryslow host listline now carriesindirect_groups_asked,indirect_groups_runandindirect_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.VICTORY_GPU_TIMINGtimes individual commands only together withVICTORY_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 isVICTORY_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 withVICTORY_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.
VICTORY_RELAY=0 VICTORY_WIDE_BACK=0 VICTORY_CARD_BUFFERS_MIN_MB=16 VICTORY_CARD_BUFFERS_MB=512 VICTORY_LATE_WAIT_LISTS=128)VICTORY_SHADER_LOOP_LIMIT=256VICTORY_SKIP_PIPELINES(picture wrong)The new defaults help on AMD too: about 20% faster than the old ones.
The card is the limit:
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%):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:
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.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.