Shaders: a size query is not reused (AMD's compiler crashes on 29 compute pipelines on RDNA4) #324

Manually merged
github merged 1 commit from github-bot/gh-324 into a-publier 2026-11-27 00:57:57 +00:00 AGit
Owner

@⁠alexdeliu on GitHub · 2026-11-26 20:19 UTC · original
alexdeliu:fix/rdna4-getdimensions-reuse → a-publier · +30 −1 · 2 files · 1 commits · merged 2026-11-26 22:30 UTC

Fixes the 29 the driver's compiler crashed making a pipeline errors from #298 on an RX 9070 (RDNA4, the 9070 XT's family). All of them are compute pipelines, all crash at the same instruction of amdxc64.dll (32.0.32029.2010), and the runtime leaves them out.

What it is

  • I mapped the 29 crash hashes from the run log to translate --list: all of them are ped_*:CS_RaytracingResolve (13 ped material variants).
  • VICTORY_TRANSLATE_ONLY=<hash> victory translate --pipelines reproduces it in seconds, one pipeline per process.
  • VICTORY_SHADER_OPT narrows it to one clean-up pass: 4 (REUSE) alone crashes, and 59 (everything but REUSE) doesn't.
  • Inside REUSE I tried keeping one kind of instruction out at a time. Keeping only dx.op.getDimensions out makes all 29 pipelines. So the driver crashes when one getDimensions serves the uses of an equal one below it.
  • The same programs make pipelines either way on an RDNA2 iGPU (gfx1036).

The change

  • opt.rs: REUSE gives dx.op.getDimensions no key, so each size query stays where the lowering put it. There are 7 such calls in a resolve program, so the cost is nothing measurable.
  • 312 programs translate differently, so TRANSLATOR_VERSION goes 1 → 2 (victory shaders asked for it).
  • New test: a_size_query_is_not_reused. It fails without the change (left: [[Inst(3), Inst(3)]], the query merged) and passes with it.

Tested (Windows 11, RX 9070 driver 32.0.32029.2010, Ryzen 7 7700 iGPU driver 32.0.21045.29003, 31 GB RAM)

a-publier cd8dfc0 this PR
translate --validate --pipelines of the 29 programs, RX 9070 crashes amdxc64 (6 of 6 tried, one per process) 29 of 29 validated, 29 pipelines
game, same save and spot (prison, Series X profile, play.ps1 settings) 29 compiler crashes logged 0; frame time median 51.6 ms (51.4 before)
cargo test -p victory-shader --lib, RX 9070 302 passed, 0 failed 303 passed, 0 failed
same, iGPU (VICTORY_D3D12_ADAPTER="Radeon(TM)") 303 passed, 0 failed
same, WARP 297 passed, 5 failed 298 passed, the same 5 failed
cargo clippy -p victory-shader -p victory-gpu --all-targets 2 warnings 2 warnings, the same

The 5 WARP failures are on the base too (ds_min_max_f32..., v_permlane16..., whole_wave_f64..., two wave64_tests).

Not fixed here

  • The tree-animation skinning programs (bvh_skinning:CSComputeSkinningTreeAnim*, CSComputeTreeAnim) also crash amdxc64 on the RX 9070 offline. They crash even with VICTORY_SHADER_OPT=0, so that is a different trigger; I'm looking at it separately.
  • I'll report the driver crash to AMD with the facts only (no game code).

🤖 Generated with Claude Code

**@⁠alexdeliu** on GitHub · 2026-11-26 20:19 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324) `alexdeliu:fix/rdna4-getdimensions-reuse` → `a-publier` · +30 −1 · 2 files · 1 commits · merged 2026-11-26 22:30 UTC Fixes the 29 `the driver's compiler crashed making a pipeline` errors from #298 on an RX 9070 (RDNA4, the 9070 XT's family). All of them are compute pipelines, all crash at the same instruction of `amdxc64.dll` (32.0.32029.2010), and the runtime leaves them out. ## What it is - I mapped the 29 crash hashes from the run log to `translate --list`: all of them are `ped_*:CS_RaytracingResolve` (13 ped material variants). - `VICTORY_TRANSLATE_ONLY=<hash> victory translate --pipelines` reproduces it in seconds, one pipeline per process. - `VICTORY_SHADER_OPT` narrows it to one clean-up pass: 4 (REUSE) alone crashes, and 59 (everything but REUSE) doesn't. - Inside REUSE I tried keeping one kind of instruction out at a time. Keeping only `dx.op.getDimensions` out makes all 29 pipelines. So the driver crashes when one `getDimensions` serves the uses of an equal one below it. - The same programs make pipelines either way on an RDNA2 iGPU (gfx1036). ## The change - `opt.rs`: REUSE gives `dx.op.getDimensions` no key, so each size query stays where the lowering put it. There are 7 such calls in a resolve program, so the cost is nothing measurable. - 312 programs translate differently, so `TRANSLATOR_VERSION` goes 1 → 2 (`victory shaders` asked for it). - New test: `a_size_query_is_not_reused`. It fails without the change (`left: [[Inst(3), Inst(3)]]`, the query merged) and passes with it. ## Tested (Windows 11, RX 9070 driver 32.0.32029.2010, Ryzen 7 7700 iGPU driver 32.0.21045.29003, 31 GB RAM) | | `a-publier` cd8dfc0 | this PR | |---|---|---| | `translate --validate --pipelines` of the 29 programs, RX 9070 | crashes amdxc64 (6 of 6 tried, one per process) | **29 of 29 validated, 29 pipelines** | | game, same save and spot (prison, Series X profile, play.ps1 settings) | 29 compiler crashes logged | **0**; frame time median 51.6 ms (51.4 before) | | `cargo test -p victory-shader --lib`, RX 9070 | 302 passed, 0 failed | 303 passed, 0 failed | | same, iGPU (`VICTORY_D3D12_ADAPTER="Radeon(TM)"`) | | 303 passed, 0 failed | | same, WARP | 297 passed, 5 failed | 298 passed, the same 5 failed | | `cargo clippy -p victory-shader -p victory-gpu --all-targets` | 2 warnings | 2 warnings, the same | The 5 WARP failures are on the base too (`ds_min_max_f32...`, `v_permlane16...`, `whole_wave_f64...`, two `wave64_tests`). ## Not fixed here - The tree-animation skinning programs (`bvh_skinning:CSComputeSkinningTreeAnim*`, `CSComputeTreeAnim`) also crash amdxc64 on the RX 9070 offline. They crash even with `VICTORY_SHADER_OPT=0`, so that is a different trigger; I'm looking at it separately. - I'll report the driver crash to AMD with the facts only (no game code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The clean-up pass that gives one instruction for one value (REUSE) merged
a dx.op.getDimensions with an equal one above it. On an RX 9070 (RDNA4,
amdxc64 32.0.32029.2010) the driver's compiler then crashes making the
pipeline (an access violation, always at the same instruction) for 29 of
the title's compute programs, all ped *:CS_RaytracingResolve; the
runtime leaves them out. Keeping getDimensions out of REUSE alone makes
all 29 pipelines; an RDNA2 iGPU makes them either way.

312 programs translate differently, so TRANSLATOR_VERSION goes to 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:23:58 +00:00
Author
Owner

@⁠luisaugustz on GitHub · 2026-11-26 20:47 UTC · original

Early result from an RX 9070 XT (driver 32.0.32029.2010, Ryzen 7 5800X, 32 GB): with this PR alone, one compute pipeline still crashes the compiler here.

Build: cd8dfc06 plus #235, #325, #252 and this PR, diagnostics, ray tracing on, VICTORY_SIZE_OWN_HANDLE=0 so that #252's change is off. Shaders prebuilt with victory shaders.

  • Crashed: compute f16876929fa64f9f, rip=0x7ffb3f861b9f (it ends in 1b9f, as in #298), about a minute into the first launch.
  • The same shader hash made a host pipeline on cd8dfc06 with VICTORY_SIZE_OWN_HANDLE=1 and without this PR.
  • So far this is two short launches, one crash logged. I have not run it long enough to say how many others there are, and I have not reproduced it offline with translate --pipelines.

So on this card #252 may still be needed beside this one. I can run more if it helps.

**@⁠luisaugustz** on GitHub · 2026-11-26 20:47 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7203075007) Early result from an RX 9070 XT (driver 32.0.32029.2010, Ryzen 7 5800X, 32 GB): with this PR alone, one compute pipeline still crashes the compiler here. **Build:** `cd8dfc06` plus #235, #325, #252 and this PR, diagnostics, ray tracing on, `VICTORY_SIZE_OWN_HANDLE=0` so that #252's change is off. Shaders prebuilt with `victory shaders`. - Crashed: `compute f16876929fa64f9f`, `rip=0x7ffb3f861b9f` (it ends in `1b9f`, as in #298), about a minute into the first launch. - The same shader hash made a host pipeline on `cd8dfc06` with `VICTORY_SIZE_OWN_HANDLE=1` and without this PR. - So far this is two short launches, one crash logged. I have not run it long enough to say how many others there are, and I have not reproduced it offline with `translate --pipelines`. So on this card #252 may still be needed beside this one. I can run more if it helps.
github manually merged commit 4eb6cfdf9e into a-publier 2026-11-27 00:57:57 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 22:31 UTC · original

Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at f962387: cargo test --release -p victory-shader --lib 303 passed, 0 failed, 4 ignored.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 22:31 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7204761332) Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at `f962387`: `cargo test --release -p victory-shader --lib` 303 passed, 0 failed, 4 ignored. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠ligmaSec on GitHub · 2026-11-26 23:03 UTC · original

Thanks for isolating the size-query optimization on the RX 9070. I ported alexdeliu’s original commit with attribution to ligmaSec/victory-royale and compared it against our current main using Series X 1.0.2.1. Across 141 character-resolve programs, one changed on our tree. Both revisions created that pipeline on a 32-lane software device. The separate RX 9070 XT case reported above emitted identical bytecode before and after this change.

If anyone here has the affected native Windows driver and time for one offline comparison, our PR has the exact revisions, a local archive selector, and the commands. A one-line result for each build, even if both succeed, would help us decide whether the port belongs in main. No gameplay session or file upload is needed. Test instructions on the port

**@⁠ligmaSec** on GitHub · 2026-11-26 23:03 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7205223560) Thanks for isolating the size-query optimization on the RX 9070. I ported alexdeliu’s original commit with attribution to `ligmaSec/victory-royale` and compared it against our current main using Series X 1.0.2.1. Across 141 character-resolve programs, one changed on our tree. Both revisions created that pipeline on a 32-lane software device. The separate RX 9070 XT case reported above emitted identical bytecode before and after this change. If anyone here has the affected native Windows driver and time for one offline comparison, our PR has the exact revisions, a local archive selector, and the commands. A one-line result for each build, even if both succeed, would help us decide whether the port belongs in main. No gameplay session or file upload is needed. [Test instructions on the port](https://github.com/ligmaSec/victory-royale/pull/87#issuecomment-7205219177)
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-27 06:25 UTC · original

Follow-up on the merged change, offline: RX 7900 XT (RDNA3), driver 32.0.32029.2010 (the same driver as your RX 9070), Windows 11 build 26300. Release builds of cd8dfc0 (before) and 4eb6cfd (a-publier with this PR merged), VICTORY_TRANSLATE_ONLY=<hashes> victory translate --validate --pipelines.

  • cd8dfc0 doesn't crash amdxc64 on RDNA3. All 141 ped_*:CS_RaytracingResolve programs (47 materials x 3, so your 29 are among them) validate and make pipelines, all in one process. I ran it twice. The second time I used a renamed copy of the exe, which the driver caches separately, so the driver's cache could not serve those pipelines. Same result both times. So with this driver the crash does not reproduce on RDNA3: it compiles the form where one getDimensions serves another.
  • 4eb6cfd: the same 141 make pipelines. 66 of them (25 materials) emit different DXIL than on cd8dfc0.
  • Whole archive (translate --validate --list, default wave): 312 programs change from cd8dfc0 to 4eb6cfd, the same count as yours: 207 PS, 99 CS, 3 VS, 3 MS. All 312 come from this PR, since d18b9aa (the merge's first parent) emits the same as cd8dfc0. No program loses validation. The 99 CS are 85 CS_RaytracingResolve (66 ped_*, 19 standard_uber_*), 13 InstanceCulling batch-cull kernels and water_micro_geom_renderer:CS_SurfacePrimitives. All 312 make pipelines on the 7900 XT, on both revisions.
  • The hash in the RX 9070 XT comment above (f16876929fa64f9f) is bvh_skinning:CSComputeSkinningTreeAnimVelocity, one of the tree-animation programs under "Not fixed here". On the 7900 XT all six bvh_skinning tree and wind programs make pipelines on both revisions, one per process.

Not tested: in game; RDNA4.

**@⁠adrianmjim** on GitHub · 2026-11-27 06:25 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7211512519) Follow-up on the merged change, offline: RX 7900 XT (RDNA3), driver 32.0.32029.2010 (the same driver as your RX 9070), Windows 11 build 26300. Release builds of `cd8dfc0` (before) and `4eb6cfd` (a-publier with this PR merged), `VICTORY_TRANSLATE_ONLY=<hashes> victory translate --validate --pipelines`. - **`cd8dfc0` doesn't crash amdxc64 on RDNA3.** All 141 `ped_*:CS_RaytracingResolve` programs (47 materials x 3, so your 29 are among them) validate and make pipelines, all in one process. I ran it twice. The second time I used a renamed copy of the exe, which the driver caches separately, so the driver's cache could not serve those pipelines. Same result both times. So with this driver the crash does not reproduce on RDNA3: it compiles the form where one `getDimensions` serves another. - **`4eb6cfd`:** the same 141 make pipelines. 66 of them (25 materials) emit different DXIL than on `cd8dfc0`. - **Whole archive** (`translate --validate --list`, default wave): **312 programs change** from `cd8dfc0` to `4eb6cfd`, the same count as yours: 207 PS, 99 CS, 3 VS, 3 MS. All 312 come from this PR, since `d18b9aa` (the merge's first parent) emits the same as `cd8dfc0`. No program loses validation. The 99 CS are 85 `CS_RaytracingResolve` (66 `ped_*`, 19 `standard_uber_*`), 13 `InstanceCulling` batch-cull kernels and `water_micro_geom_renderer:CS_SurfacePrimitives`. All 312 make pipelines on the 7900 XT, on both revisions. - The hash in the RX 9070 XT comment above (`f16876929fa64f9f`) is `bvh_skinning:CSComputeSkinningTreeAnimVelocity`, one of the tree-animation programs under "Not fixed here". On the 7900 XT all six `bvh_skinning` tree and wind programs make pipelines on both revisions, one per process. Not tested: in game; RDNA4.
This discussion has been locked. Commenting is limited to contributors.
No description provided.