Shaders: compile the four compute shaders the RDNA 4 compiler crashes on #2
No reviewers
Labels
No labels
accessibility
bench-bm-v1
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/PastiiJay--klbf-lab!2
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2"
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?
@BrokeAsh on GitHub · 2026-11-25 14:27 UTC · original
BrokeAsh:rdna4-self-sized-loads→beta· +262 −8 · 5 files · 2 commits · openOn an RX 9070 XT (Adrenalin 32.0.32029.2010), AMD's shader compiler kills the process on four of the title's compute shaders. The crash is a null read at
amdxc64.dll+0x861b9f:878933b499cfa14da567b9ef845fb680f16876929fa64f9fc1eee35dbc50a9efWith
VICTORY_SHADER_OPT=0only the last two crash. Those two are the ones your pre-build puts inprebuild-crashed.txt, so a run skips their pipelines. This PR makes all four compile, so nothing needs to be skipped.Cause
This is a driver bug:
dxil.dll's validator and the D3D12 debug layer.I reduced the shaders to find the trigger. It's a scalar buffer load at an offset computed from that same buffer's record count (dword 2 of its descriptor). That's the console's "last record" idiom,
buf[(size / stride - 1) * stride].Change
Rebased onto
beta(wasmain), per the note that test builds go there first. The only conflict wasshader_cache.rs, wherebuild()onbetareturns the key by value.emit::Options { self_sized_loads_via_memory }andemit::translate_with.getDimensionson the view. The check isoffset < size && size - offset >= 4, so it can't wrap for an offset just under 4 GiB (the last record of an empty buffer).shader_cache::host_shader_with. A translation made with non-default options is cached separately from the default one.pipeline.rs. On an AMD RDNA 4 card (PCI device0x7550,0x7551or0x7590), the four shaders are translated in the other form. They come from a built-in list, like the default forVICTORY_SKIP_PIPELINES. Every other card keeps the default form, which it compiles.VICTORY_OTHER_FORMoverrides the list on any card: comma-separated 16-digit hashes, or0for none.The default translation doesn't change for any other shader. 322 of the title's 25,652 programs have this kind of load, and the rest compile as they are, so only these four get the other form.
Tested
amdxc64.dll+0x861b9f. WithVICTORY_SHADER_OPT=0,f16876929fa64f9fandc1eee35dbc50a9efstill crash.VICTORY_SHADER_OPT=0.cargo test -p victory-shader -p victory-gpu: passes onbeta(154 + 224).cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: no warnings in the files this PR changes.betait already fails in files this PR doesn't touch:resource.rs:2667(placed_filler_twinsunused),draw.rs:2441(sort_unstable_by_key),indirect.rs:1574(depth_writtennever read).Not tested
I haven't run the game on this branch myself. The same fix has been in my own build since 2026-11-24: there all four shaders pre-build into 1,722 compute pipelines with none refused, and runs reach the world.
After merging
prebuild-crashed.txtfrom the pipelines cache (or remove those keys from it) and run the pre-build again, so these pipelines get built instead of skipped.VICTORY_OTHER_FORMnames the shaders. The other form reads through the title-memory copies, and a page with no copy yet reads 0 until the next frame, so it isn't always identical to reading through the view.🤖 Generated with Claude Code
The RX 9070 XT's shader compiler (amdxc64.dll 32.0.32029.2010) kills the process with a null read at amdxc64.dll+0x861b9f on four of the title's compute shaders: 878933b499cfa14d, a567b9ef845fb680, f16876929fa64f9f and c1eee35dbc50a9ef (with VICTORY_SHADER_OPT=0, the last two; they are the pipelines the pre-build lists in prebuild-crashed.txt on that card). The DXIL passes dxil.dll's validator and the D3D12 debug layer, and the same DXIL compiles on an RDNA 2 adapter's older AMD compiler: a driver bug. Reduced, the trigger is a scalar buffer load at an offset computed from that same buffer's record count (dword 2 of its descriptor): the console's "last record" idiom, buf[(size / stride - 1) * stride]. The offset taken from a constant buffer, or the load through another view, compiles; no form of the size (WaveReadLaneFirst, WaveActiveMax, a clamp, a second handle of the same index) does. - emit::Options { self_sized_loads_via_memory } and emit::translate_with: such a load reads the bytes at the view's title address plus the offset through title memory (the path memory-reading loads already take), 0 past the view's end as the console's load reads (getDimensions on the view). Where the view's address is not known, it reads through the view as before. The default translation is unchanged: 322 of the title's 25,652 programs have such a load and compile as they are. - shader_cache::host_shader_with: a translation with other options is cached apart from the default one. - pipeline.rs: the four shaders are translated in the other form (built-in list, as VICTORY_SKIP_PIPELINES has one); VICTORY_OTHER_FORM names the shaders instead (16-digit hashes, comma-separated; 0: none). Tested on an RX 9070 XT (Adrenalin 32.0.32029.2010), in a separate process per shader: each of the four crashes the compiler at amdxc64.dll+0x861b9f in the default form (the two above with VICTORY_SHADER_OPT=0) and makes its compute pipeline in the other form, with and without VICTORY_SHADER_OPT=0. cargo test -p victory-shader -p victory-gpu passes; clippy -D warnings is clean on both crates. Co-Authored-By: Claude Opus 5.5 <[email protected]>@PastiiJay on GitHub · 2026-11-25 14:31 UTC · original
Thank you @brokeash, this is great work: a reduced trigger, a narrow fix only for the four shaders, and a clean opt-out. Main is our stable build, so we'll first carry this into our next test build (Lab 43, on top of the water physics fix) and run it in game on our RX 9070 XT; if it holds, we merge it here. Will report back in this PR.
@BrokeAsh on GitHub · 2026-11-25 16:58 UTC · original
Rebased onto
betaso it drops straight into the Lab 43 test build. Happy to retarget tomainonce it holds@PastiiJay on GitHub · 2026-11-25 17:02 UTC · original
Thanks @BrokeAsh, perfect. It goes into the next beta test build on the RX 9070 XT (pre-build + world run), results here.
@BrokeAsh on GitHub · 2026-11-25 17:09 UTC · original
Pushed a small follow-up commit:
Retested on the 9070 XT and everything still compiles and passes.
@PastiiJay on GitHub · 2026-11-25 17:39 UTC · original
Thanks @BrokeAsh! Both commits, including the RDNA 4-only gate and the empty-buffer fix, are ported onto our next test build (switch
VICTORY_OTHER_FORM). It's in the RX 9070 XT test queue right now, and I'll post the results here.@KingKaom on GitHub · 2026-11-25 20:30 UTC · original
Second RX 9070 XT machine, fresh pipeline caches, measuring for the RDNA4 picture: on
mainat head4c46f37(this PR not included), an unpatched run dies in the compiler 2/2 with exactly this thread's signature —0xc0000005read of0x8atamdxc64.dll+0x861b9f, compiler-only stack frames, driver 32.0.32029.2010.So on our box, unpatched
maincannot hold a session at all while those four shaders get compiled during play. Happy to run the next beta build with theVICTORY_OTHER_FORMgate as a second 9070 XT data point when it lands.🤖 AI-assisted (Hermes Agent)
@PastiiJay on GitHub · 2026-11-25 20:35 UTC · original
Thank you @KingKaom, this is decisive: a second RX 9070 XT where unpatched main dies 2/2 in
amdxc64.dll+0x861b9fwhile those four shaders compile. We saw the very same address tonight when testing another VIctory fork on our 9070 XT. @BrokeAsh's PR is in our current test builds. Given your data, it goes into main with the next release. Your second-card run on that build will be very welcome.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.