Shaders: compile the four compute shaders the RDNA 4 compiler crashes on #2
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from PastiiJay/klbf-lab. Originally posted by BrokeAsh on 2026-11-25T14:27:19Z.
On 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
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-25T14:31:27Z.
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.
Imported from PastiiJay/klbf-lab. Originally posted by BrokeAsh on 2026-11-25T16:58:57Z.
Rebased onto
betaso it drops straight into the Lab 43 test build. Happy to retarget tomainonce it holdsImported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-25T17:02:43Z.
Thanks @BrokeAsh, perfect. It goes into the next beta test build on the RX 9070 XT (pre-build + world run), results here.
Imported from PastiiJay/klbf-lab. Originally posted by BrokeAsh on 2026-11-25T17:09:37Z.
Pushed a small follow-up commit:
Retested on the 9070 XT and everything still compiles and passes.
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-25T17:39:07Z.
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.Imported from PastiiJay/klbf-lab. Originally posted by KingKaom on 2026-11-25T20:30:44Z.
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)
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-25T20:35:18Z.
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.Pull request closed