Shaders: a buffer's size query through a heap handle of its own (RDNA 4 compiler crash on four tree-animation programs) #117

Closed
github-bot wants to merge 0 commits from github-bot/gh-117 into main AGit
Owner

@⁠alexdeliu on GitHub · 2026-12-01 18:00 UTC · original
alexdeliu:fix/rdna4-size-query-handle → main · +50 −2 · 4 files · 23 commits · closed without merging

Refs #111, #49, #113. This fixes #111's four pipelines that always crash. I haven't tested the eight it says only crash when warmed in parallel, so #111 stays open.

What

On RDNA 4, AMD's D3D12 compiler (amdxc64.dll +0x861b9f, read at 0x8, driver 32.0.32029.2010) crashes making the pipelines of four compute programs: f16876929fa64f9f, 878933b499cfa14d, a567b9ef845fb680 and c1eee35dbc50a9ef. These are the four in #111, and the tree-animation skinning and particle programs. #49 shows the first of them hanging the compiler for up to 17 minutes in play until the device is removed.

It happens when a buffer's size (getDimensions) is asked through the same uniform heap handle the buffer's loads use. With this change the size query gets a heap handle of its own (the loads' raw twin index included), marked non-uniform and not counted in nonuniform_handles. What the programs compute does not change.

  • Switch: VICTORY_SIZE_OWN_HANDLE (on unless 0; 0 behaves as before). It's in the shader cache key with the other translator switches.
  • TRANSLATOR_VERSION 4 → 5, so caches rebuild once.
  • Files: emit/lower/amd.rs (new), one call and the module line in emit/lower.rs, the key entry in shader_cache.rs, and the version.

This is a port of trustno1-coder/VIctory-NVIDIA#559 (BackseatDrivers-Unbound), which is the size-query part of DexNom/VIctory PR 62 (MrToucann). The approach is IxMxAMAR's (fxceless/victory-fork#1213). The switch and the cache key entry are new here. The same port went to readmet3xt-lab/foxhound#355.

Measured

Windows 11, RX 9070 (driver 32.0.32029.2010), Ryzen 7 7700 iGPU (RDNA 2, gfx1036), 31 GB RAM.

Each program on its own, one process each: VICTORY_TRANSLATE_ONLY=<hash> victory translate --validate --pipelines <shaders.rpf>, VICTORY_D3D12_ADAPTER="RX 9070".

main 5d91fde this PR this PR, VICTORY_SIZE_OWN_HANDLE=0
the four programs of #111 4 crash 4 validated, 4 pipelines 4 crash
29 ray-tracing resolve compute programs (made on main already) 29 pipelines 29 pipelines 29 pipelines
2 other compute programs (control) 2 pipelines 2 pipelines 2 pipelines
iGPU (RDNA 2): the same 35 35 pipelines 35 pipelines

Checks, main and this PR:

main 5d91fde this PR
cargo build --release --locked -p victory 0 warnings 0 warnings
cargo test --locked -p victory-shader --lib, RX 9070, without the test below 312 passed, 0 failed 312 passed, 0 failed
same, iGPU (VICTORY_D3D12_ADAPTER=Radeon(TM)) 313 passed, 0 failed 313 passed, 0 failed
same, WARP (VICTORY_WARP=1, --test-threads=1) 312 passed, 1 failed 312 passed, the same 1 failed
cargo clippy --locked -p victory-shader --all-targets -- -D warnings clean clean
cargo xtask policy ok ok
  • size_tests::the_record_count_of_a_structured_buffer_read_by_index takes the test process down on the RX 9070 (0xc0000005) on main and with this PR alike. It passes on the iGPU and on WARP. It's a different case from the four programs, and this PR doesn't change it.
  • The WARP failure is on main too: wave64_tests::a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is.
  • Fails on main and this PR alike, nothing to do with this change:
    • workspace clippy: two same-type casts in victory-gpu (#72 fixes them);
    • cargo test -p xtask: switches::documented_switches_are_read (#72 fixes that too).
  • I didn't run the victory-gpu suite, as CONTRIBUTING asks.

Not measured: in game (fps, frames over 100 ms). I haven't played with it yet. The four programs make their pipelines now, so the warm step and play no longer lose them. Not tested on NVIDIA.

Hashes (container hashes, as the runtime logs them)

Ray-tracing resolve (29): 072f5fe96efd27e1 077869cd9b1456ee 0ae69044bfd15035 1c02f8131c508c75 1e4947eada3d9ee3 203f78efece5bbdf 231d2daa66789312 27ce027e7188bed3 2e28ea6fb9dad3c2 3a6594961b9247e7 3fa1fda35402c93f 4e69dc8770bf27fc 501f0865fdf45dfd 52ab310c43b9f99c 61d7c3333b73892d 7b956e1f6d56609f 7fb216a0c6dee3a9 842de0c32bc8dcc5 8a13d3da7f64b8d1 a1266cc7391ae0d6 a2d880ad5dea1f45 a4df980a1c65fdbe a73284b60aa303ed b7a7fb5ba5934a89 d0130073bb6f7a7d d2c52fcd936985b4 dbba7e080e26ec20 efdb8133aabc37fe f018c205b5199d39

Controls: f753697c1c03772b 5da83868971acee9

Related: #72 also touches emit/lower.rs and TRANSLATOR_VERSION (4 → 6). If it lands first, I'll rebase and move the version on.

🤖 Generated with Claude Code

**@⁠alexdeliu** on GitHub · 2026-12-01 18:00 UTC · [original](https://github.com/eikkapine/justanxboxemulator/pull/117) `alexdeliu:fix/rdna4-size-query-handle` → `main` · +50 −2 · 4 files · 23 commits · closed without merging Refs #111, #49, #113. This fixes #111's four pipelines that always crash. I haven't tested the eight it says only crash when warmed in parallel, so #111 stays open. ## What On RDNA 4, AMD's D3D12 compiler (`amdxc64.dll` +0x861b9f, read at 0x8, driver 32.0.32029.2010) crashes making the pipelines of four compute programs: `f16876929fa64f9f`, `878933b499cfa14d`, `a567b9ef845fb680` and `c1eee35dbc50a9ef`. These are the four in #111, and the tree-animation skinning and particle programs. #49 shows the first of them hanging the compiler for up to 17 minutes in play until the device is removed. It happens when a buffer's size (`getDimensions`) is asked through the same uniform heap handle the buffer's loads use. With this change the size query gets a heap handle of its own (the loads' raw twin index included), marked non-uniform and not counted in `nonuniform_handles`. What the programs compute does not change. - Switch: `VICTORY_SIZE_OWN_HANDLE` (on unless `0`; `0` behaves as before). It's in the shader cache key with the other translator switches. - `TRANSLATOR_VERSION` 4 → 5, so caches rebuild once. - Files: `emit/lower/amd.rs` (new), one call and the module line in `emit/lower.rs`, the key entry in `shader_cache.rs`, and the version. This is a port of trustno1-coder/VIctory-NVIDIA#559 (BackseatDrivers-Unbound), which is the size-query part of DexNom/VIctory PR 62 (MrToucann). The approach is IxMxAMAR's (fxceless/victory-fork#1213). The switch and the cache key entry are new here. The same port went to readmet3xt-lab/foxhound#355. ## Measured Windows 11, RX 9070 (driver 32.0.32029.2010), Ryzen 7 7700 iGPU (RDNA 2, gfx1036), 31 GB RAM. Each program on its own, one process each: `VICTORY_TRANSLATE_ONLY=<hash> victory translate --validate --pipelines <shaders.rpf>`, `VICTORY_D3D12_ADAPTER="RX 9070"`. | | `main` 5d91fde | this PR | this PR, `VICTORY_SIZE_OWN_HANDLE=0` | |---|---|---|---| | the four programs of #111 | 4 crash | **4 validated, 4 pipelines** | 4 crash | | 29 ray-tracing resolve compute programs (made on `main` already) | 29 pipelines | 29 pipelines | 29 pipelines | | 2 other compute programs (control) | 2 pipelines | 2 pipelines | 2 pipelines | | iGPU (RDNA 2): the same 35 | 35 pipelines | 35 pipelines | | Checks, `main` and this PR: | | `main` 5d91fde | this PR | |---|---|---| | `cargo build --release --locked -p victory` | 0 warnings | 0 warnings | | `cargo test --locked -p victory-shader --lib`, RX 9070, without the test below | 312 passed, 0 failed | 312 passed, 0 failed | | same, iGPU (`VICTORY_D3D12_ADAPTER=Radeon(TM)`) | 313 passed, 0 failed | 313 passed, 0 failed | | same, WARP (`VICTORY_WARP=1`, `--test-threads=1`) | 312 passed, 1 failed | 312 passed, the same 1 failed | | `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` | clean | clean | | `cargo xtask policy` | ok | ok | - `size_tests::the_record_count_of_a_structured_buffer_read_by_index` takes the test process down on the RX 9070 (0xc0000005) on `main` and with this PR alike. It passes on the iGPU and on WARP. It's a different case from the four programs, and this PR doesn't change it. - The WARP failure is on `main` too: `wave64_tests::a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is`. - Fails on `main` and this PR alike, nothing to do with this change: - workspace clippy: two same-type casts in `victory-gpu` (#72 fixes them); - `cargo test -p xtask`: `switches::documented_switches_are_read` (#72 fixes that too). - I didn't run the `victory-gpu` suite, as CONTRIBUTING asks. Not measured: in game (fps, frames over 100 ms). I haven't played with it yet. The four programs make their pipelines now, so the warm step and play no longer lose them. Not tested on NVIDIA. <details><summary>Hashes (container hashes, as the runtime logs them)</summary> Ray-tracing resolve (29): 072f5fe96efd27e1 077869cd9b1456ee 0ae69044bfd15035 1c02f8131c508c75 1e4947eada3d9ee3 203f78efece5bbdf 231d2daa66789312 27ce027e7188bed3 2e28ea6fb9dad3c2 3a6594961b9247e7 3fa1fda35402c93f 4e69dc8770bf27fc 501f0865fdf45dfd 52ab310c43b9f99c 61d7c3333b73892d 7b956e1f6d56609f 7fb216a0c6dee3a9 842de0c32bc8dcc5 8a13d3da7f64b8d1 a1266cc7391ae0d6 a2d880ad5dea1f45 a4df980a1c65fdbe a73284b60aa303ed b7a7fb5ba5934a89 d0130073bb6f7a7d d2c52fcd936985b4 dbba7e080e26ec20 efdb8133aabc37fe f018c205b5199d39 Controls: f753697c1c03772b 5da83868971acee9 </details> Related: #72 also touches `emit/lower.rs` and `TRANSLATOR_VERSION` (4 → 6). If it lands first, I'll rebase and move the version on. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On an RX 9070 (driver 32.0.32029.2010) AMD's D3D12 compiler crashes
(amdxc64.dll +0x861b9f) making the pipelines of the title's four
tree-animation skinning and particle compute programs, the four of
issue #111. It happens when a buffer's size is asked through the same
uniform heap handle the buffer's loads use. The size query now gets a
heap handle of its own (the loads' raw twin index included), marked
non-uniform and not counted in `nonuniform_handles`. All four make
their pipelines with it; RDNA 2 makes them either way.

`VICTORY_SIZE_OWN_HANDLE=0`: as before. The shader cache keys on the
switch, and TRANSLATOR_VERSION goes 4 -> 5.

Port of trustno1-coder/VIctory-NVIDIA#559 (BackseatDrivers-Unbound),
the size-query part of DexNom/VIctory PR 62 (MrToucann). The approach
is IxMxAMAR's (fxceless/victory-fork#1213). The switch and the cache
key are new here.

Co-authored-by: BackseatDrivers-Unbound <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 18:01:41 +00:00
github-bot closed this pull request 2026-12-01 19:52:09 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.