Shaders: key heap handles by element type (atomic on a float-read UAV) #177

Open
github-bot wants to merge 2 commits from github-bot/gh-177 into main AGit
Owner

@⁠Ortomanic on GitHub · 2026-11-24 01:08 UTC · original
Ortomanic:pr/shader-handle-element-type → main · +107 −2 · 2 files · 2 commits · open

What

handle() in emit/lower.rs cached heap handles by (block, load, first, sampler, props.0). When a program reads a texture UAV as float and uses it atomically, both annotations share props.0 (RWTexture2D), so the atomic got the cached float handle. dxil-spirv then emits OpAtomicOr %float on a float texel pointer, which is invalid SPIR-V (spirv-val: "AtomicOr: expected Result Type to be integer scalar type").

On NVIDIA (RTX 5080, driver 620.73, vkd3d-proton under Wine) the driver's compiler crashes in vkCreateComputePipelines on that SPIR-V as GTA VI enters its world (programs c12c1f7296419a5b, 8358f9eef7931421).

Change

The element type (props.1) is part of the cache key, so the atomic gets its own u32 handle as the texture-atomics note in emit/mod.rs intends.

Testing

  • cargo test -p victory-shader: 56 passed.
  • Dumped every SPIR-V vkd3d-proton produced in a world run (VKD3D_SHADER_DUMP_PATH) and ran spirv-val --target-env vulkan1.3: 2 invalid before, 0 after.
  • World runs on RTX 5080 / Wine 11.22: the vkCreateComputePipelines driver crash no longer occurs (it reproduced in 3 of 3 runs before).
**@⁠Ortomanic** on GitHub · 2026-11-24 01:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/177) `Ortomanic:pr/shader-handle-element-type` → `main` · +107 −2 · 2 files · 2 commits · open ## What `handle()` in `emit/lower.rs` cached heap handles by `(block, load, first, sampler, props.0)`. When a program reads a texture UAV as float **and** uses it atomically, both annotations share `props.0` (RWTexture2D), so the atomic got the cached float handle. dxil-spirv then emits `OpAtomicOr %float` on a float texel pointer, which is invalid SPIR-V (`spirv-val`: "AtomicOr: expected Result Type to be integer scalar type"). On NVIDIA (RTX 5080, driver 620.73, vkd3d-proton under Wine) the driver's compiler crashes in `vkCreateComputePipelines` on that SPIR-V as GTA VI enters its world (programs `c12c1f7296419a5b`, `8358f9eef7931421`). ## Change The element type (`props.1`) is part of the cache key, so the atomic gets its own `u32` handle as the texture-atomics note in `emit/mod.rs` intends. ## Testing - `cargo test -p victory-shader`: 56 passed. - Dumped every SPIR-V vkd3d-proton produced in a world run (`VKD3D_SHADER_DUMP_PATH`) and ran `spirv-val --target-env vulkan1.3`: 2 invalid before, 0 after. - World runs on RTX 5080 / Wine 11.22: the `vkCreateComputePipelines` driver crash no longer occurs (it reproduced in 3 of 3 runs before).
A texture UAV read as float and used atomically in the same program got
the float handle for its atomic: dxil-spirv then emitted OpAtomicOr on a
float texel pointer (invalid SPIR-V), and the NVIDIA compiler crashed in
vkCreateComputePipelines when GTA VI entered its world (two programs:
c12c1f7296419a5b, 8358f9eef7931421). With the type in the key the atomic
gets its own uint handle; all dumped SPIR-V validates.
A synthetic compute program loads a 2D image UAV as four floats and then
runs image_atomic_umin on it in the same block. The atomic must get its
own one-U32 annotation next to the load's four-float one. Test builds
record each annotation's property words so the test can read them.

Fails on the handle cache keyed on the first property word only; passes
with the element type in the key.

(cherry picked from commit 6e01ea0315)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:30 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:19 UTC · original

Tested e55eb69 on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test -p victory-shader: 56 passed, 0 failed (2 test binaries).
  • The diff adds no test for the heap-handle element-type key; this run only shows nothing else broke.
  • The full workspace still needs #112 for the victory-gpu E0425.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7118989332) Tested `e55eb69` on **Arch Linux x86_64, rustc 1.98.1**: **pass**. - `cargo test -p victory-shader`: **56 passed, 0 failed** (2 test binaries). - The diff adds no test for the heap-handle element-type key; this run only shows nothing else broke. - The full workspace still needs #112 for the `victory-gpu` E0425. No game data used.
Author
Owner

@⁠gingertonik on GitHub · 2026-11-24 01:37 UTC · original

Independent confirmation on an RTX 4080 (Linux, vkd3d-proton), a whole-package check, and a test

I hit the same crash on a second NVIDIA card and traced it to the same cache key independently, so here is what I can add.

Environment: Arch-based Linux, kernel 7.3; Core i5-13600K; GeForce RTX 4080 16 GB, driver 620.73.04; GE-Proton11-12's Wine with vkd3d-proton 2576c0b4a (from Proton Experimental 11.0-20261112) in the prefix; Series X 1.0.2.1; release build cross-compiled on Linux.

In the game (one run each):

  • 9aef3d9, unchanged: err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call at world entry, exit code 3. Of 211 SPIR-V modules vkd3d-proton dumped, 2 fail spirv-val, both an atomic with a %float result type, and one of them is the last compute module dumped before the crash.
  • 9aef3d9 with the same key change applied locally: no trap, 577 shaders translated, and the run reaches the opening cutscene. It stops later on a separate GPU fault (kernel Xid 13 ... MMU Fault), which looks like the world hang in #71 and not like this bug.

Across the whole package (no GPU involved): victory translate --list with VICTORY_EMIT_DUMP, then every emitted DXIL converted with dxil-spirv 114e664e (the commit vkd3d-proton 2576c0b4a carries) and checked with spirv-val --target-env vulkan1.3 --scalar-block-layout.

Build DXIL emitted Invalid SPIR-V
main d2a4bae 22,151 39
this PR e55eb69 22,151 0

The 39 are 26 pixel and 13 compute programs: 22 AtomicUMin, 11 AtomicOr, 3 AtomicUMax, 3 AtomicIAdd, all "expected Result Type to be integer scalar type". This PR changes the emitted DXIL of exactly those 39 programs and of no other. So the bug reaches well past the two programs seen in a world run, and the fix covers all of them.

One caveat: the dxil-spirv command line (--ssbo-uav --ssbo-srv --bindless) is not the exact option set vkd3d-proton uses in the game. It did reproduce the two in-game failures exactly.

This looks like the remaining 0xc0000005 crash in #144; I have put the numbers there too.

A test. DaviTostes noted the diff has none. I wrote one in the style of the existing synthetic programs: a compute program that loads a 2D image UAV and then runs image_atomic_umin on it in the same block, asserting that the image is annotated once as four floats and once as one u32. On d2a4bae it fails with the atomic's annotation: [(d, ffffffff), (1002, 409)]; on e55eb69 it passes. It is one commit on top of this PR's head: #226. Take it into this PR or separately, whichever is easier.

No game data is attached; the dumps stay on my disk.

AI-assisted (Hermes).

**@⁠gingertonik** on GitHub · 2026-11-24 01:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7119282844) **Independent confirmation on an RTX 4080 (Linux, vkd3d-proton), a whole-package check, and a test** I hit the same crash on a second NVIDIA card and traced it to the same cache key independently, so here is what I can add. **Environment:** Arch-based Linux, kernel 7.3; Core i5-13600K; GeForce RTX 4080 16 GB, driver 620.73.04; GE-Proton11-12's Wine with vkd3d-proton `2576c0b4a` (from Proton Experimental 11.0-20261112) in the prefix; Series X 1.0.2.1; release build cross-compiled on Linux. **In the game** (one run each): - `9aef3d9`, unchanged: `err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call` at world entry, exit code 3. Of 211 SPIR-V modules vkd3d-proton dumped, 2 fail `spirv-val`, both an atomic with a `%float` result type, and one of them is the last compute module dumped before the crash. - `9aef3d9` with the same key change applied locally: no trap, 577 shaders translated, and the run reaches the opening cutscene. It stops later on a separate GPU fault (kernel `Xid 13 ... MMU Fault`), which looks like the world hang in #71 and not like this bug. **Across the whole package** (no GPU involved): `victory translate --list` with `VICTORY_EMIT_DUMP`, then every emitted DXIL converted with dxil-spirv `114e664e` (the commit vkd3d-proton `2576c0b4a` carries) and checked with `spirv-val --target-env vulkan1.3 --scalar-block-layout`. | Build | DXIL emitted | Invalid SPIR-V | |---|---|---| | main `d2a4bae` | 22,151 | 39 | | this PR `e55eb69` | 22,151 | 0 | The 39 are 26 pixel and 13 compute programs: 22 `AtomicUMin`, 11 `AtomicOr`, 3 `AtomicUMax`, 3 `AtomicIAdd`, all "expected Result Type to be integer scalar type". This PR changes the emitted DXIL of exactly those 39 programs and of no other. So the bug reaches well past the two programs seen in a world run, and the fix covers all of them. One caveat: the dxil-spirv command line (`--ssbo-uav --ssbo-srv --bindless`) is not the exact option set vkd3d-proton uses in the game. It did reproduce the two in-game failures exactly. This looks like the remaining `0xc0000005` crash in #144; I have put the numbers there too. **A test.** DaviTostes noted the diff has none. I wrote one in the style of the existing synthetic programs: a compute program that loads a 2D image UAV and then runs `image_atomic_umin` on it in the same block, asserting that the image is annotated once as four floats and once as one `u32`. On `d2a4bae` it fails with `the atomic's annotation: [(d, ffffffff), (1002, 409)]`; on `e55eb69` it passes. It is one commit on top of this PR's head: #226. Take it into this PR or separately, whichever is easier. No game data is attached; the dumps stay on my disk. AI-assisted (Hermes).
Author
Owner

@⁠tanishq-dubey on GitHub · 2026-11-24 01:45 UTC · original

Independent reproduction on RTX 5090 / NVIDIA 620.70.06, Wine 11.22 and vkd3d-proton 3.2.0: before an equivalent local cache-key fix, the captured c12c1f7296419a5b SPIR-V failed spirv-val --target-env vulkan1.3 with OpAtomicOr %float and an isolated D3D12 pipeline probe exited with Wine reporting vkCreateComputePipelines / 0xc0000005.

After keying by both resource-property words, the corresponding generated SPIR-V passed spirv-val and the title successfully created that host pipeline. A synthetic same-descriptor regression also fails before the fix (float annotation returned for an integer atomic) and passes after. The title later hit a separate null-write termination during world rendering; that run used one pipeline worker and shader dumps, so it is not a normal-performance comparison. No game files attached. AI-assisted.

**@⁠tanishq-dubey** on GitHub · 2026-11-24 01:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7119425205) Independent reproduction on RTX 5090 / NVIDIA 620.70.06, Wine 11.22 and vkd3d-proton 3.2.0: before an equivalent local cache-key fix, the captured `c12c1f7296419a5b` SPIR-V failed `spirv-val --target-env vulkan1.3` with `OpAtomicOr %float` and an isolated D3D12 pipeline probe exited with Wine reporting `vkCreateComputePipelines` / `0xc0000005`. After keying by both resource-property words, the corresponding generated SPIR-V passed `spirv-val` and the title successfully created that host pipeline. A synthetic same-descriptor regression also fails before the fix (float annotation returned for an integer atomic) and passes after. The title later hit a separate null-write termination during world rendering; that run used one pipeline worker and shader dumps, so it is not a normal-performance comparison. No game files attached. AI-assisted.
Author
Owner

@⁠ItsYusei99 on GitHub · 2026-11-24 02:03 UTC · original

Tested on a third card: RTX 4070, driver 620.70.06 (nvidia-open), Wine 11.22, vkd3d-proton 3.2.0 (Proton Experimental 11.0-20261112), Ryzen 7 9800X3D. Build: main 9aef3d9 with this PR applied as a diff, Series X mode.

  • Before: every world load died in the driver with vkCreateComputePipelines Exception 0xc0000005 in Unix call (5d113aa6830760b6, with one pipeline worker). Skipping hashes with VICTORY_SKIP_PIPELINES only moved the crash to vkCreateGraphicsPipelines (5ad3a82b1c3cc63a, then 15c34c906ac8b908). That matches the 26 pixel programs in the analysis on #144.
  • After: with no skip list, the load translated 706 shaders with no driver exception. The opening cutscene ran for about 3 minutes, then the title entered the first mission (~600 draws/frame, mission audio playing).
  • It then stopped on a GPU fault, the same one reported on the RTX 4080: NVRM: Xid 13 ... Graphics SM Warp Exception ... MMU Fault (class c9c0). The screen stays on the last frame, audio continues, and VIctory logs nothing after it. That is a separate problem from this PR.

So this fixes the driver crash for me too. Related: #144.

**@⁠ItsYusei99** on GitHub · 2026-11-24 02:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7119715153) Tested on a third card: **RTX 4070**, driver 620.70.06 (nvidia-open), Wine 11.22, vkd3d-proton 3.2.0 (Proton Experimental 11.0-20261112), Ryzen 7 9800X3D. Build: `main` 9aef3d9 with this PR applied as a diff, Series X mode. - **Before:** every world load died in the driver with `vkCreateComputePipelines Exception 0xc0000005 in Unix call` (`5d113aa6830760b6`, with one pipeline worker). Skipping hashes with `VICTORY_SKIP_PIPELINES` only moved the crash to `vkCreateGraphicsPipelines` (`5ad3a82b1c3cc63a`, then `15c34c906ac8b908`). That matches the 26 pixel programs in the analysis on #144. - **After:** with no skip list, the load translated 706 shaders with no driver exception. The opening cutscene ran for about 3 minutes, then the title entered the first mission (~600 draws/frame, mission audio playing). - It then stopped on a GPU fault, the same one reported on the RTX 4080: `NVRM: Xid 13 ... Graphics SM Warp Exception ... MMU Fault` (class c9c0). The screen stays on the last frame, audio continues, and VIctory logs nothing after it. That is a separate problem from this PR. So this fixes the driver crash for me too. Related: #144.
Author
Owner

@⁠Ortomanic on GitHub · 2026-11-24 02:06 UTC · original

Thanks all for the independent reproductions on the RTX 4070/4080/5090 and for the package-wide numbers. I've added @⁠gingertonik's regression test from #226 to this PR (cherry-picked with attribution as ce945d6). cargo test -p victory-shader: 57 passed. Note that #48 contains the same key change, so whichever lands first, the other can drop it.

**@⁠Ortomanic** on GitHub · 2026-11-24 02:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7119768963) Thanks all for the independent reproductions on the RTX 4070/4080/5090 and for the package-wide numbers. I've added @⁠gingertonik's regression test from #226 to this PR (cherry-picked with attribution as ce945d6). `cargo test -p victory-shader`: 57 passed. Note that #48 contains the same key change, so whichever lands first, the other can drop it.
Author
Owner

@⁠spidercraft on GitHub · 2026-11-24 04:35 UTC · original

Confirmed on a native Linux build (no Wine; vkd3d-proton, RTX 5090, NVIDIA 620.73): with this change victory translate --pipelines over the title's shader archive completes; without it the driver's compiler crashed on the float OpAtomicUMax. #526 includes this PR's commits as they are.

**@⁠spidercraft** on GitHub · 2026-11-24 04:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7122158346) Confirmed on a native Linux build (no Wine; vkd3d-proton, RTX 5090, NVIDIA 620.73): with this change `victory translate --pipelines` over the title's shader archive completes; without it the driver's compiler crashed on the float `OpAtomicUMax`. #526 includes this PR's commits as they are.
Author
Owner

@⁠x3ero0 on GitHub · 2026-11-24 08:03 UTC · original

Tested this on Linux (offline, not in the game) at ce945d6b3513, cherry-picked onto main at d2a4bae.

Why it matters on Linux: under Wine/Proton the emitted DXIL goes through vkd3d-proton's dxil-spirv. On main, an atomic on an image that is also read as float comes out as an OpAtomic* with a float result type, which SPIR-V validation rejects.

Method: victory translate shaders.rpf --list with VICTORY_EMIT_DUMP, then every dumped container through standalone dxil-spirv --bindless --validate (upstream 53aac41, 2026-11-23).

main this PR
Shaders emitted 22,139 22,139
Valid SPIR-V 22,100 22,139
Invalid SPIR-V 39 0

The 39 failures on main were all Atomic{UMin,Or,UMax,IAdd}: expected Result Type to be integer scalar type (22, 11, 3 and 3).

Side effects: exactly 39 emitted shaders differ from main, the same 39 that were failing; the other 22,100 are byte-identical. The translator's refusal tallies are unchanged. The new unit test passes under Wine.

Not covered: no in-game run (these shaders are not reached before a separate loading crash on my setup), and no check with Microsoft's validator or a Windows D3D12 driver.

**@⁠x3ero0** on GitHub · 2026-11-24 08:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7125683351) Tested this on Linux (offline, not in the game) at `ce945d6b3513`, cherry-picked onto `main` at `d2a4bae`. **Why it matters on Linux:** under Wine/Proton the emitted DXIL goes through vkd3d-proton's `dxil-spirv`. On `main`, an atomic on an image that is also read as float comes out as an `OpAtomic*` with a float result type, which SPIR-V validation rejects. **Method:** `victory translate shaders.rpf --list` with `VICTORY_EMIT_DUMP`, then every dumped container through standalone `dxil-spirv --bindless --validate` (upstream `53aac41`, 2026-11-23). | | `main` | this PR | |---|---|---| | Shaders emitted | 22,139 | 22,139 | | Valid SPIR-V | 22,100 | 22,139 | | Invalid SPIR-V | 39 | 0 | The 39 failures on `main` were all `Atomic{UMin,Or,UMax,IAdd}: expected Result Type to be integer scalar type` (22, 11, 3 and 3). **Side effects:** exactly 39 emitted shaders differ from `main`, the same 39 that were failing; the other 22,100 are byte-identical. The translator's refusal tallies are unchanged. The new unit test passes under Wine. **Not covered:** no in-game run (these shaders are not reached before a separate loading crash on my setup), and no check with Microsoft's validator or a Windows D3D12 driver.
Author
Owner

@⁠MrCloudy2 on GitHub · 2026-11-24 10:14 UTC · original

Confirmed on another NVIDIA card. This also fixes the vkCreateComputePipelines driver crash from #144 for program a3d1a26ad0c8c2cd (one of the two #144 names), and the crash reproduces outside the title.

Setup: RTX 3060 12 GB, driver 620.73.04, CachyOS (kernel 7.3), Proton-CachyOS 11.0 wine with vkd3d-proton 3.2.0 (from Proton Experimental), diag build cross-compiled with xwin, own 1.0.2.1 copy.

Standalone repro, no game run needed: that one container alone in a folder, victory translate <folder> --pipelines --jobs 1 under the same Wine.

  • main 8e79c80 (+ #151 #190 #454 #493 #579): err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call, every time. spirv-val --target-env vulkan1.3 on vkd3d-proton's dump (VKD3D_SHADER_DUMP_PATH) says AtomicUMin: expected Result Type to be integer scalar type. This is the umin variant of the OpAtomicOr %float described here.
  • With this PR's key change (props.1 in the handle cache key; applied by hand, since the PR conflicts with main right now): 1 compute pipeline created, and the dumped SPIR-V passes spirv-val.
  • 690e2883f9dd25d8 and 8bb272e763f76148, the other programs #144 names, build fine here on vkd3d-proton 3.2.0 with or without this change.

In the title: world runs on this card died in the driver at the first world load without it, and get past that point with it.

AI-assisted (Claude Code); run and measured on the machine above.

**@⁠MrCloudy2** on GitHub · 2026-11-24 10:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7128503275) Confirmed on another NVIDIA card. This also fixes the `vkCreateComputePipelines` driver crash from #144 for program **`a3d1a26ad0c8c2cd`** (one of the two #144 names), and the crash reproduces outside the title. **Setup:** RTX 3060 12 GB, driver 620.73.04, CachyOS (kernel 7.3), Proton-CachyOS 11.0 wine with vkd3d-proton 3.2.0 (from Proton Experimental), diag build cross-compiled with xwin, own 1.0.2.1 copy. **Standalone repro**, no game run needed: that one container alone in a folder, `victory translate <folder> --pipelines --jobs 1` under the same Wine. * `main` `8e79c80` (+ #151 #190 #454 #493 #579): `err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call`, every time. `spirv-val --target-env vulkan1.3` on vkd3d-proton's dump (`VKD3D_SHADER_DUMP_PATH`) says `AtomicUMin: expected Result Type to be integer scalar type`. This is the umin variant of the `OpAtomicOr %float` described here. * With this PR's key change (`props.1` in the handle cache key; applied by hand, since the PR conflicts with `main` right now): 1 compute pipeline created, and the dumped SPIR-V passes `spirv-val`. * `690e2883f9dd25d8` and `8bb272e763f76148`, the other programs #144 names, build fine here on vkd3d-proton 3.2.0 with or without this change. **In the title:** world runs on this card died in the driver at the first world load without it, and get past that point with it. AI-assisted (Claude Code); run and measured on the machine above.
Author
Owner

@⁠pablogonz12 on GitHub · 2026-11-24 10:57 UTC · original

Tested the fix on current main (ffe310e). It still matters there, but the branch no longer merges cleanly (conflict in emit/lower.rs, base is d2a4bae). The core of it, props.1 in the handles key (2 lines), applies by hand.

Setup: RX 9070 XT, RADV (Mesa 26.3.1), CachyOS, GE-Proton11-14, vkd3d-proton master (30b0eb9, dxil-spirv 34f0ff8).

What I ran: I dumped every console shader container the title translated in a run from boot into the world (751 programs: 373 compute, 139 pixel, 81 mesh, 77 vertex) and re-translated them offline with victory_shader::emit::translate. Each DXIL went through dxil-spirv 34f0ff8 and spirv-val --target-env vulkan1.3.

pixel programs translated invalid SPIR-V
main ffe310e 135 5 (OpAtomicUMin / OpAtomicOr with a float result)
main + the 2-line core of this PR 135 0

Nothing else changed: same translated count, and the other stages are unaffected. On main those 5 are the world's pixel programs whose image atomic gets the cached float handle.

deadkid14's note still applies to the test (options field), so this probably needs a rebase onto main rather than a merge.

**@⁠pablogonz12** on GitHub · 2026-11-24 10:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7129458373) Tested the fix on current `main` (`ffe310e`). It still matters there, but the branch no longer merges cleanly (conflict in `emit/lower.rs`, base is `d2a4bae`). The core of it, `props.1` in the `handles` key (2 lines), applies by hand. **Setup:** RX 9070 XT, RADV (Mesa 26.3.1), CachyOS, GE-Proton11-14, vkd3d-proton master (`30b0eb9`, dxil-spirv `34f0ff8`). **What I ran:** I dumped every console shader container the title translated in a run from boot into the world (751 programs: 373 compute, 139 pixel, 81 mesh, 77 vertex) and re-translated them offline with `victory_shader::emit::translate`. Each DXIL went through dxil-spirv `34f0ff8` and `spirv-val --target-env vulkan1.3`. | | pixel programs translated | invalid SPIR-V | |---|---|---| | `main` `ffe310e` | 135 | 5 (`OpAtomicUMin` / `OpAtomicOr` with a float result) | | `main` + the 2-line core of this PR | 135 | **0** | Nothing else changed: same translated count, and the other stages are unaffected. On `main` those 5 are the world's pixel programs whose image atomic gets the cached float handle. `deadkid14`'s note still applies to the test (`options` field), so this probably needs a rebase onto `main` rather than a merge.
Author
Owner

@⁠Ortomanic on GitHub · 2026-11-24 11:07 UTC · original

Rebased onto current main (ffe310e), so it merges cleanly again. Thanks @⁠pablogonz12 for flagging the conflict and @⁠deadkid14 for the test fix. The new test now builds against #189's Parts and the 4-argument resource::track from #566. cargo test -p victory-shader: 97 passed. Thanks @⁠MrCloudy2 and @⁠x3ero0 for the extra NVIDIA/dxil-spirv confirmations.

**@⁠Ortomanic** on GitHub · 2026-11-24 11:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7129681272) Rebased onto current `main` (ffe310e), so it merges cleanly again. Thanks @⁠pablogonz12 for flagging the conflict and @⁠deadkid14 for the test fix. The new test now builds against #189's `Parts` and the 4-argument `resource::track` from #566. `cargo test -p victory-shader`: 97 passed. Thanks @⁠MrCloudy2 and @⁠x3ero0 for the extra NVIDIA/dxil-spirv confirmations.
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 11:25 UTC · original

Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build.

main@ffe310e baseline on this box: 342 passed, 0 failed, 6 ignored. With this PR at b7300eb5 applied clean:

cargo test --workspace
343 passed; 0 failed; 6 ignored   (exit 0)

One more passing test than the baseline — keying heap handles by element type is exercised here and nothing else changes verdict. It also still applies cleanly to current main, unlike #185/#493 (noted in #340).

AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 11:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7130074852) Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build. `main@ffe310e` baseline on this box: **342 passed, 0 failed, 6 ignored**. With this PR at `b7300eb5` applied clean: ``` cargo test --workspace 343 passed; 0 failed; 6 ignored (exit 0) ``` One more passing test than the baseline — keying heap handles by element type is exercised here and nothing else changes verdict. It also still applies cleanly to current main, unlike #185/#493 (noted in #340). AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠1ReallyLongName on GitHub · 2026-11-24 12:00 UTC · original

Confirmed on Ampere with the 595 driver branch (Linux, GE-Proton11-14): this change alone removes the compile crash. #259 was not needed on this driver.

Setup: RTX 3080 10 GB, NVIDIA 595.112.07 (proprietary), i9-12900K, Nobara 44 (kernel 7.3.1). GE-Proton11-14's Wine, vkd3d-proton and DXVK dxgi. VIctory ffe310e, diagnostics build cross-compiled with cargo xwin (rustc 1.98.1). Series X, 1.0.2.1.

Before, on ffe310e:

  • The process dies with exit 3 and no crashes.log entry 80–95 s into the world, in 5 of 5 runs with nothing skipped. With WINEDEBUG=+seh the fault is in libnvidia-gpucomp.so (via libnvidia-glvkspirv.so, then winevulkan.so).
  • I let only one pipeline into the driver at a time, using a local mutex around HostPipeline::new. It still crashed, so this is not a threading race, and each crash named one pipeline. Culprits included compute a3d1a26ad0c8c2cd and 5d113aa6830760b6, and graphics pipelines with pixel 5ad3a82b1c3cc63a (4 runs). Bisecting with skips also pinned pixel 387423b7209fa45c and mesh 857b2e13c9cc107f.
  • Skipping them with VICTORY_SKIP_PIPELINES only moved the crash on to the next one.
  • VKD3D_SHADER_DUMP_PATH: 2 of 175 SPIR-V modules fail spirv-val --target-env vulkan1.3, with OpAtomicUMin %float and OpAtomicOr %float on an R32f storage image. The UMin one is compute a3d1a26ad0c8c2cd.

After, ffe310e with props.1 in the handles key (the same 2-line core as this PR, shader cache cleared):

  • 0 of 622 dumped SPIR-V modules fail spirv-val.
  • 2 of 2 runs reach my 300 s timeout in the world with nothing skipped and the default 8 pipeline workers (443 host pipelines in the second run).
  • cargo test -p victory-shader on Linux: 96 passed, 1 ignored.

What's left on this machine after the fix (probably separate): late in the run, frames drop to 0.3–0.7 fps, with preparing: copies at 2.0–2.8 s per frame. The kernel logs NVRM: intermapRegisterDmaMapping: Failed to insert new mapping node for range … and nvAssertFailedNoLog … gpu_vaspace.c assertions. There is no Xid (unlike the Xid 109 in #144 and #71), and about 2 GB of 10 GB VRAM is in use.

AI-assisted (Claude Code): I ran the tests on my own hardware.

**@⁠1ReallyLongName** on GitHub · 2026-11-24 12:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7130831133) **Confirmed on Ampere with the 595 driver branch (Linux, GE-Proton11-14): this change alone removes the compile crash. #259 was not needed on this driver.** **Setup:** RTX 3080 10 GB, NVIDIA 595.112.07 (proprietary), i9-12900K, Nobara 44 (kernel 7.3.1). GE-Proton11-14's Wine, vkd3d-proton and DXVK `dxgi`. VIctory `ffe310e`, diagnostics build cross-compiled with `cargo xwin` (rustc 1.98.1). Series X, 1.0.2.1. **Before, on `ffe310e`:** - The process dies with exit 3 and no `crashes.log` entry 80–95 s into the world, in 5 of 5 runs with nothing skipped. With `WINEDEBUG=+seh` the fault is in `libnvidia-gpucomp.so` (via `libnvidia-glvkspirv.so`, then `winevulkan.so`). - I let only one pipeline into the driver at a time, using a local mutex around `HostPipeline::new`. It still crashed, so this is not a threading race, and each crash named one pipeline. Culprits included compute `a3d1a26ad0c8c2cd` and `5d113aa6830760b6`, and graphics pipelines with pixel `5ad3a82b1c3cc63a` (4 runs). Bisecting with skips also pinned pixel `387423b7209fa45c` and mesh `857b2e13c9cc107f`. - Skipping them with `VICTORY_SKIP_PIPELINES` only moved the crash on to the next one. - `VKD3D_SHADER_DUMP_PATH`: 2 of 175 SPIR-V modules fail `spirv-val --target-env vulkan1.3`, with `OpAtomicUMin %float` and `OpAtomicOr %float` on an `R32f` storage image. The `UMin` one is compute `a3d1a26ad0c8c2cd`. **After, `ffe310e` with `props.1` in the `handles` key** (the same 2-line core as this PR, shader cache cleared): - 0 of 622 dumped SPIR-V modules fail `spirv-val`. - 2 of 2 runs reach my 300 s timeout in the world with nothing skipped and the default 8 pipeline workers (443 host pipelines in the second run). - `cargo test -p victory-shader` on Linux: 96 passed, 1 ignored. **What's left on this machine after the fix (probably separate):** late in the run, frames drop to 0.3–0.7 fps, with `preparing: copies` at 2.0–2.8 s per frame. The kernel logs `NVRM: intermapRegisterDmaMapping: Failed to insert new mapping node for range …` and `nvAssertFailedNoLog … gpu_vaspace.c` assertions. There is no `Xid` (unlike the Xid 109 in #144 and #71), and about 2 GB of 10 GB VRAM is in use. AI-assisted (Claude Code): I ran the tests on my own hardware.
Author
Owner

@⁠dpalacios69 on GitHub · 2026-11-24 15:07 UTC · original

Independent check on Linux, merged onto current main (ffe310e) in a scratch branch: textually clean, cargo test -p victory-shader --locked passes (97 passed, 0 failed, 1 ignored, the new test included), cargo clippy -p victory-shader --lib has no warnings. --all-targets shows only the two unused-import warnings in emit/mod.rs that main already has on Linux. No GPU run. AI-assisted; no game data.

**@⁠dpalacios69** on GitHub · 2026-11-24 15:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7135510717) Independent check on Linux, merged onto current `main` (`ffe310e`) in a scratch branch: textually clean, `cargo test -p victory-shader --locked` passes (97 passed, 0 failed, 1 ignored, the new test included), `cargo clippy -p victory-shader --lib` has no warnings. `--all-targets` shows only the two unused-import warnings in `emit/mod.rs` that `main` already has on Linux. No GPU run. AI-assisted; no game data.
Author
Owner

@⁠deadkid14 on GitHub · 2026-11-24 07:18 UTC · original · edited 2026-11-24 17:51 UTC

Heads-up for merge order: with #189 also merged, this PR's new test an_image_read_as_float_and_by_an_atomic_is_annotated_twice no longer compiles. #189 adds an options: TranslateOptions field to Parts, and the test's lower(&Parts { … }) doesn't set it (E0063: missing field 'options').

Adding options: super::TranslateOptions::default(), after prims: vec![], in that literal fixes it. That is the same default #189 uses in its own tests. Whichever of the two is merged second will need it.

AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.

**@⁠deadkid14** on GitHub · 2026-11-24 07:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7124848456) · edited 2026-11-24 17:51 UTC Heads-up for merge order: with #189 also merged, this PR's new test `an_image_read_as_float_and_by_an_atomic_is_annotated_twice` no longer compiles. #189 adds an `options: TranslateOptions` field to `Parts`, and the test's `lower(&Parts { … })` doesn't set it (`E0063: missing field 'options'`). Adding `options: super::TranslateOptions::default(),` after `prims: vec![],` in that literal fixes it. That is the same default #189 uses in its own tests. Whichever of the two is merged second will need it. *AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.*
Author
Owner

@⁠brunofgmag on GitHub · 2026-11-24 23:26 UTC · original

This is still needed on the new main (70564ae). There it now conflicts, and without it the title dies about 2 s after launch on an RTX 4080 under Proton Experimental (driver 620.73.04, CachyOS).

The log shows nothing at default Wine debug settings. With WINEDEBUG=+seh,+process the cause is the one this PR describes: an access violation in libnvidia-gpucomp.so +0x55a954 inside vkCreateComputePipelines, then vkCreateComputePipelines Exception 0xc0000005 in Unix call and NtTerminateProcess with exit code 3 on every thread.

I ported the change by hand onto 70564ae. The handle cache key in Lower gets the element type as its sixth element, and the test from b7300eb comes along, with resource::track now taking the structure as its fourth argument. The test fails with the old key and passes with the new one, and cargo test -p victory-shader --lib passes (124 passed, 1 ignored). With the port, a 60 s run gets past the crash: frames are presented, and there are no err:vulkan lines or libnvidia faults.

Thanks to @⁠Ortomanic for finding this and for the fix. A rebase onto the new main would let it go in as it is.

**@⁠brunofgmag** on GitHub · 2026-11-24 23:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7147408952) This is still needed on the new `main` (`70564ae`). There it now conflicts, and without it the title dies about 2 s after launch on an RTX 4080 under Proton Experimental (driver 620.73.04, CachyOS). The log shows nothing at default Wine debug settings. With `WINEDEBUG=+seh,+process` the cause is the one this PR describes: an access violation in `libnvidia-gpucomp.so +0x55a954` inside `vkCreateComputePipelines`, then `vkCreateComputePipelines Exception 0xc0000005 in Unix call` and `NtTerminateProcess` with exit code 3 on every thread. I ported the change by hand onto `70564ae`. The handle cache key in `Lower` gets the element type as its sixth element, and the test from `b7300eb` comes along, with `resource::track` now taking the structure as its fourth argument. The test fails with the old key and passes with the new one, and `cargo test -p victory-shader --lib` passes (124 passed, 1 ignored). With the port, a 60 s run gets past the crash: frames are presented, and there are no `err:vulkan` lines or `libnvidia` faults. Thanks to @⁠Ortomanic for finding this and for the fix. A rebase onto the new `main` would let it go in as it is.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:19 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-shader/src/emit/lower.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7148397130) <!-- victory-triage v1 head=b7300eb5b86cc37027d197d56b4eaf5f8b08d060 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-shader/src/emit/lower.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠ruvenesh on GitHub · 2026-11-25 08:03 UTC · original

Test report: Linux + Proton on an RTX 3060 (Ampere, 32-lane), where this fixes 704 pixel and 6 compute pipelines the driver refuses on main, with no regressions in a whole-archive census.

Setup: Ubuntu-based host, NVIDIA RTX 3060 12 GB (Linux driver), GE-Proton11-14 (vkd3d-proton 3.2.x), VIctory diag builds cross-compiled for x86_64-pc-windows-msvc. This PR's change merged onto main (two small conflicts in lower.rs, resolved by keeping both sides).

What fails on main: victory translate shaders.rpf --list --pipelines --jobs 1 on main 7ae5e17 refuses 704 pixel pipelines with Out of memory and 6 compute pipelines with Call failed; stderr has NVVM compilation failed: 1 for each. The cause is the one this PR names: a shader that reads a heap UAV texture (here, its dimensions) and does an image atomic on it in the same block gets the cached float-annotated handle for the atomic. dxil-spirv then emits OpAtomicUMin / OpAtomicOr / OpAtomicIAdd with a float result type. Of the SPIR-V modules vkd3d-proton dumped for these programs, 618 fail spirv-val --target-env vulkan1.3 with "expected Result Type to be integer scalar type" (611 UMin, 5 IAdd, 2 Or), and NVIDIA's compiler rejects them, which vkd3d-proton reports as E_OUTOFMEMORY. (So on this path it is not the worker-stack problem of #966/#1129: a 64 MiB worker stack changes nothing here, A/B tested in the title.)

With this PR:

  • Offline census, same archive, per program against main: all 704 pixel and all 6 compute pipelines are created; 0 programs changed for the worse (25,889 programs joined). The WaveSize-64 refusals (32-lane device) and the geometry-program refusals are unchanged, as expected.
  • In the title (same scripted input, ~5 min each): host pipelines refused with Out of memory 13 → 0, Call failed 2 → 0, vkd3d Failed to create Vulkan graphics pipeline, vr -13 13 → 0. (The two runs are on slightly different main commits, 940d32f and ccfb029; I compared counts and the failure type, not program by program.)

Not done here: cargo test on the merged tree (the PR's own test covers the key), and a Windows NVIDIA check — Windows compiles the DXIL directly, so this failure may not show there.

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

**@⁠ruvenesh** on GitHub · 2026-11-25 08:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7156548460) Test report: Linux + Proton on an RTX 3060 (Ampere, 32-lane), where this fixes **704 pixel and 6 compute pipelines** the driver refuses on `main`, with no regressions in a whole-archive census. **Setup:** Ubuntu-based host, NVIDIA RTX 3060 12 GB (Linux driver), GE-Proton11-14 (vkd3d-proton 3.2.x), VIctory diag builds cross-compiled for `x86_64-pc-windows-msvc`. This PR's change merged onto `main` (two small conflicts in `lower.rs`, resolved by keeping both sides). **What fails on `main`:** `victory translate shaders.rpf --list --pipelines --jobs 1` on `main` 7ae5e17 refuses 704 pixel pipelines with `Out of memory` and 6 compute pipelines with `Call failed`; stderr has `NVVM compilation failed: 1` for each. The cause is the one this PR names: a shader that reads a heap UAV texture (here, its dimensions) and does an image atomic on it in the same block gets the cached float-annotated handle for the atomic. dxil-spirv then emits `OpAtomicUMin` / `OpAtomicOr` / `OpAtomicIAdd` with a float result type. Of the SPIR-V modules vkd3d-proton dumped for these programs, 618 fail `spirv-val --target-env vulkan1.3` with "expected Result Type to be integer scalar type" (611 UMin, 5 IAdd, 2 Or), and NVIDIA's compiler rejects them, which vkd3d-proton reports as `E_OUTOFMEMORY`. (So on this path it is not the worker-stack problem of #966/#1129: a 64 MiB worker stack changes nothing here, A/B tested in the title.) **With this PR:** - Offline census, same archive, per program against `main`: all 704 pixel and all 6 compute pipelines are created; 0 programs changed for the worse (25,889 programs joined). The WaveSize-64 refusals (32-lane device) and the geometry-program refusals are unchanged, as expected. - In the title (same scripted input, ~5 min each): host pipelines refused with `Out of memory` 13 → 0, `Call failed` 2 → 0, vkd3d `Failed to create Vulkan graphics pipeline, vr -13` 13 → 0. (The two runs are on slightly different `main` commits, 940d32f and ccfb029; I compared counts and the failure type, not program by program.) Not done here: `cargo test` on the merged tree (the PR's own test covers the key), and a Windows NVIDIA check — Windows compiles the DXIL directly, so this failure may not show there. No game data attached. AI-assisted (Claude Code).
Author
Owner

@⁠neonbyte1 on GitHub · 2026-11-25 08:15 UTC · original

Confirmed on an RTX 5090 under Wine + vkd3d-proton (GE-Proton11-14), main 940d32f: this is the crash at world load. Compute 76c35de1c2444e67 gets a R32f handle ([4100, 1033]) that its image_atomic_add reuses. dxil-spirv then emits OpAtomicIAdd %float, spirv-val rejects it, and NVIDIA's driver faults in vkCreateComputePipelines (0xc0000005). With an R32ui handle ([4100, 261]) the SPIR-V validates and the pipeline is created. Details and numbers are in #144.

This branch conflicts with current main (the page-table merge rewrote descriptor_data). I have the same fix rebuilt on 940d32f if a fresh PR is easier.

AI-assisted (Claude); measured on my machine.

**@⁠neonbyte1** on GitHub · 2026-11-25 08:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7156809522) Confirmed on an RTX 5090 under Wine + vkd3d-proton (GE-Proton11-14), `main` 940d32f: this is the crash at world load. Compute `76c35de1c2444e67` gets a R32f handle (`[4100, 1033]`) that its `image_atomic_add` reuses. dxil-spirv then emits `OpAtomicIAdd %float`, `spirv-val` rejects it, and NVIDIA's driver faults in `vkCreateComputePipelines` (`0xc0000005`). With an R32ui handle (`[4100, 261]`) the SPIR-V validates and the pipeline is created. Details and numbers are in #144. This branch conflicts with current `main` (the page-table merge rewrote `descriptor_data`). I have the same fix rebuilt on 940d32f if a fresh PR is easier. _AI-assisted (Claude); measured on my machine._
Author
Owner

@⁠andyeox-systemd on GitHub · 2026-11-25 19:00 UTC · original

Thanks @⁠Ortomanic and @⁠gingertonik. This fix was half of the NVIDIA crash in #144. I rebased it onto current main in #2723, with both of you credited as co-authors. Two things changed:

  • main added entry_handles and join_handles since this PR. They had the same float-or-atomic sharing, so I keyed them by props.1 as well. Without that, I still got an invalid AtomicOr on NVIDIA.
  • The test needed view_marks: false for the current Parts.

If you'd prefer to update this PR instead, I'm happy to close mine.

**@⁠andyeox-systemd** on GitHub · 2026-11-25 19:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/177#issuecomment-7171695247) Thanks @⁠Ortomanic and @⁠gingertonik. This fix was half of the NVIDIA crash in #144. I rebased it onto current `main` in #2723, with both of you credited as co-authors. Two things changed: - `main` added `entry_handles` and `join_handles` since this PR. They had the same float-or-atomic sharing, so I keyed them by `props.1` as well. Without that, I still got an invalid `AtomicOr` on NVIDIA. - The test needed `view_marks: false` for the current `Parts`. If you'd prefer to update this PR instead, I'm happy to close mine.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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