RDNA 4: a raw view's size asked through a handle of its own (amdxc64.dll+0x861b9f) #357

Open
DTsordas wants to merge 1 commit from upstream-pr/357 into main
DTsordas commented 2026-11-26 18:21:09 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by DTsordas on 2026-11-26T18:21:09Z.


Fixes the AMD shader compiler crash on RDNA 4 reported in #8, #44 and #60, with a smaller change than #55, and only on RDNA 4 hosts. That answers the two points #55 was left open for: it does not conflict with main, and it changes nothing for other AMD cards.

The cause

AMD's compiler faults in CreateComputePipelineState (amdxc64.dll+0x861b9f, a read of 0x8) on a program where a raw buffer's getDimensions and a load from that same buffer get their handles from the same index value.

I narrowed one of the crashing programs (bvh_skinning:CSComputeTreeAnim, a567b9ef845fb680) down by cutting parts out of it and handing each version to the driver. The rest pointed the same way:

  • What the load reads, its address, its alignment, its mask, the udiv that turns bytes into records, waveReadLaneFirst on the size, and DisableOptimizations all made no difference.
  • A size query through a second handle, from an index computed anew, avoids the fault every time.
  • With one index value shared by both handles, it faults again, even with NonUniformResourceIndex on the second handle. An or 0 on the index is no help either, because the driver folds it away.
  • The clean-up's REUSE pass (VICTORY_SHADER_OPT bit 4) merges equal index computations, so it creates more of these programs. That explains why VICTORY_SHADER_OPT=59 helped some cards and not others.

size_tests::the_record_count_of_a_structured_buffer_read_by_index is a minimal repro. On unmodified main it kills the test process on an RX 9060 XT.

The change (99 lines, 6 files)

  • On RDNA 4 hosts, descriptor_data asks a raw view's size through a handle of its own. Its index is computed again and kept out of the clean-up passes (Module::mark / keep_since, which opt.rs honours), and the handle is marked NonUniformResourceIndex. No value changes, because the index is uniform. A waterfall's per-lane handle is left as it is, since it is marked already.
  • RDNA 4 is detected from AMD's device id, 0x7550..=0x75ff (Navi 48: RX 9070, 9070 XT, Radeon AI PRO R9700; Navi 44: RX 9060 XT). RDNA 3 lies below that range (0x744c is the RX 7900 XTX). The adapter log line now shows rdna4=.
  • VICTORY_RAW_SIZE_HANDLE=1 / =0 turns it on or off on any host, for example for offline translate runs, which open no device. The shader cache keys on it as a fifth host setting (host_settings).
  • size_tests always use the new form, because their size reads run on the host's GPU.
  • The extra handle is not counted in nonuniform_handles, which counts per-lane accesses, so the waterfall tests are unchanged.

Tested

RX 9060 XT 16 GB (gfx1200, 0x7590), Ryzen 5 5600X, 64 GB, Windows 11. Drivers 32.0.32015.7029 (26.10.1) and 32.0.32029.2010 (26.11.2). Diagnostics build of c9c932c plus this commit.

Check Before After
translate --pipelines over every shader of the title, one hash prefix per process 7 programs fault: 3 CS_RaytracingResolve, plus 4 tree-animation programs (bvh_skinning ×3, GpuParticleUpdate:CS_UpdateSkinnedAttachMeshTreeParticles) that fault at every VICTORY_SHADER_OPT setting 0 faults, at the default passes (63) and at 59
The same programs with VICTORY_RAW_SIZE_HANDLE=0 — all fault again
the_record_count_of_a_structured_buffer_read_by_index test process killed (0xc0000005) passes on the card and on WARP
cargo test -p victory-shader — 302 passed
victory warm --used (with and without the renderer patches) — 2,896 made, 0 bad
In game, Series X, play.ps1 with and without VICTORY_PORT_* crash in the first minute into the world, no compiler fault; log shows rdna4=true

cargo clippy --workspace --all-targets --all-features -- -D warnings fails on main without this change too (descriptor_sites.rs:277, watch.rs:3626). victory-shader, where most of this change lives, is clean.

I did not test on RDNA 3 or NVIDIA. There, the translation is the same as before unless VICTORY_RAW_SIZE_HANDLE=1 is set.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6632756995 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/357). Originally posted by [DTsordas](https://github.com/DTsordas) on 2026-11-26T18:21:09Z. --- Fixes the AMD shader compiler crash on RDNA 4 reported in #8, #44 and #60, with a smaller change than #55, and only on RDNA 4 hosts. That answers the two points #55 was left open for: it does not conflict with main, and it changes nothing for other AMD cards. ### The cause AMD's compiler faults in `CreateComputePipelineState` (`amdxc64.dll+0x861b9f`, a read of `0x8`) on a program where a raw buffer's `getDimensions` and a load from that same buffer get their handles from **the same index value**. I narrowed one of the crashing programs (`bvh_skinning:CSComputeTreeAnim`, `a567b9ef845fb680`) down by cutting parts out of it and handing each version to the driver. The rest pointed the same way: - What the load reads, its address, its alignment, its mask, the `udiv` that turns bytes into records, `waveReadLaneFirst` on the size, and `DisableOptimizations` all made no difference. - A size query through a **second** handle, from an index **computed anew**, avoids the fault every time. - With one index value shared by both handles, it faults again, even with `NonUniformResourceIndex` on the second handle. An `or 0` on the index is no help either, because the driver folds it away. - The clean-up's REUSE pass (`VICTORY_SHADER_OPT` bit 4) merges equal index computations, so it creates more of these programs. That explains why `VICTORY_SHADER_OPT=59` helped some cards and not others. `size_tests::the_record_count_of_a_structured_buffer_read_by_index` is a minimal repro. On unmodified main it kills the test process on an RX 9060 XT. ### The change (99 lines, 6 files) - On RDNA 4 hosts, `descriptor_data` asks a raw view's size through a handle of its own. Its index is computed again and kept out of the clean-up passes (`Module::mark` / `keep_since`, which `opt.rs` honours), and the handle is marked `NonUniformResourceIndex`. No value changes, because the index is uniform. A waterfall's per-lane handle is left as it is, since it is marked already. - RDNA 4 is detected from AMD's device id, `0x7550..=0x75ff` (Navi 48: RX 9070, 9070 XT, Radeon AI PRO R9700; Navi 44: RX 9060 XT). RDNA 3 lies below that range (`0x744c` is the RX 7900 XTX). The adapter log line now shows `rdna4=`. - `VICTORY_RAW_SIZE_HANDLE=1` / `=0` turns it on or off on any host, for example for offline `translate` runs, which open no device. The shader cache keys on it as a fifth host setting (`host_settings`). - `size_tests` always use the new form, because their size reads run on the host's GPU. - The extra handle is not counted in `nonuniform_handles`, which counts per-lane accesses, so the waterfall tests are unchanged. ### Tested RX 9060 XT 16 GB (gfx1200, `0x7590`), Ryzen 5 5600X, 64 GB, Windows 11. Drivers 32.0.32015.7029 (26.10.1) and 32.0.32029.2010 (26.11.2). Diagnostics build of `c9c932c` plus this commit. | Check | Before | After | |---|---|---| | `translate --pipelines` over every shader of the title, one hash prefix per process | 7 programs fault: 3 `CS_RaytracingResolve`, plus 4 tree-animation programs (`bvh_skinning` ×3, `GpuParticleUpdate:CS_UpdateSkinnedAttachMeshTreeParticles`) that fault at **every** `VICTORY_SHADER_OPT` setting | 0 faults, at the default passes (63) and at 59 | | The same programs with `VICTORY_RAW_SIZE_HANDLE=0` | — | all fault again | | `the_record_count_of_a_structured_buffer_read_by_index` | test process killed (`0xc0000005`) | passes on the card and on WARP | | `cargo test -p victory-shader` | — | 302 passed | | `victory warm --used` (with and without the renderer patches) | — | 2,896 made, 0 bad | | In game, Series X, `play.ps1` with and without `VICTORY_PORT_*` | crash in the first minute | into the world, no compiler fault; log shows `rdna4=true` | `cargo clippy --workspace --all-targets --all-features -- -D warnings` fails on main without this change too (`descriptor_sites.rs:277`, `watch.rs:3626`). `victory-shader`, where most of this change lives, is clean. I did not test on RDNA 3 or NVIDIA. There, the translation is the same as before unless `VICTORY_RAW_SIZE_HANDLE=1` is set. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/357:upstream-pr/357'
git switch 'upstream-pr/357'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/357'
git switch 'upstream-pr/357'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/357'
git switch 'upstream-pr/357'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/357'
git switch 'main'
git merge --squash 'upstream-pr/357'
git switch 'main'
git merge --ff-only 'upstream-pr/357'
git switch 'main'
git merge 'upstream-pr/357'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!357
No description provided.