fix(shader/amd): emit dedicated non-uniform heap handle for buffer size queries (#276) #385

Manually merged
github merged 1 commit from github-bot/gh-385 into gh-pr/385/base 2026-12-03 12:06:04 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-03 11:25 UTC · original
Androtim:fix/amd-buffer-size-nonuniform-handle → main · +47 −2 · 3 files · 1 commits · merged 2026-12-03 12:01 UTC

Summary

Fixes an AMD RDNA 4 (RX 9070 / RX 9060, amdxc64.dll+0x861b9f) shader compiler null-pointer crash inside CreateComputePipelineState when a buffer's size query (dx.op.getDimensions) shares the same uniform heap handle as the buffer's loads.

Adapted cleanly from GPL-3.0 KyleS98/VIctory-Neo commit b368b6d (originally ported from trustno1-coder/VIctory-NVIDIA 66da8aaa, DexNom/VIctory#62, and fxceless/victory-fork#1213).

Changes

  • Added crates/victory-shader/src/emit/lower/amd.rs (Lower::size_view_handle): emits a dedicated heap handle marked nonuniform = true for uniform buffer size queries (preserving raw_twin adjustment and keeping nonuniform_handles unchanged since the index is uniform across lanes); images and waterfall loads continue using self.handle(...).
  • Wired descriptor_data in crates/victory-shader/src/emit/lower.rs to call self.size_view_handle(...).
  • Updated scalar_table_load_uses_the_base_index_and_computed_soffset in crates/victory-shader/src/emit/lower_tests.rs to verify both the load handle and the size query handle resolve to the identical heap slot.

Verification

  • cargo test -p victory-shader --lib scalar_table_load_uses_the_base_index_and_computed_soffset
  • cargo clippy -p victory-shader --all-targets -- -D warnings
  • Gate 1: GitHub CI check
  • Gate 2: Read-only Reasoning Audit (#282)
  • Gate 3: Live RTX 4060 Ti smoke verification

Related: #276

**@⁠Androtim** on GitHub · 2026-12-03 11:25 UTC · [original](https://github.com/Androtim/MiniVI/pull/385) `Androtim:fix/amd-buffer-size-nonuniform-handle` → `main` · +47 −2 · 3 files · 1 commits · merged 2026-12-03 12:01 UTC ## Summary Fixes an AMD RDNA 4 (`RX 9070` / `RX 9060`, `amdxc64.dll+0x861b9f`) shader compiler null-pointer crash inside `CreateComputePipelineState` when a buffer's size query (`dx.op.getDimensions`) shares the same uniform heap handle as the buffer's loads. Adapted cleanly from GPL-3.0 `KyleS98/VIctory-Neo` commit `b368b6d` (originally ported from `trustno1-coder/VIctory-NVIDIA` `66da8aaa`, `DexNom/VIctory#62`, and `fxceless/victory-fork#1213`). ## Changes - Added `crates/victory-shader/src/emit/lower/amd.rs` (`Lower::size_view_handle`): emits a dedicated heap handle marked `nonuniform = true` for uniform buffer size queries (preserving `raw_twin` adjustment and keeping `nonuniform_handles` unchanged since the index is uniform across lanes); images and waterfall loads continue using `self.handle(...)`. - Wired `descriptor_data` in `crates/victory-shader/src/emit/lower.rs` to call `self.size_view_handle(...)`. - Updated `scalar_table_load_uses_the_base_index_and_computed_soffset` in `crates/victory-shader/src/emit/lower_tests.rs` to verify both the load handle and the size query handle resolve to the identical heap slot. ## Verification - [x] `cargo test -p victory-shader --lib scalar_table_load_uses_the_base_index_and_computed_soffset` - [x] `cargo clippy -p victory-shader --all-targets -- -D warnings` - [ ] Gate 1: GitHub CI `check` - [ ] Gate 2: Read-only Reasoning Audit (`#282`) - [ ] Gate 3: Live RTX 4060 Ti smoke verification Related: #276
Adapts GPL-3.0 KyleS98/VIctory-Neo commit b368b6d (originally ported from trustno1-coder/VIctory-NVIDIA 66da8aaa, DexNom/VIctory#62, and fxceless/victory-fork#1213).

AMD's RDNA 4 shader compiler (amdxc64.dll+0x861b9f on RX 9070 / RX 9060) hits a null-pointer dereference inside CreateComputePipelineState when a buffer's getDimensions size query shares the same uniform heap handle as the buffer's loads. Emitting a separate non-uniform heap handle for uniform buffer size queries (with raw_twin adjustment preserved and without incrementing nonuniform_handles) prevents the compiler from merging the two handles.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 11:27:30 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-03 11:33 UTC · original

Read-only static audit of 85108133 (CI check PASS): VERIFIED CLEAN (0 [P0], 0 [P1]).

  • crates/victory-shader/src/emit/lower/amd.rs (size_view_handle): clean dedicated non-uniform handle for uniform buffer getDimensions queries, preserving raw_twin adjustment and keeping nonuniform_handles unchanged; waterfall loads and images fall back to self.handle(...).
  • victory-gpu/build.rs already recursively hashes crates/victory-shader/src, so the new module automatically updates VICTORY_TRANSLATOR.

Holding auto-merge solely for Gate 3 live GPU smoke verification (since this touches DXIL emission). Once posted, ready to merge immediately.

**@⁠Androtim** on GitHub · 2026-12-03 11:33 UTC · [original](https://github.com/Androtim/MiniVI/pull/385#issuecomment-7376857024) Read-only static audit of `85108133` (**CI `check` PASS**): **VERIFIED CLEAN (0 `[P0]`, 0 `[P1]`)**. - `crates/victory-shader/src/emit/lower/amd.rs` (`size_view_handle`): clean dedicated non-uniform handle for uniform buffer `getDimensions` queries, preserving `raw_twin` adjustment and keeping `nonuniform_handles` unchanged; waterfall loads and images fall back to `self.handle(...)`. - `victory-gpu/build.rs` already recursively hashes `crates/victory-shader/src`, so the new module automatically updates `VICTORY_TRANSLATOR`. Holding auto-merge solely for Gate 3 live GPU smoke verification (since this touches DXIL emission). Once posted, ready to merge immediately.
Author
Owner

@⁠Androtim on GitHub · 2026-12-03 11:34 UTC · original

3-Gate Verification Summary (8510813)

  • Gate 1 (GitHub CI check): PASS (6m34s)
  • Gate 2 (Deep Reasoning Audit, #282 Pass #13): VERIFIED CLEAN (0 P0, 0 P1)
  • Gate 3 (Live RTX 4060 Ti 1440p DLSS Quality cold-cache D3D12 verification): PASS — translated 1,015 shaders and built 191 host PSOs with 0 DXIL validation or PSO compilation failures, 0 DRED, 0 device-removed, peak dedicated VRAM 5524 / 6670 MiB, clean visuals (8.0–8.6 fps).

Ready for merge!

**@⁠Androtim** on GitHub · 2026-12-03 11:34 UTC · [original](https://github.com/Androtim/MiniVI/pull/385#issuecomment-7376887039) ### 3-Gate Verification Summary (`8510813`) - **Gate 1 (GitHub CI `check`):** `PASS` (`6m34s`) - **Gate 2 (Deep Reasoning Audit, #282 Pass #13):** `VERIFIED CLEAN (0 P0, 0 P1)` - **Gate 3 (Live RTX 4060 Ti 1440p DLSS Quality cold-cache D3D12 verification):** `PASS` — translated `1,015` shaders and built `191` host PSOs with `0` DXIL validation or PSO compilation failures, `0` DRED, `0` device-removed, peak dedicated VRAM `5524 / 6670 MiB`, clean visuals (`8.0–8.6 fps`). Ready for merge!
github-bot changed target branch from main to gh-pr/385/base 2026-12-03 12:05:58 +00:00
github manually merged commit 851081339e into gh-pr/385/base 2026-12-03 12:06:03 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!385
No description provided.