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

Open
github-bot wants to merge 1 commit from github-bot/gh-357 into main AGit
Owner

@⁠DTsordas on GitHub · 2026-11-26 18:21 UTC · original
DTsordas:fix/rdna4-raw-size-handle → main · +99 −4 · 6 files · 1 commits · open

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

**@⁠DTsordas** on GitHub · 2026-11-26 18:21 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/357) `DTsordas:fix/rdna4-raw-size-handle` → `main` · +99 −4 · 6 files · 1 commits · open 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)
AMD's compiler faults in CreateComputePipelineState (amdxc64.dll+0x861b9f,
a read of 0x8) on a program whose getDimensions and load of one heap buffer
take their handles from the same index value. CS_RaytracingResolve, the tree
animation programs (bvh_skinning, GpuParticleUpdate) and others have it; the
clean-up's REUSE pass makes more of them by merging equal index computations,
which is why VICTORY_SHADER_OPT=59 helped some cards and not others.

On RDNA 4 hosts (AMD device ids 0x7550-0x75ff) the size query now gets a
handle of its own, from an index computed anew and kept from the clean-up
passes (Module::keep_since), marked NonUniformResourceIndex. No value
changes: the index is uniform. Other cards translate as before.
VICTORY_RAW_SIZE_HANDLE=1 / =0 turns it on or off on any host; the shader
cache keys on it (host_settings).

Measured on an RX 9060 XT (gfx1200, 0x7590), drivers 32.0.32015.7029 and
32.0.32029.2010, Ryzen 5 5600X:
- every shader of the title through translate --pipelines, one hash prefix
  per process: 0 faults (before: 7 programs fault, 4 of them at every
  VICTORY_SHADER_OPT setting);
- the same 3 programs with VICTORY_RAW_SIZE_HANDLE=0: all fault again;
- size_tests::the_record_count_of_a_structured_buffer_read_by_index, which
  killed the test process on this card, passes on the card and on WARP;
  cargo test -p victory-shader: 302 passed;
- in game (Series X, play.ps1, renderer patches on and off), no compiler
  fault.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:26:07 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/357/head:github-bot/gh-357'
git switch 'github-bot/gh-357'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-357'
git switch 'github-bot/gh-357'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-357'
git switch 'github-bot/gh-357'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-357'
git switch 'main'
git merge --squash 'github-bot/gh-357'
git switch 'main'
git merge --ff-only 'github-bot/gh-357'
git switch 'main'
git merge 'github-bot/gh-357'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.