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

Merged
alexdeliu merged 1 commit from upstream-pr/324 into a-publier 2026-11-26 22:30:23 +00:00
alexdeliu commented 2026-11-26 20:19:50 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by alexdeliu on 2026-11-26T20:19:50Z.


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

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5516628889 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324). Originally posted by [alexdeliu](https://github.com/alexdeliu) on 2026-11-26T20:19:50Z. --- 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)
luisaugustz commented 2026-11-26 20:47:24 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by luisaugustz on 2026-11-26T20:47:24Z.


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.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7203075007 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7203075007). Originally posted by [luisaugustz](https://github.com/luisaugustz) on 2026-11-26T20:47:24Z. --- 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.
MamaLeVrai commented 2026-11-26 22:31:53 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by MamaLeVrai on 2026-11-26T22:31:53Z.


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.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7204761332 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7204761332). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-26T22:31:53Z. --- 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.
ligmaSec commented 2026-11-26 23:03:58 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by ligmaSec on 2026-11-26T23:03:58Z.


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

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7205223560 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7205223560). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-11-26T23:03:58Z. --- 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)
adrianmjim commented 2026-11-27 06:25:22 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by adrianmjim on 2026-11-27T06:25:22Z.


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.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7211512519 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/324#issuecomment-7211512519). Originally posted by [adrianmjim](https://github.com/adrianmjim) on 2026-11-27T06:25:22Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Belobug/VIctory-Belobug-AMD!324
No description provided.