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

Merged
Androtim merged 1 commit from upstream-pr/385 into main 2026-12-03 12:01:16 +00:00
Androtim commented 2026-12-03 11:25:43 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T11:25:43Z.


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

<!-- greyfinch-sync:Androtim/MiniVI:issue:5625511295 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/385). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T11:25:43Z. --- ## 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
Androtim commented 2026-12-03 11:33:10 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T11:33:10Z.


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.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7376857024 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/385#issuecomment-7376857024). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T11:33:10Z. --- 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 commented 2026-12-03 11:34:28 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T11:34:28Z.


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!

<!-- greyfinch-sync:Androtim/MiniVI:comment:7376887039 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/385#issuecomment-7376887039). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T11:34:28Z. --- ### 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!
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
Androtim/MiniVI!385
No description provided.