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
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/fxceless--victory-fork!614
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-614"
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?
@Andry018 on GitHub · 2026-11-25 03:18 UTC · original
Andry018:perf/frame-time→main· +202 −5 · 4 files · 2 commits · openWhere 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.c96b4f2c96b4f2(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.
@Dathinel on GitHub · 2026-11-25 21:41 UTC · original
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.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.