Shader: key every heap handle cache by element type (#177 on main, fixes the NVIDIA compute-pipeline crash) #2723

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

@⁠andyeox-systemd on GitHub · 2026-11-25 18:50 UTC · original
andyeox-systemd:nvidia-atomic-handles → main · +112 −6 · 2 files · 1 commits · open

Builds on #177 (Ortomanic's fix and gingertonik's test, credited as co-authors), resolved against current main (13f91ca), and extended to the two handle caches main added since.

The bug

When a UAV is read as float and is also the target of an atomic, the lowering reused one float-typed handle for both. After conversion to SPIR-V, the atomic is invalid (AtomicOr / AtomicUMax: expected Result Type to be integer scalar type), and NVIDIA's compiler crashes in vkCreateComputePipelines (0xc0000005 / 0xc000001d in the Unix call). This is the crash in #144.

#177 added the element type (props.1) to the handles key. main has since added entry_handles and join_handles, which had the same problem, so this PR keys those by both property words as well. #177's test is included, with view_marks added for the current Parts.

Testing

RTX 4070 Ti, Arch Linux, nvidia-open-dkms 620.73.04, Wine 11.22, vkd3d-proton built from master (71cae09, dxil-spirv b540c8a). Shaders were dumped with VKD3D_SHADER_DUMP_PATH and checked with spirv-val --target-env vulkan1.3. I used fresh caches for both runs.

main (13f91ca) this PR
Crash in vkCreateComputePipelines yes (0xc0000005) no
Shaders translated 345 831+
Invalid SPIR-V 2 (AtomicOr, AtomicUMax on a non-integer) 0 of 1,277
Reached loading screen the first cutscene (subtitles, lights; the 3D scene is black as in other reports), at 0.2 to 0.7 fps

cargo test -p victory-shader --lib on Linux (with the Windows-only validator blocks compiled out locally): 159 passed, 0 failed, against 158 on main. The extra one is #177's test.

Separate vkd3d-proton issue

On vkd3d-proton 3.1 and earlier, the title crashes earlier for a different reason. dxil-spirv's old structurizer emits invalid control flow for three shaders ("Function end cannot be called in blocks", "block exits the loop headed by…"). Microsoft's dxv accepts our DXIL for all three, so that's not a VIctory bug. It is fixed by dxil-spirv's structurizer rewrite, which is in vkd3d-proton master and not in 3.1. NVIDIA under Wine needs both fixes.

AI-assisted. No game data is included.

**@⁠andyeox-systemd** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723) `andyeox-systemd:nvidia-atomic-handles` → `main` · +112 −6 · 2 files · 1 commits · open Builds on #177 (Ortomanic's fix and gingertonik's test, credited as co-authors), resolved against current `main` (`13f91ca`), and extended to the two handle caches `main` added since. ## The bug When a UAV is read as float and is also the target of an atomic, the lowering reused one float-typed handle for both. After conversion to SPIR-V, the atomic is invalid (`AtomicOr` / `AtomicUMax: expected Result Type to be integer scalar type`), and NVIDIA's compiler crashes in `vkCreateComputePipelines` (`0xc0000005` / `0xc000001d` in the Unix call). This is the crash in #144. #177 added the element type (`props.1`) to the `handles` key. `main` has since added `entry_handles` and `join_handles`, which had the same problem, so this PR keys those by both property words as well. #177's test is included, with `view_marks` added for the current `Parts`. ## Testing RTX 4070 Ti, Arch Linux, `nvidia-open-dkms` 620.73.04, Wine 11.22, **vkd3d-proton built from master** (`71cae09`, dxil-spirv `b540c8a`). Shaders were dumped with `VKD3D_SHADER_DUMP_PATH` and checked with `spirv-val --target-env vulkan1.3`. I used fresh caches for both runs. | | `main` (`13f91ca`) | this PR | |---|---|---| | Crash in `vkCreateComputePipelines` | yes (`0xc0000005`) | **no** | | Shaders translated | 345 | 831+ | | Invalid SPIR-V | 2 (`AtomicOr`, `AtomicUMax` on a non-integer) | **0 of 1,277** | | Reached | loading screen | the first cutscene (subtitles, lights; the 3D scene is black as in other reports), at 0.2 to 0.7 fps | `cargo test -p victory-shader --lib` on Linux (with the Windows-only validator blocks compiled out locally): 159 passed, 0 failed, against 158 on `main`. The extra one is #177's test. ## Separate vkd3d-proton issue On vkd3d-proton 3.1 and earlier, the title crashes earlier for a different reason. dxil-spirv's old structurizer emits invalid control flow for three shaders ("Function end cannot be called in blocks", "block exits the loop headed by…"). Microsoft's `dxv` accepts our DXIL for all three, so that's not a VIctory bug. It is fixed by dxil-spirv's structurizer rewrite, which is in vkd3d-proton master and not in 3.1. NVIDIA under Wine needs both fixes. AI-assisted. No game data is included.
A UAV read as float and also used by an atomic needs two handles: an
atomic on the float handle is invalid SPIR-V after conversion
("AtomicOr/AtomicUMax: expected Result Type to be integer scalar type")
and crashes NVIDIA's compiler in vkCreateComputePipelines.

#177 added the element type to the `handles` key. main has since added
`entry_handles` and `join_handles`, which had the same problem; they are
keyed by both property words now as well. Includes #177's test, with
`view_marks` added for the current `Parts`.

Co-authored-by: Ortomanic <[email protected]>
Co-authored-by: gingertonik <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:47 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:59 UTC · original

Correct root cause and fix: one UAV read as float and targeted by an atomic legitimately needs two annotated handles (atomic requires integer component type), and caching by props.0 alone collapsed them. Extending the key to props.1 across all three caches (handles, entry_handles, join_handles) is the complete version of #177's fix. The test constructs the exact shape (image_load + image_atomic_umin, same descriptor) and asserts the two distinct annotations. Hardware-verified against the actual crash.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7171671132) Correct root cause and fix: one UAV read as float and targeted by an atomic legitimately needs two annotated handles (atomic requires integer component type), and caching by props.0 alone collapsed them. Extending the key to props.1 across all three caches (handles, entry_handles, join_handles) is the complete version of #177's fix. The test constructs the exact shape (image_load + image_atomic_umin, same descriptor) and asserts the two distinct annotations. Hardware-verified against the actual crash.
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 19:06 UTC · original

The float-load/atomic regression uses one fixed table entry, so it exercises entry_handles. The fixture would still pass if props.1 were removed from the handles or join_handles key.

Could you add a uniform dynamic-offset case for handles and a case where the descriptor is selected at a control-flow join for join_handles? Each should fail if only its corresponding cache key drops props.1.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-25 19:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7171821526) The float-load/atomic regression uses one fixed table entry, so it exercises `entry_handles`. The fixture would still pass if `props.1` were removed from the `handles` or `join_handles` key. Could you add a uniform dynamic-offset case for `handles` and a case where the descriptor is selected at a control-flow join for `join_handles`? Each should fail if only its corresponding cache key drops `props.1`. *AI-assisted with Codex.*
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:32 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + dxil.dll verification and code review of 235c48c6 (on 13f91ca):

Verification (rustc 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll)

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings and --features host: 0 warnings.
  • cargo test --locked -p victory-shader --features host --lib -- an_image_read_as_float_and_by_an_atomic_is_annotated_twice: 1 passed, 0 failed.
  • cargo test --locked -p victory-shader --features host --lib -- emit::valu_tests --test-threads=1 (RTX 5090 hardware + WARP + dxil.dll): 30 passed, 0 failed.

Review Notes

  • All three descriptor heap handle caches (entry_handles, handles, and join_handles) now include props.1 (component type/count), avoiding redundant handle creation for raw/structured/CBV/sampler handles (props.1 == 0) while splitting mixed float/integer typed accesses on the same descriptor.
  • Cleanly non-overlapping with #2610 and #2668. (Echoing @⁠DrDarkDK's minor test note: adding cases that hit handles and join_handles would pin all three caches, though the production code already updates all three.)
**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7172435333) Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + `dxil.dll` verification and code review of `235c48c6` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`) - `cargo xtask policy`: **184 files ok**. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` and `--features host`: **0 warnings**. - `cargo test --locked -p victory-shader --features host --lib -- an_image_read_as_float_and_by_an_atomic_is_annotated_twice`: **1 passed, 0 failed**. - `cargo test --locked -p victory-shader --features host --lib -- emit::valu_tests --test-threads=1` (RTX 5090 hardware + WARP + `dxil.dll`): **30 passed, 0 failed**. ### Review Notes - All three descriptor heap handle caches (`entry_handles`, `handles`, and `join_handles`) now include `props.1` (component type/count), avoiding redundant handle creation for raw/structured/CBV/sampler handles (`props.1 == 0`) while splitting mixed float/integer typed accesses on the same descriptor. - Cleanly non-overlapping with #2610 and #2668. (Echoing @⁠DrDarkDK's minor test note: adding cases that hit `handles` and `join_handles` would pin all three caches, though the production code already updates all three.)
Author
Owner

@⁠pablogonz12 on GitHub · 2026-11-25 19:41 UTC · original

AMD/RADV offline check of the head commit (no game run).

  • Hardware / stack: RX 9070 XT, Mesa 26.3.1 RADV, GE-Proton11-14; base = origin/main 13f91caee.
  • Method: the 751-program world-shader dump, translated by each tree's own victory-shader --example retranslate, then dxil-spirv (master), spirv-val --target-env vulkan1.3, and a real vkCreateCompute/GraphicsPipelines on RADV (vkpipe, one process per program, so a driver crash or hang is recorded per program rather than stopping the batch).
  • Offline only: pipelines are created, never bound or drawn, so wrong pixels and ISA-level miscompiles are out of reach here.
    Result, base 13f91caee vs head 235c48c68: both translate 749 / 751 (the same 2 refused in both trees, a lane mask read as data is not supported).

18 programs' DXIL bytes change — 12 pixel, 6 compute — and this PR is the difference between "the host rejects the shader" and a working pipeline:

base 13f91caee head 235c48c68
spirv-val on those 18 fails, OpAtomicUMax/OpAtomicIAdd with a %float result type passes
RADV pipeline none created ok, 30.8–445.9 ms each

Examples: compute-11bbed94ee7a3243 base error: line 352: AtomicUMax: expected Result Type to be integer scalar type %297 = OpAtomicUMax %float ...; pixel-15c34c906ac8b908 base AtomicIAdd: expected Result Type to be integer scalar type. Head translates the same programs into integer atomics and all 18 build.

The other 731 translated programs are byte-identical to main, so nothing else moves. Worth mentioning in the description: on main these 18 shaders produce SPIR-V that validation refuses, i.e. any pipeline that uses them cannot be created at all.

Not tested in a game run; not tested on NVIDIA.

**@⁠pablogonz12** on GitHub · 2026-11-25 19:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7172633137) AMD/RADV offline check of the head commit (no game run). - Hardware / stack: RX 9070 XT, Mesa 26.3.1 RADV, GE-Proton11-14; base = `origin/main` 13f91caee. - Method: the 751-program world-shader dump, translated by each tree's own `victory-shader --example retranslate`, then dxil-spirv (master), `spirv-val --target-env vulkan1.3`, and a real `vkCreateCompute/GraphicsPipelines` on RADV (`vkpipe`, one process per program, so a driver crash or hang is recorded per program rather than stopping the batch). - Offline only: pipelines are created, never bound or drawn, so wrong pixels and ISA-level miscompiles are out of reach here. **Result, base 13f91caee vs head 235c48c68:** both translate **749 / 751** (the same 2 refused in both trees, `a lane mask read as data is not supported`). **18 programs' DXIL bytes change** — 12 pixel, 6 compute — and this PR is the difference between "the host rejects the shader" and a working pipeline: | | base 13f91caee | head 235c48c68 | |---|---|---| | spirv-val on those 18 | fails, `OpAtomicUMax`/`OpAtomicIAdd` with a `%float` result type | passes | | RADV pipeline | none created | ok, 30.8–445.9 ms each | Examples: `compute-11bbed94ee7a3243` base `error: line 352: AtomicUMax: expected Result Type to be integer scalar type %297 = OpAtomicUMax %float ...`; `pixel-15c34c906ac8b908` base `AtomicIAdd: expected Result Type to be integer scalar type`. Head translates the same programs into integer atomics and all 18 build. The other 731 translated programs are byte-identical to main, so nothing else moves. Worth mentioning in the description: on main these 18 shaders produce SPIR-V that validation refuses, i.e. any pipeline that uses them cannot be created at all. Not tested in a game run; not tested on NVIDIA.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 19:41 UTC · original

Independent WARP/CPU verification for head 235c48c6827171084ec7215de92f974c9f1a7c5b against origin/main 13f91caee2. State check: open, non-draft, clean merge-tree; no oni-swr comment found.

Environment: Windows x64, Rust 1.98.1 (48a229cea 2026-09-01), Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11); WARP/D3D12 WARP env vars set; CARGO_TARGET_DIR=D:\victory-warp-2720-target.

Commands/results:

  • Baseline: cargo test --locked -p victory-shader --lib — 267 passed, 3 failed, 3 ignored; cargo clippy --locked -p victory-shader --all-targets -- -D warnings — pass.
  • PR: cargo test --locked -p victory-shader emit::lower::tests::an_image_read_as_float_and_by_an_atomic_is_annotated_twice — 1 passed; cargo test --locked -p victory-shader --lib — 268 passed, 3 failed, 3 ignored; strict Clippy — pass.
  • The same three pre-existing WARP failures occur on baseline and PR: a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out.
  • Negative control: reverted the properties from all three cache keys (handles, entry_handles, join_handles); the regression test failed because the atomic U32 annotation disappeared.

Review: no production blocker found. The regression test proves the float/U32 annotations coexist. It exercises the fixture’s actual cache path; the three cache-key edits are otherwise not independently isolated by separate fixtures.

Not tested: physical GPU, retail title/game behavior, release build. AI disclosure: Codex (gpt-6-luna).

**@⁠oni-swr** on GitHub · 2026-11-25 19:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7172642381) Independent WARP/CPU verification for head 235c48c6827171084ec7215de92f974c9f1a7c5b against origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca. State check: open, non-draft, clean merge-tree; no oni-swr comment found. Environment: Windows x64, Rust 1.98.1 (48a229cea 2026-09-01), Windows SDK dxil.dll 10.0.26100.0 (file version 1.8.2502.11); WARP/D3D12 WARP env vars set; CARGO_TARGET_DIR=D:\victory-warp-2720-target. Commands/results: - Baseline: cargo test --locked -p victory-shader --lib — 267 passed, 3 failed, 3 ignored; cargo clippy --locked -p victory-shader --all-targets -- -D warnings — pass. - PR: cargo test --locked -p victory-shader emit::lower::tests::an_image_read_as_float_and_by_an_atomic_is_annotated_twice — 1 passed; cargo test --locked -p victory-shader --lib — 268 passed, 3 failed, 3 ignored; strict Clippy — pass. - The same three pre-existing WARP failures occur on baseline and PR: a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out. - Negative control: reverted the properties from all three cache keys (handles, entry_handles, join_handles); the regression test failed because the atomic U32 annotation disappeared. Review: no production blocker found. The regression test proves the float/U32 annotations coexist. It exercises the fixture’s actual cache path; the three cache-key edits are otherwise not independently isolated by separate fixtures. Not tested: physical GPU, retail title/game behavior, release build. AI disclosure: Codex (gpt-6-luna).
Author
Owner

@⁠Kajanos on GitHub · 2026-11-25 20:43 UTC · original

NVIDIA + vkd3d-proton unit-test run, head 235c48c682 merged onto main 13f91caee2.

Setup: Linux (Gentoo) / wine-proton 11.0.3 / vkd3d-proton 3.1, RTX 5080, NVIDIA 620.73.04; cross-built with cargo-xwin, rustc 1.98.1, dxil.dll from DXC v1.9.2609.

  • cargo xwin test -p victory-shader: 268 passed, 3 failed, 3 ignored. main gives 267 passed with the same 3 failures, so the new test passes and nothing else changed.
  • The 3 failures also fail on main in this environment, so they come from vkd3d-proton/Wine and not from this PR:
    • emit::tests::stub_pipeline_is_created (a zero digest is accepted)
    • semantics_tests::rounding_matches_the_hardware (v_fract_f32 on negative denormals)
    • stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros (dispatch fails with "Invalid parameter")

Not run: the retail title. The #144 world-load crash itself is not reproduced or verified here.

AI-assisted (Claude Code)

**@⁠Kajanos** on GitHub · 2026-11-25 20:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7174097916) **NVIDIA + vkd3d-proton unit-test run**, head `235c48c682` merged onto `main` `13f91caee2`. Setup: Linux (Gentoo) / wine-proton 11.0.3 / vkd3d-proton 3.1, RTX 5080, NVIDIA 620.73.04; cross-built with cargo-xwin, rustc 1.98.1, `dxil.dll` from DXC v1.9.2609. - `cargo xwin test -p victory-shader`: 268 passed, 3 failed, 3 ignored. `main` gives 267 passed with the same 3 failures, so the new test passes and nothing else changed. - The 3 failures also fail on `main` in this environment, so they come from vkd3d-proton/Wine and not from this PR: - `emit::tests::stub_pipeline_is_created` (a zero digest is accepted) - `semantics_tests::rounding_matches_the_hardware` (`v_fract_f32` on negative denormals) - `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` (dispatch fails with "Invalid parameter") Not run: the retail title. The #144 world-load crash itself is not reproduced or verified here. AI-assisted (Claude Code)
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-25 22:35 UTC · original

Tested on an RTX 5090 (driver 620.73.04) under Linux: Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14) and vkd3d-proton master ec207194, DXVK dxgi, diagnostics build.

Base: main at 13f91ca with this PR, #1129 (pipeline worker stack), the one-line #747 heap change, and a constant-table fix equivalent to #2143.

  • With this PR: three runs of 6–7 minutes each, no device loss and no crash. All three reach gameplay (frames 1497, 1659 and 1734): two on vkd3d-proton 3.1-83, one on master. Lit windows and lines show on screen.
  • Without it: with only my earlier single-cache fix from #177, on main 940d32f with the same other fixes, the run hits an NVIDIA MMU fault (Xid 13) at world entry, at frame 1349. The two bases differ by 83 main commits besides this PR, so that comparison isn't fully isolated.
  • Pipeline creation: with this PR, vkCreateComputePipelines no longer crashes on 76c35de1c2444e67 (CS_Primary_EstimateProbeShadingChange), on either vkd3d-proton.

AI-assisted (Claude); measured on my machine, no game data shared.

**@⁠neonbyte1** on GitHub · 2026-11-25 22:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7176556635) Tested on an RTX 5090 (driver 620.73.04) under Linux: Wine 11.22, vkd3d-proton 3.1-83 (GE-Proton11-14) and vkd3d-proton master `ec207194`, DXVK `dxgi`, diagnostics build. Base: `main` at `13f91ca` with this PR, #1129 (pipeline worker stack), the one-line #747 heap change, and a constant-table fix equivalent to #2143. - **With this PR:** three runs of 6–7 minutes each, no device loss and no crash. All three reach gameplay (frames 1497, 1659 and 1734): two on vkd3d-proton 3.1-83, one on master. Lit windows and lines show on screen. - **Without it:** with only my earlier single-cache fix from #177, on `main` `940d32f` with the same other fixes, the run hits an NVIDIA MMU fault (Xid 13) at world entry, at frame 1349. The two bases differ by 83 `main` commits besides this PR, so that comparison isn't fully isolated. - **Pipeline creation:** with this PR, `vkCreateComputePipelines` no longer crashes on `76c35de1c2444e67` (`CS_Primary_EstimateProbeShadingChange`), on either vkd3d-proton. _AI-assisted (Claude); measured on my machine, no game data shared._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:19 UTC · original · edited 2026-11-26 04:24 UTC

Automated triage for the maintainers.

Merge candidate. Now merges cleanly. The element type (props.1) joins the keys of all three handle caches in emit/lower.rs (handles, entry_handles, join_handles), so a UAV read as float and used by an atomic gets its own integer-typed annotation, matching D3D12's rule that atomics need integer UAVs; raw, structured, CBV and sampler handles have props.1 == 0 and are unchanged, consistent with 731 of 749 programs coming out byte-identical. The test covers only entry_handles; the handles/join_handles cases offered on your fork would be worth folding in. This supersedes #177.

CI: not run yet on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7177419281) · edited 2026-11-26 04:24 UTC <!-- victory-triage v1 head=38f3697801be71060ed2dd1fa65f37c56386e779 verdict=merge-candidate at=2026-11-26T04:23:55Z --> Automated triage for the maintainers. **Merge candidate.** Now merges cleanly. The element type (`props.1`) joins the keys of all three handle caches in `emit/lower.rs` (`handles`, `entry_handles`, `join_handles`), so a UAV read as float and used by an atomic gets its own integer-typed annotation, matching D3D12's rule that atomics need integer UAVs; raw, structured, CBV and sampler handles have `props.1 == 0` and are unchanged, consistent with 731 of 749 programs coming out byte-identical. The test covers only `entry_handles`; the `handles`/`join_handles` cases offered on your fork would be worth folding in. This supersedes #177. CI: not run yet on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Anzymanz on GitHub · 2026-11-26 00:40 UTC · original

From a tester working with Claude (AI-assisted, Claude Code). Two things: a crash this fixes on AMD/Linux that isn't in the description yet, and a rebase onto main.

Crash. Under vkd3d-proton (GE's 3.2 and master 71cae09) on an RX 9070 XT, the title ends with terminate called without an active exception about 90 s into the world. A colleague traced it to dxil-spirv: fixup_load_type_typed (opcode 66, TextureLoad) sees an image it has marked 64-bit, because of an atomicBinOp.i64 on the same handle, loaded as float, and cast<IntegerType> aborts the whole process. In the dumped DXIL, one handle annotated RWTexture2D<4xF32> (props 0x1002, 0x409) takes both the textureLoad.f32 and the 64-bit image atomic. That's this PR's bug: the atomic's 0x105 handle collapses into the load's.

Whole-corpus check (all 25,889 distinct containers of the title's shader archive, translated offline through translate_with, main + this change against main):

  • translated / refused: 25,669 / 220 on both sides, so nothing new refused;
  • 1,025 programs' output changes, 679 of them with 64-bit typed atomics;
  • every changed program's DXIL through native dxil-spirv (master): before, 2 fail with exactly that error (b6df66af105d8b2d, edc43d3e658a4b9d, both compute, the dump's shape; master with a local guard reports Typed load of a 64-bit resource into a non-integer type is not supported where 3.2 aborts); after, all 1,025 convert.

Rebase. The conflict with main is only test-side: Lowered's #[cfg(test)] fields and the test module, where main added uses_lane_index, has_half_wave_mask and ds_bpermute_wave64_preserves_32_lane_half next to this PR's additions. Keeping both sides resolves it. I have it as one commit on main 63bcca4: https://github.com/Anzymanz/VIctory/tree/handle-key-2723-on-main (8281e38). Its diff is line for line yours. cargo check is clean and an_image_read_as_float_and_by_an_atomic_is_annotated_twice passes. @⁠andyeox-systemd, feel free to take it as is or redo it yourself.

No game data: hashes, counts and error text only.

**@⁠Anzymanz** on GitHub · 2026-11-26 00:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7178991312) From a tester working with Claude (AI-assisted, Claude Code). Two things: a crash this fixes on AMD/Linux that isn't in the description yet, and a rebase onto main. **Crash.** Under vkd3d-proton (GE's 3.2 and master `71cae09`) on an RX 9070 XT, the title ends with `terminate called without an active exception` about 90 s into the world. A colleague traced it to dxil-spirv: `fixup_load_type_typed` (opcode 66, TextureLoad) sees an image it has marked 64-bit, because of an `atomicBinOp.i64` on the same handle, loaded as float, and `cast<IntegerType>` aborts the whole process. In the dumped DXIL, one handle annotated `RWTexture2D<4xF32>` (props `0x1002`, `0x409`) takes both the `textureLoad.f32` and the 64-bit image atomic. That's this PR's bug: the atomic's `0x105` handle collapses into the load's. **Whole-corpus check** (all 25,889 distinct containers of the title's shader archive, translated offline through `translate_with`, main + this change against main): - translated / refused: 25,669 / 220 on both sides, so nothing new refused; - 1,025 programs' output changes, 679 of them with 64-bit typed atomics; - every changed program's DXIL through native dxil-spirv (master): before, 2 fail with exactly that error (`b6df66af105d8b2d`, `edc43d3e658a4b9d`, both compute, the dump's shape; master with a local guard reports `Typed load of a 64-bit resource into a non-integer type is not supported` where 3.2 aborts); after, all 1,025 convert. **Rebase.** The conflict with main is only test-side: `Lowered`'s `#[cfg(test)]` fields and the test module, where main added `uses_lane_index`, `has_half_wave_mask` and `ds_bpermute_wave64_preserves_32_lane_half` next to this PR's additions. Keeping both sides resolves it. I have it as one commit on main `63bcca4`: https://github.com/Anzymanz/VIctory/tree/handle-key-2723-on-main (`8281e38`). Its diff is line for line yours. `cargo check` is clean and `an_image_read_as_float_and_by_an_atomic_is_annotated_twice` passes. @⁠andyeox-systemd, feel free to take it as is or redo it yourself. No game data: hashes, counts and error text only.
Author
Owner

@⁠necrobytes on GitHub · 2026-11-26 01:28 UTC · original

I sent the two requested regression tests directly to this branch in andyeox-systemd/VIctory#1. All 30 shader-lowering tests passed on this PR head. Removing the element type from either cache key made just its corresponding test fail.

I tested the cache-key change on an RX 9060 XT with RADV 26.2.7 and vkd3d-proton 3.2.0. I compared 63bcca43 with the same revision plus the production changes from 235c48c6. One input came from the compiler abort discussed above. The other corresponds to the Strix Halo report on #714. Each isolated test used one compute shader, one worker and a fresh driver cache. I checked that the baseline DXIL matched the bytes cached by the failing game runs.

D3D12 compute pipelines created Stock Proton Experimental wineserver Same client, view-lookup-patched wineserver
Main, two affected inputs 0/2 0/2
Main + this PR, same inputs 2/2 2/2
Main + this PR, two controls 2/2 2/2

Main exited with code 3 in all four affected cases. Microsoft’s DXIL validator accepted both affected shaders before and after the change. The difference showed up during D3D12 pipeline creation.

I also ran the game with #1722 and this change together. It created the second affected pipeline and presented another 35 frames. The run completed the planned 110 seconds after the world marker and reached the opening credits. The first affected pipeline was exercised only in the isolated test.

AI-assisted with Codex.

**@⁠necrobytes** on GitHub · 2026-11-26 01:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7179804197) I sent the two requested regression tests directly to this branch in [andyeox-systemd/VIctory#1](https://github.com/andyeox-systemd/VIctory/pull/1). All 30 shader-lowering tests passed on this PR head. Removing the element type from either cache key made just its corresponding test fail. I tested the cache-key change on an RX 9060 XT with RADV 26.2.7 and vkd3d-proton 3.2.0. I compared `63bcca43` with the same revision plus the production changes from `235c48c6`. One input came from the compiler abort discussed above. The other corresponds to [the Strix Halo report on #714](https://git.gtahub.st/github/Marvisak--VIctory/issues/714). Each isolated test used one compute shader, one worker and a fresh driver cache. I checked that the baseline DXIL matched the bytes cached by the failing game runs. | D3D12 compute pipelines created | Stock Proton Experimental wineserver | Same client, view-lookup-patched wineserver | |---|---:|---:| | Main, two affected inputs | 0/2 | 0/2 | | Main + this PR, same inputs | 2/2 | 2/2 | | Main + this PR, two controls | 2/2 | 2/2 | Main exited with code 3 in all four affected cases. Microsoft’s DXIL validator accepted both affected shaders before and after the change. The difference showed up during D3D12 pipeline creation. I also ran the game with #1722 and this change together. It created the second affected pipeline and presented another 35 frames. The run completed the planned 110 seconds after the world marker and reached the opening credits. The first affected pipeline was exercised only in the isolated test. AI-assisted with Codex.
Author
Owner

@⁠ntgata1-dotcom on GitHub · 2026-11-26 05:19 UTC · original

This head fails the asset-policy check. cargo xtask policy on 38f3697:

POLICY: crates/victory-shader/src/emit/lower.rs: 524570 bytes exceeds the 524288-byte limit

main's copy is 520,563 bytes, so this PR's additions take it 282 bytes over. CI hasn't run on this PR yet, which is probably why it hasn't shown. cargo test runs the same check (repository_passes_policy).

Moving an_image_read_as_float_and_by_an_atomic_is_annotated_twice and its mimg_2d helper into a test module of their own under emit/ (as the *_tests.rs modules there are) brings the file back under, with room for necrobytes' tests from andyeox-systemd/VIctory#1. #2977 also grows lower.rs: with both, it comes to 527,667 bytes.

AI-assisted (Claude Code); checked on my machine.

**@⁠ntgata1-dotcom** on GitHub · 2026-11-26 05:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7183388654) **This head fails the asset-policy check.** `cargo xtask policy` on `38f3697`: ``` POLICY: crates/victory-shader/src/emit/lower.rs: 524570 bytes exceeds the 524288-byte limit ``` `main`'s copy is 520,563 bytes, so this PR's additions take it 282 bytes over. CI hasn't run on this PR yet, which is probably why it hasn't shown. `cargo test` runs the same check (`repository_passes_policy`). Moving `an_image_read_as_float_and_by_an_atomic_is_annotated_twice` and its `mimg_2d` helper into a test module of their own under `emit/` (as the `*_tests.rs` modules there are) brings the file back under, with room for necrobytes' tests from andyeox-systemd/VIctory#1. #2977 also grows `lower.rs`: with both, it comes to 527,667 bytes. AI-assisted (Claude Code); checked on my machine.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 04:26 UTC · original · reviewed

Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-shader --lib emit::lower::tests: 34 passed, 0 failed (including new an_image_read_as_float_and_by_an_atomic_is_annotated_twice).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: FAIL — adding the new test inline in lower.rs pushes it 282 bytes past the 512 KiB policy limit on current main (63bcca4):
    POLICY: crates/victory-shader/src/emit/lower.rs: 524570 bytes exceeds the 524288-byte limit
    

Moving the new test into a submodule under crates/victory-shader/src/emit/lower/ will clear the xtask policy gate cleanly.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 04:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#pullrequestreview-6068547526) · **reviewed** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-shader --lib emit::lower::tests`: **34 passed, 0 failed** (including new `an_image_read_as_float_and_by_an_atomic_is_annotated_twice`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: **FAIL** — adding the new test inline in `lower.rs` pushes it 282 bytes past the 512 KiB policy limit on current `main` (`63bcca4`): ``` POLICY: crates/victory-shader/src/emit/lower.rs: 524570 bytes exceeds the 524288-byte limit ``` Moving the new test into a submodule under `crates/victory-shader/src/emit/lower/` will clear the `xtask policy` gate cleanly. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠ClosetPie107 on GitHub · 2026-11-26 09:04 UTC · original

Tested on the retail title under Proton: this PR fixes the dxil-spirv abort from #3101, both offline and in-game.

Stack

  • AMD Radeon RX 9070 (RDNA4, gfx1201), Ryzen 5 9600X, 32 GB RAM
  • CachyOS, kernel 7.3.5, Mesa 26.3.1 (RADV)
  • Proton Experimental experimental-11.0-20261112 (Wine 11, ntsync), DXVK 3.1.1 dxgi
  • vkd3d-proton master ec207194 (3.2.0) with dxil-spirv master b540c8a2, built locally (-Db_ndebug=true)
  • Microsoft d3dcompiler_47 in the prefix (the indirect clamp still needs it on main, #170)
  • VIctory main 63bcca4, merged with this PR (38f3697), cross-built for x86_64-pc-windows-gnu; Series X files, 1.0.2.1

Offline (dxil-spirv b540c8a2 CLI, --bindless --enable-shader-demote --ssbo-uav --ssbo-srv --bindless-typed-buffer-offsets, run on every module translate --list emits)

main main + #2723
modules that abort 2: smh_draw_64 and smh_draw_128 CS_VisHair_969c6f85 (Invalid type ID in cast<T> in fixup_load_type_typed, exit 134) 0
CS_VisHair UAV handles one {4098, 1033} used by textureLoad.f32 and atomicBinOp.i64 {4098, 1033} for the load, {4098, 261} for the atomic
DXC 1.9 dxil.dll validator 24,937 validated 24,937 validated

In-game

  • translate --cache --pipelines completes: 27,135 pipelines made in 219 s, no abort (on main it dies around pipeline 1,200, as in #3101).
  • World run without any VICTORY_SKIP_PIPELINES, warm caches: CS_VisHair (b6df66af105d8b2d) gets its host pipeline and runs. The intro cutscene plays and the run reaches the prologue (prison scene), lit, with characters and hair. 25 minutes, ended by my time cap, with no crash or device removal. About 1 fps in the cutscene, a steady 2.9–3.3 fps in the prologue, about 12.7 GB of VRAM.
  • On main, the same setup ended about 10 minutes in when vkd3d-proton hit this abort (terminate called without an active exception, exit 3). With VICTORY_SKIP_PIPELINES=b6df66af105d8b2d instead, the title crashed about 8 minutes in at +0xb6fb9, reading 0xffffffffffffffff, with f16 infinities in rax. That did not happen with this PR, so it may have come from the skipped hair pass. Unconfirmed.

Still visible with this PR: blocky bands over the lower part of some shots, and 76–264 draws a frame dropped for untranslated shaders. These look unrelated.

No game files attached. AI-assisted (Claude Code).

**@⁠ClosetPie107** on GitHub · 2026-11-26 09:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#issuecomment-7187377830) Tested on the retail title under Proton: this PR fixes the dxil-spirv abort from #3101, both offline and in-game. **Stack** - AMD Radeon RX 9070 (RDNA4, gfx1201), Ryzen 5 9600X, 32 GB RAM - CachyOS, kernel 7.3.5, Mesa 26.3.1 (RADV) - Proton Experimental `experimental-11.0-20261112` (Wine 11, ntsync), DXVK 3.1.1 `dxgi` - vkd3d-proton master `ec207194` (3.2.0) with dxil-spirv master `b540c8a2`, built locally (`-Db_ndebug=true`) - Microsoft `d3dcompiler_47` in the prefix (the indirect clamp still needs it on `main`, #170) - VIctory `main` `63bcca4`, merged with this PR (`38f3697`), cross-built for `x86_64-pc-windows-gnu`; Series X files, 1.0.2.1 **Offline (dxil-spirv `b540c8a2` CLI, `--bindless --enable-shader-demote --ssbo-uav --ssbo-srv --bindless-typed-buffer-offsets`, run on every module `translate --list` emits)** | | `main` | `main` + #2723 | |---|---|---| | modules that abort | 2: `smh_draw_64` and `smh_draw_128` `CS_VisHair_969c6f85` (`Invalid type ID in cast<T>` in `fixup_load_type_typed`, exit 134) | 0 | | `CS_VisHair` UAV handles | one `{4098, 1033}` used by `textureLoad.f32` and `atomicBinOp.i64` | `{4098, 1033}` for the load, `{4098, 261}` for the atomic | | DXC 1.9 `dxil.dll` validator | 24,937 validated | 24,937 validated | **In-game** - `translate --cache --pipelines` completes: 27,135 pipelines made in 219 s, no abort (on `main` it dies around pipeline 1,200, as in #3101). - World run without any `VICTORY_SKIP_PIPELINES`, warm caches: `CS_VisHair` (`b6df66af105d8b2d`) gets its host pipeline and runs. The intro cutscene plays and the run reaches the prologue (prison scene), lit, with characters and hair. 25 minutes, ended by my time cap, with no crash or device removal. About 1 fps in the cutscene, a steady 2.9–3.3 fps in the prologue, about 12.7 GB of VRAM. - On `main`, the same setup ended about 10 minutes in when vkd3d-proton hit this abort (`terminate called without an active exception`, exit 3). With `VICTORY_SKIP_PIPELINES=b6df66af105d8b2d` instead, the title crashed about 8 minutes in at `+0xb6fb9`, reading `0xffffffffffffffff`, with f16 infinities in `rax`. That did not happen with this PR, so it may have come from the skipped hair pass. Unconfirmed. Still visible with this PR: blocky bands over the lower part of some shots, and 76–264 draws a frame dropped for untranslated shaders. These look unrelated. No game files attached. AI-assisted (Claude Code).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 12:26 UTC · original · requested changes

Keying entry_handles, handles, and join_handles on both (props.0, props.1) (crates/victory-shader/src/emit/lower.rs:220-228, 5376, 5392, 5501) matches what Shader::annotate receives and preserves non-typed raw/structured/CBV/sampler sharing (props.1 == 0).

However, crates/victory-shader/src/emit/lower.rs on 38f36978 is 524,570 bytes—282 bytes over the repository's 524,288-byte asset-policy limit—causing cargo run --locked -p xtask -- policy to fail (exit 1).

Please move mimg_2d and an_image_read_as_float_and_by_an_atomic_is_annotated_twice (emit/lower.rs:12220-12309, ~3,513 bytes) into a separate test module so lower.rs passes xtask policy cleanly. (Optional follow-up: the new regression currently hits entry_handles; adding a dynamic Source::Loaded and a uniform Source::Phi property-mismatch case would directly exercise handles and join_handles too.)

Local checks on 38f36978:

  • cargo run --locked -p xtask -- policy: failed (524570 bytes exceeds the 524288-byte limit).
  • cargo clippy -p victory-shader --all-targets -- -D warnings (default & --all-features): clean.
  • emit::lower::tests 34 passed, emit::shader::tests 1 passed; on VICTORY_WARP=1, emit::memory_tests 5 passed and emit::stride_tests 8 passed; on RTX 5090, emit::memory_tests 4 passed (skipping pre-existing Blackwell heap_direct_texture_reads_mark_their_heap_index) and emit::stride_tests 6 passed (2 pre-existing NVIDIA 1M view-heap-cap failures).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 12:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2723#pullrequestreview-6074097390) · **requested changes** Keying `entry_handles`, `handles`, and `join_handles` on both `(props.0, props.1)` (`crates/victory-shader/src/emit/lower.rs:220-228, 5376, 5392, 5501`) matches what `Shader::annotate` receives and preserves non-typed raw/structured/CBV/sampler sharing (`props.1 == 0`). However, `crates/victory-shader/src/emit/lower.rs` on `38f36978` is **524,570 bytes**—282 bytes over the repository's 524,288-byte asset-policy limit—causing `cargo run --locked -p xtask -- policy` to fail (`exit 1`). Please move `mimg_2d` and `an_image_read_as_float_and_by_an_atomic_is_annotated_twice` (`emit/lower.rs:12220-12309`, ~3,513 bytes) into a separate test module so `lower.rs` passes `xtask policy` cleanly. (Optional follow-up: the new regression currently hits `entry_handles`; adding a dynamic `Source::Loaded` and a uniform `Source::Phi` property-mismatch case would directly exercise `handles` and `join_handles` too.) Local checks on `38f36978`: - `cargo run --locked -p xtask -- policy`: failed (`524570 bytes exceeds the 524288-byte limit`). - `cargo clippy -p victory-shader --all-targets -- -D warnings` (default & `--all-features`): clean. - `emit::lower::tests` `34 passed`, `emit::shader::tests` `1 passed`; on `VICTORY_WARP=1`, `emit::memory_tests` `5 passed` and `emit::stride_tests` `8 passed`; on RTX 5090, `emit::memory_tests` `4 passed` (skipping pre-existing Blackwell `heap_direct_texture_reads_mark_their_heap_index`) and `emit::stride_tests` `6 passed` (2 pre-existing NVIDIA 1M view-heap-cap failures).
This pull request can be merged automatically.
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/2723/head:github-bot/gh-2723'
git switch 'github-bot/gh-2723'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2723'
git switch 'github-bot/gh-2723'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2723'
git switch 'github-bot/gh-2723'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2723'
git switch 'main'
git merge --squash 'github-bot/gh-2723'
git switch 'main'
git merge --ff-only 'github-bot/gh-2723'
git switch 'main'
git merge 'github-bot/gh-2723'
git push origin 'main'
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!2723
No description provided.