Shaders: a buffer's size query through a heap handle of its own (AMD's compiler crashes on RDNA 4) #355

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

@⁠alexdeliu on GitHub · 2026-12-01 17:36 UTC · original
alexdeliu:fix/rdna4-size-query-handle → main · +40 −1 · 2 files · 72 commits · closed without merging

On an RX 9070, AMD's D3D12 compiler crashes making the pipelines of 33 of the title's compute programs (amdxc64.dll +0x861b9f, read at 0x8, driver 32.0.32029.2010): 29 ray-tracing resolve programs and 4 tree-animation skinning and particle programs. In the players' logs below, the tree-animation one takes the whole game down on RX 9070 XT and RX 9060 XT cards.

What it changes

The crash happens when a buffer's size (getDimensions) 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. What the programs compute does not change.

This is a port, applied unchanged, 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). Two files: emit/lower/amd.rs (new, 36 lines) and one call plus the module line in emit/lower.rs. No version bump: the shader cache keys on the translator's sources.

Tested

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>.

main 94c3c5f this PR
RX 9070: 29 ray-tracing resolve programs 29 crash 29 validated, 29 pipelines
RX 9070: 4 tree-animation programs 4 crash 4 validated, 4 pipelines
RX 9070: 2 other compute programs (control) 2 pipelines 2 pipelines
iGPU (RDNA 2): the same 35 35 pipelines 35 pipelines

cargo test --locked -p victory-shader --lib:

adapter main 94c3c5f this PR
RX 9070 (VICTORY_ADAPTER=9070), without the test below 290 passed, 0 failed 290 passed, 0 failed
iGPU (VICTORY_ADAPTER=Radeon(TM)) 291 passed, 0 failed 291 passed, 0 failed
WARP (VICTORY_WARP=1, --test-threads=1), without the test below 285 passed, 5 failed 285 passed, the same 5 failed
  • 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. #559 reported the same. It passes on the iGPU and on WARP with both. DoubleGhosty/cool_fox#174 is written for that test's case (a raw buffer's size, then a load from it in the same block). On this card #174 makes the 4 tree-animation programs but not the 29 ray-tracing resolve ones, so it is not a replacement for this PR. It could go on top.
  • The 5 WARP failures are on main too: ds_min_max_f32_order_floats_and_return_the_old_value, host_forms_give_what_the_spelled_out_ones_give, v_permlane16_and_x16_read_the_lanes_their_selectors_pick, whole_wave_f64_sum_and_cvt_f32_f64, wave64_tests::a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is. With several test threads WARP sometimes takes the process down, on main and on this PR alike; one thread at a time it doesn't.
  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: clean on main and on this PR.

Related issues: #264 (the crash at start after f16876929fa64f9f, one of the 4 tree-animation programs), #129, #127, #328, #184 (RX 9070 XT and RX 9060 XT crashes that players work around with LEAVE_OUT=...f16876929fa64f9f). The pipeline that takes the game down in those logs is made with this PR. I haven't confirmed in game, so this says Refs, not Fixes.

Not tested: in game (the programs make their pipelines now; I have not played with it yet), and NVIDIA cards (the change only touches how the size query's handle is made; #559 reports that DexNom's evaluation of PR 62 found the other output byte-identical).

Program 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

Tree animation (4): f16876929fa64f9f 878933b499cfa14d a567b9ef845fb680 c1eee35dbc50a9ef

Controls: f753697c1c03772b 5da83868971acee9

🤖 Generated with Claude Code

**@⁠alexdeliu** on GitHub · 2026-12-01 17:36 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/355) `alexdeliu:fix/rdna4-size-query-handle` → `main` · +40 −1 · 2 files · 72 commits · closed without merging On an RX 9070, AMD's D3D12 compiler crashes making the pipelines of 33 of the title's compute programs (`amdxc64.dll` +0x861b9f, read at 0x8, driver 32.0.32029.2010): 29 ray-tracing resolve programs and 4 tree-animation skinning and particle programs. In the players' logs below, the tree-animation one takes the whole game down on RX 9070 XT and RX 9060 XT cards. ## What it changes The crash happens when a buffer's size (`getDimensions`) 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`. What the programs compute does not change. This is a port, applied unchanged, 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). Two files: `emit/lower/amd.rs` (new, 36 lines) and one call plus the module line in `emit/lower.rs`. No version bump: the shader cache keys on the translator's sources. ## Tested 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>`. | | `main` 94c3c5f | this PR | |---|---|---| | RX 9070: 29 ray-tracing resolve programs | 29 crash | **29 validated, 29 pipelines** | | RX 9070: 4 tree-animation programs | 4 crash | **4 validated, 4 pipelines** | | RX 9070: 2 other compute programs (control) | 2 pipelines | 2 pipelines | | iGPU (RDNA 2): the same 35 | 35 pipelines | 35 pipelines | `cargo test --locked -p victory-shader --lib`: | adapter | `main` 94c3c5f | this PR | |---|---|---| | RX 9070 (`VICTORY_ADAPTER=9070`), without the test below | 290 passed, 0 failed | 290 passed, 0 failed | | iGPU (`VICTORY_ADAPTER=Radeon(TM)`) | 291 passed, 0 failed | 291 passed, 0 failed | | WARP (`VICTORY_WARP=1`, `--test-threads=1`), without the test below | 285 passed, 5 failed | 285 passed, the same 5 failed | - `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. #559 reported the same. It passes on the iGPU and on WARP with both. DoubleGhosty/cool_fox#174 is written for that test's case (a raw buffer's size, then a load from it in the same block). On this card #174 makes the 4 tree-animation programs but not the 29 ray-tracing resolve ones, so it is not a replacement for this PR. It could go on top. - The 5 WARP failures are on `main` too: `ds_min_max_f32_order_floats_and_return_the_old_value`, `host_forms_give_what_the_spelled_out_ones_give`, `v_permlane16_and_x16_read_the_lanes_their_selectors_pick`, `whole_wave_f64_sum_and_cvt_f32_f64`, `wave64_tests::a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is`. With several test threads WARP sometimes takes the process down, on `main` and on this PR alike; one thread at a time it doesn't. - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: clean on `main` and on this PR. Related issues: #264 (the crash at start after `f16876929fa64f9f`, one of the 4 tree-animation programs), #129, #127, #328, #184 (RX 9070 XT and RX 9060 XT crashes that players work around with `LEAVE_OUT=...f16876929fa64f9f`). The pipeline that takes the game down in those logs is made with this PR. I haven't confirmed in game, so this says Refs, not Fixes. Not tested: in game (the programs make their pipelines now; I have not played with it yet), and NVIDIA cards (the change only touches how the size query's handle is made; #559 reports that DexNom's evaluation of PR 62 found the other output byte-identical). <details><summary>Program 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 Tree animation (4): f16876929fa64f9f 878933b499cfa14d a567b9ef845fb680 c1eee35dbc50a9ef Controls: f753697c1c03772b 5da83868971acee9 </details> 🤖 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 33 of the title's compute
programs, and the runtime leaves them out: 29 ray-tracing resolve programs
and 4 tree-animation skinning and particle programs. 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 33 make their pipelines with it; RDNA 2 makes
them either way.

Port of trustno1-coder/VIctory-NVIDIA#559 (66da8aaa, BackseatDrivers-Unbound),
the size-query part of DexNom/VIctory PR 62 (MrToucann). The approach is
IxMxAMAR's (fxceless/victory-fork#1213). Applied unchanged.

No version to bump: the shader cache keys on the translator's sources
(victory-gpu build.rs).

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 17:36:37 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-12-01 17:55 UTC · original

Ran the full victory-shader library suite at 47b8bb0 on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own CARGO_TARGET_DIR, no local patches.

cargo test -q --locked -p victory-shader --lib -- --test-threads=1
291 passed; 0 failed; 4 ignored      (exit 0)

The suite passes here. This adds an NVIDIA data point: the description says NVIDIA cards were not tested (the change is about how the buffer's size-query handle is made, for AMD's RDNA 4 compiler). The 5 WARP-only failures and the RX 9070 size_tests::the_record_count_of_a_structured_buffer_read_by_index crash reported in the description did not occur on this adapter; the 4 ignored tests are the usual ones. No title was run.

Not tested: a retail title, the RDNA 4 / WARP configurations from the description, Wine, AMD adapters, release profile, game data.

AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the suite, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-12-01 17:55 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/355#issuecomment-7320067339) Ran the full `victory-shader` library suite at `47b8bb0` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own `CARGO_TARGET_DIR`, no local patches. ``` cargo test -q --locked -p victory-shader --lib -- --test-threads=1 291 passed; 0 failed; 4 ignored (exit 0) ``` The suite passes here. This adds an NVIDIA data point: the description says NVIDIA cards were not tested (the change is about how the buffer's size-query handle is made, for AMD's RDNA 4 compiler). The 5 WARP-only failures and the RX 9070 `size_tests::the_record_count_of_a_structured_buffer_read_by_index` crash reported in the description did not occur on this adapter; the 4 ignored tests are the usual ones. No title was run. Not tested: a retail title, the RDNA 4 / WARP configurations from the description, Wine, AMD adapters, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the suite, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-12-01 21:09 UTC · original

Thank you. An alternative that applies only on AMD cards was taken first. If your approach still helps where that one doesn't apply, please show the case here.

**@⁠readmet3xt-lab** on GitHub · 2026-12-01 21:09 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/355#issuecomment-7325831116) Thank you. An alternative that applies only on AMD cards was taken first. If your approach still helps where that one doesn't apply, please show the case here.
github-bot closed this pull request 2026-12-02 07:54:35 +00:00

Pull request closed

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