Shaders: a heap handle is keyed on both resource properties (fixes #852) #1036

Closed
github-bot wants to merge 1 commit from gh-pr/1036/head into gh-pr/1036/base
Owner

@⁠acleofe on GitHub · 2026-11-24 15:14 UTC · original
fix/shader-handle-key-both-props → main · +57 −2 · 2 files · 1 commits · closed without merging

What

The block-local cache of heap handles in Lower::handle is keyed on both words of the resource properties, not only the first. A test-only heap_props list (beside nonuniform_handles) records each heap handle's properties.

Why

The key held props.0 (kind and UAV bit) but not props.1 (component type, or structure stride). In one block, an image size query or load on a UAV makes a handle annotated as a float RWTexture2D<4xF32> (0x409); an image_atomic_* on the same descriptor afterwards asks for a 32-bit integer one (0x105) and got the cached float handle back. The atomic then runs on a float-annotated handle: dxil.dll accepts the module, but NVIDIA's compiler crashes on it (#852). A structured buffer read with two strides in one block had the same collision.

Test

  • an_image_atomic_after_a_size_query_has_its_own_handle: image_get_resinfo then image_atomic_add on one descriptor make two handles, float then integer. Before this change it made one.
  • cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings and cargo test --workspace --locked pass.

Not run on an NVIDIA GPU. The shader cache keys on the build, so cached translations are redone.

🤖 Generated with Claude Code

**@⁠acleofe** on GitHub · 2026-11-24 15:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1036) `fix/shader-handle-key-both-props` → `main` · +57 −2 · 2 files · 1 commits · closed without merging ## What The block-local cache of heap handles in `Lower::handle` is keyed on both words of the resource properties, not only the first. A test-only `heap_props` list (beside `nonuniform_handles`) records each heap handle's properties. ## Why The key held `props.0` (kind and UAV bit) but not `props.1` (component type, or structure stride). In one block, an image size query or load on a UAV makes a handle annotated as a float `RWTexture2D<4xF32>` (`0x409`); an `image_atomic_*` on the same descriptor afterwards asks for a 32-bit integer one (`0x105`) and got the cached float handle back. The atomic then runs on a float-annotated handle: dxil.dll accepts the module, but NVIDIA's compiler crashes on it (#852). A structured buffer read with two strides in one block had the same collision. ## Test - `an_image_atomic_after_a_size_query_has_its_own_handle`: `image_get_resinfo` then `image_atomic_add` on one descriptor make two handles, float then integer. Before this change it made one. - `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` and `cargo test --workspace --locked` pass. Not run on an NVIDIA GPU. The shader cache keys on the build, so cached translations are redone. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The block-local handle cache keyed on the kind alone, so an image atomic
after a size query on the same descriptor got the query's float-annotated
handle, which NVIDIA's compiler crashes on; a structured buffer read with
two strides collided the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:50 +00:00
github-bot closed this pull request 2026-11-26 04:17:50 +00:00
Author
Owner

@⁠shortselow-byte on GitHub · 2026-11-24 15:51 UTC · original

This PR has no CI run yet, so I ran the CI's checks at head 8d898b1 (on main ffe310e): Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2).

  • cargo test --workspace --locked -- --test-threads=1: 343 passed, 0 failed, including an_image_atomic_after_a_size_query_has_its_own_handle (GPU tests on the AMD device and WARP).
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and with --all-features: clean.
  • cargo xtask policy: ok.

Not run on NVIDIA either, so the driver crash from #852 itself is still unchecked.

**@⁠shortselow-byte** on GitHub · 2026-11-24 15:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/1036#issuecomment-7136734237) This PR has no CI run yet, so I ran the CI's checks at head `8d898b1` (on `main` `ffe310e`): Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2). - `cargo test --workspace --locked -- --test-threads=1`: 343 passed, 0 failed, including `an_image_atomic_after_a_size_query_has_its_own_handle` (GPU tests on the AMD device and WARP). - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and with `--all-features`: clean. - `cargo xtask policy`: ok. Not run on NVIDIA either, so the driver crash from #852 itself is still unchecked.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 16:30 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 8d898b1: cargo test -p victory-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 16:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1036#issuecomment-7137773254) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 8d898b1: `cargo test -p victory-shader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._

Pull request closed

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/Marvisak--VIctory!1036
No description provided.