victory-shader: split and unify return blocks so dxil-spirv's structuriser keeps a terminator #3954

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

@⁠HyperRamzey on GitHub · 2026-11-30 12:58 UTC · original
HyperRamzey:fix/dxil-loop-merge-ret → main · +795 −26 · 2 files · 2 commits · draft

Bases

  • This PR's diff: one commit (494a9df3) on upstream main, merged with main at 5fabb46e (eaec1641); nothing from the PRs below is part of it.
  • In-game evidence comes from a local integration tree, not this diff. The current one carries, by number: #2449 (ours — the composer emits its root signature in code, so it builds under Wine without a DXC DLL), #3417 (ErRusso — DXC fallback compiles helpers as HLSL 2018 (-HV 2018), fixing the ambient raise build, #2769), #4041 (GPU sweep / kept-bitmap fixes), #4338 and #4339 (hardware-ray-tracing fixes), #4203 (card-time profiler in release builds), and a local quiet_raw_chains change (VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains under Wine, for the driver's raw-access crash; no PR yet). #2449 and #3417 are both open and taken together there.

Fixes

  • Upstream #2648 — SIGILL (0xC000001D) in libnvidia-gpucomp.so during vkCreateComputePipelines on compute shader 4e296b1885c37b29: translation rc 0 / spirv-val rc 0 after this change (was SIGSEGV 139).
  • The in-game a1d865bdfb3559eb 0xC0000005 crash found on this rig (driver segfault in vkCreateComputePipelines): the title now creates that host pipeline in game and its saved DXIL validates (oracle rc 0, spirv-val rc 0).

What this fixes

Two invalid-SPIR-V shapes our emitter produced that dxil-spirv's structuriser (pin 8434b06, in vkd3d-proton through 3.1.0) turned into a driver crash:

  • A loop whose single exit is a bare ret void. The structuriser takes that block as the loop's merge and drops the return, leaving a block that ends in OpFunctionEnd with no OpReturn.
  • Several returns plus interleaved selection-merge scopes. find_selection_merges can promote a selection to a fake loop whose common post-dominator is the function-exit sentinel, and traverse never emits EXIT, so OpLoopMerge %EXIT appears twice over one block with no terminator ("already a merge block for another header").

Module::write now serialises unify_returns(split_returns(blocks)): split first, so a shared empty return gets one pure return per predecessor (a returning block with body or phis keeps the plain split; the entry block is never dropped), then unify every return onto one appended block, so the merge candidate the structuriser picks is a real block every path reaches. Functions with no return or one return are unchanged.

Evidence

Check Before After
123-container corpus, spirv-val 102 valid / 21 rejected 123/123 valid
4e296b1885c37b29 (#2648) SIGSEGV 139 translation rc 0, spirv-val rc 0
a1d865bdfb3559eb (this rig) driver segfault host pipeline created in game; saved DXIL validates
victory-shader tests (merged with main 5fabb46e) — 345 passed, 0 failed, 2 ignored

Both invariants were sabotage-verified: disabling unify_returns turns 5 tests red; disabling the shared-return branch of split_returns turns 2 red.

In game

in game — intro cutscene, DLSS Frame Generation 2× live

Proton-CachyOS under Wayland, RTX 5070 (driver 620.73.04), vkd3d-proton built from master (rewritten structuriser; the custom DLL embeds the later split cfg_structurizer_*.cpp refactor): the title boots past the account picker, plays the intro cutscene, and renders its frames. DLSS Super Resolution, DLSS Frame Generation (2×) and Reflex all load and report on (Reflex low latency … on=true code=0). The previously fatal containers (42683eebec081520, 54bcc8478432ba15, d3e5b737ea7cc150) create their host pipelines without a crash.

Milestones (draft; updated as they land)

  • Shader crash classes fixed — title boots and renders in game
  • DLSS SR / DLSS FG 2× / Reflex load and run
  • Branch merged with upstream main 5fabb46e — the only conflict was emit/bitcode.rs; victory-shader 345 tests green
  • Stock-Proton failure class root-caused offline — two dxil-spirv structuriser defects (missing back-edge phi incoming; switch dispatcher emitted as a loop header)
  • vkd3d-proton builds fingerprinted from their DLLs — vkd3d-1.1-5783 rewritten, vkd3d-1.1-5742 compiles both, vkd3d-1.1-5656 old
  • Stock-Proton failure surface measured corpus-wide — 2,943 containers: 2,501 valid, 442 genuine failures under the old structuriser
  • On stock Proton, no custom vkd3d-proton build
  • Full parity with the Windows side: RT on, all effects, 20–30 fps stable

Not in this PR

The other crash-class reproducers found this session (42683eebec081520, 54bcc8478432ba15, d3e5b737ea7cc150) fail inside dxil-spirv's own structuriser regardless of input DXIL shape; they are fixed by its rewrite (dxil-spirv a7676a1f; vkd3d-1.1-5742-g2576c0b4 is the first build we can show carrying it, and it selects the rewrite by default, with the legacy path behind a flag that defaults off, while vkd3d-1.1-5656-g0bb64c5 has the old one only). Eliminating those shapes at the emitter is the stock-Proton follow-up.

Measured offline against pin 8434b06, spirv-val as the oracle:

  • Missing back-edge phi incoming. place_phi_read builds the frontier phi from frontier->pred only; the assert(!frontier->pred_back_edge) above it is compiled out in release builds. A collector block that later becomes a loop header never receives its back-edge incoming: 42683eebec081520 emits %frontier_phi_6_collector = OpPhi %uint … with three incoming values for four predecessors, and spirv-val rejects it.
  • Switch dispatcher emitted as a loop header. Patching that incoming surfaces the next failure on the same container: OpLoopMerge immediately precedes OpSwitch, which SPIR-V forbids. collect_and_dispatch_control_flow names the multi-way dispatcher (common_idom->name + ".collector") and assigns it as the loop merge block.
  • No emitter return shape tested avoids it. As this PR emits them: invalid OpPhi on 42683eebec081520 and 54bcc8478432ba15, a hang on d3e5b737ea7cc150. A split-only shape (per-edge returns, no unify) turns 42683eebec081520 and d3e5b737ea7cc150 into invalid unstructured loop exits. The phi-patched structuriser then fails 42683eebec081520 and 54bcc8478432ba15 on OpLoopMerge.

Which shipped binaries carry the rewrite (strings and PE headers of their d3d12core.dll):

Proton build vkd3d-proton structuriser in the DLL
CachyOS 11.0-20261129-nightly vkd3d-1.1-5783-g71cae09 rewritten only
Proton Experimental vkd3d-1.1-5742-g2576c0b4 both compiled; rewritten is the default
CachyOS Latest vkd3d-1.1-5656-g0bb64c5 old only

The nightly's vkd3d-low-latency DLL is still the old structuriser despite the same PE timestamp.

Measured corpus-wide through the old pin (2,943 containers from this rig, spirv-val as the oracle, mesh validated at vulkan1.2 where SPV_EXT_mesh_shader is legal): 2,501 valid, 442 genuine failures — 150 invalid SPIR-V (120 unstructured loop exits, 18 OpPhi predecessor counts, 6 already-a-merge-block, 3 OpSwitch without OpSelectionMerge, 3 OpLoopMerge placement), 266 SIGSEGV, 24 hangs, 2 no output. That is the surface an emitter-side follow-up faces.

**@⁠HyperRamzey** on GitHub · 2026-11-30 12:58 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3954) `HyperRamzey:fix/dxil-loop-merge-ret` → `main` · +795 −26 · 2 files · 2 commits · draft ## Bases - **This PR's diff**: one commit (`494a9df3`) on upstream `main`, merged with `main` at `5fabb46e` (`eaec1641`); nothing from the PRs below is part of it. - **In-game evidence** comes from a local integration tree, not this diff. The current one carries, by number: #2449 (ours — the composer emits its root signature in code, so it builds under Wine without a DXC DLL), #3417 (ErRusso — DXC fallback compiles helpers as HLSL 2018 (`-HV 2018`), fixing the ambient `raise` build, #2769), #4041 (GPU sweep / kept-bitmap fixes), #4338 and #4339 (hardware-ray-tracing fixes), #4203 (card-time profiler in release builds), and a local `quiet_raw_chains` change (`VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains` under Wine, for the driver's raw-access crash; no PR yet). #2449 and #3417 are both open and taken together there. ## Fixes - **Upstream #2648** — SIGILL (0xC000001D) in `libnvidia-gpucomp.so` during `vkCreateComputePipelines` on compute shader `4e296b1885c37b29`: translation rc 0 / `spirv-val` rc 0 after this change (was SIGSEGV 139). - **The in-game `a1d865bdfb3559eb` 0xC0000005 crash** found on this rig (driver segfault in `vkCreateComputePipelines`): the title now creates that host pipeline in game and its saved DXIL validates (oracle rc 0, `spirv-val` rc 0). ## What this fixes Two invalid-SPIR-V shapes our emitter produced that dxil-spirv's structuriser (pin `8434b06`, in vkd3d-proton through 3.1.0) turned into a driver crash: - **A loop whose single exit is a bare `ret void`.** The structuriser takes that block as the loop's merge and drops the return, leaving a block that ends in `OpFunctionEnd` with no `OpReturn`. - **Several returns plus interleaved selection-merge scopes.** `find_selection_merges` can promote a selection to a fake loop whose common post-dominator is the function-exit sentinel, and `traverse` never emits EXIT, so `OpLoopMerge %EXIT` appears twice over one block with no terminator ("already a merge block for another header"). `Module::write` now serialises `unify_returns(split_returns(blocks))`: split first, so a shared empty return gets one pure return per predecessor (a returning block with body or phis keeps the plain split; the entry block is never dropped), then unify every return onto one appended block, so the merge candidate the structuriser picks is a real block every path reaches. Functions with no return or one return are unchanged. ## Evidence | Check | Before | After | |---|---|---| | 123-container corpus, `spirv-val` | 102 valid / 21 rejected | **123/123 valid** | | `4e296b1885c37b29` (#2648) | SIGSEGV 139 | translation rc 0, `spirv-val` rc 0 | | `a1d865bdfb3559eb` (this rig) | driver segfault | host pipeline created in game; saved DXIL validates | | `victory-shader` tests (merged with `main` `5fabb46e`) | — | 345 passed, 0 failed, 2 ignored | Both invariants were sabotage-verified: disabling `unify_returns` turns 5 tests red; disabling the shared-return branch of `split_returns` turns 2 red. ## In game ![in game — intro cutscene, DLSS Frame Generation 2× live](https://github.com/HyperRamzey/VIctory-NVIDIA/releases/download/pr-3954-evidence/pr-screenshot.png) Proton-CachyOS under Wayland, RTX 5070 (driver 620.73.04), vkd3d-proton built from master (rewritten structuriser; the custom DLL embeds the later split `cfg_structurizer_*.cpp` refactor): the title boots past the account picker, plays the intro cutscene, and renders its frames. DLSS Super Resolution, DLSS Frame Generation (2×) and Reflex all load and report on (`Reflex low latency … on=true code=0`). The previously fatal containers (`42683eebec081520`, `54bcc8478432ba15`, `d3e5b737ea7cc150`) create their host pipelines without a crash. ## Milestones (draft; updated as they land) - [x] Shader crash classes fixed — title boots and renders in game - [x] DLSS SR / DLSS FG 2× / Reflex load and run - [x] Branch merged with upstream `main` `5fabb46e` — the only conflict was `emit/bitcode.rs`; `victory-shader` 345 tests green - [x] Stock-Proton failure class root-caused offline — two dxil-spirv structuriser defects (missing back-edge phi incoming; switch dispatcher emitted as a loop header) - [x] vkd3d-proton builds fingerprinted from their DLLs — `vkd3d-1.1-5783` rewritten, `vkd3d-1.1-5742` compiles both, `vkd3d-1.1-5656` old - [x] Stock-Proton failure surface measured corpus-wide — 2,943 containers: 2,501 valid, 442 genuine failures under the old structuriser - [ ] On stock Proton, no custom vkd3d-proton build - [ ] Full parity with the Windows side: RT on, all effects, 20–30 fps stable ## Not in this PR The other crash-class reproducers found this session (`42683eebec081520`, `54bcc8478432ba15`, `d3e5b737ea7cc150`) fail inside dxil-spirv's own structuriser regardless of input DXIL shape; they are fixed by its rewrite (dxil-spirv `a7676a1f`; `vkd3d-1.1-5742-g2576c0b4` is the first build we can show carrying it, and it selects the rewrite by default, with the legacy path behind a flag that defaults off, while `vkd3d-1.1-5656-g0bb64c5` has the old one only). Eliminating those shapes at the emitter is the stock-Proton follow-up. Measured offline against pin `8434b06`, `spirv-val` as the oracle: - **Missing back-edge phi incoming.** `place_phi_read` builds the frontier phi from `frontier->pred` only; the `assert(!frontier->pred_back_edge)` above it is compiled out in release builds. A collector block that later becomes a loop header never receives its back-edge incoming: `42683eebec081520` emits `%frontier_phi_6_collector = OpPhi %uint …` with three incoming values for four predecessors, and `spirv-val` rejects it. - **Switch dispatcher emitted as a loop header.** Patching that incoming surfaces the next failure on the same container: `OpLoopMerge` immediately precedes `OpSwitch`, which SPIR-V forbids. `collect_and_dispatch_control_flow` names the multi-way dispatcher (`common_idom->name + ".collector"`) and assigns it as the loop merge block. - **No emitter return shape tested avoids it.** As this PR emits them: invalid `OpPhi` on `42683eebec081520` and `54bcc8478432ba15`, a hang on `d3e5b737ea7cc150`. A split-only shape (per-edge returns, no unify) turns `42683eebec081520` and `d3e5b737ea7cc150` into invalid unstructured loop exits. The phi-patched structuriser then fails `42683eebec081520` and `54bcc8478432ba15` on `OpLoopMerge`. Which shipped binaries carry the rewrite (strings and PE headers of their `d3d12core.dll`): | Proton build | vkd3d-proton | structuriser in the DLL | |---|---|---| | CachyOS 11.0-20261129-nightly | `vkd3d-1.1-5783-g71cae09` | rewritten only | | Proton Experimental | `vkd3d-1.1-5742-g2576c0b4` | both compiled; rewritten is the default | | CachyOS Latest | `vkd3d-1.1-5656-g0bb64c5` | old only | The nightly's `vkd3d-low-latency` DLL is still the old structuriser despite the same PE timestamp. Measured corpus-wide through the old pin (2,943 containers from this rig, `spirv-val` as the oracle, mesh validated at `vulkan1.2` where `SPV_EXT_mesh_shader` is legal): 2,501 valid, 442 genuine failures — 150 invalid SPIR-V (120 unstructured loop exits, 18 `OpPhi` predecessor counts, 6 already-a-merge-block, 3 `OpSwitch` without `OpSelectionMerge`, 3 `OpLoopMerge` placement), 266 SIGSEGV, 24 hangs, 2 no output. That is the surface an emitter-side follow-up faces.
dxil-spirv's structuriser (pin 8434b06, in vkd3d-proton through 3.1.0)
mishandles the return shapes our emitter produced, in two ways that both
end in invalid SPIR-V that spirv-val rejects and NVIDIA's compiler traps
on inside vkCreateComputePipelines (0xC0000005, upstream #2648):

  - a loop whose single exit is a bare `ret void`: the structuriser takes
    that block as the loop's merge and drops the return, leaving a block
    that ends in OpFunctionEnd with no OpReturn;
  - several returns plus interleaved selection-merge scopes:
    find_selection_merges can promote one selection to a fake loop whose
    common post-dominator is the function-exit sentinel, and traverse
    never emits EXIT, so OpLoopMerge %EXIT appears twice over one block
    with no terminator ("already a merge block for another header").

Module::write now serialises unify_returns(split_returns(blocks)). Split
runs first so a shared empty return gets one pure return per predecessor
(a returning block with body or phis keeps the plain split, and the
entry block is never dropped). Unify then redirects every return at one
appended block, so the merge candidate the structuriser picks is a real
block every path reaches. Functions with no return or one return are
left untouched. The append costs four bytes per shape in the pinned
written_bytes_unchanged test; its hashes are repinned.

Measured: the 123-container corpus goes from 102 valid / 21 rejected to
123/123 valid. In game, a1d865bdfb3559eb (driver segfault before) now
creates its host pipeline, and 4e296b1885c37b29 (#2648) goes from
SIGSEGV 139 to translation rc 0 with spirv-val rc 0. victory-shader:
308 passed, 0 failed, 2 ignored.

The other reproducers this session found (42683eebec081520,
54bcc8478432ba15, d3e5b737ea7cc150) fail inside dxil-spirv's own
structuriser regardless of input shape; they are fixed only by its
rewrite (dxil-spirv a7676a1f, vkd3d-proton b540c8a2), not by the
emitter.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 13:02:12 +00:00
Author
Owner

@⁠VibeCodeGuy on GitHub · 2026-12-01 00:01 UTC · original

Offline corpus check (every shader container in a v1.0.2.1 dump: 25,699 unique programs), this PR at 494a9df3 against its merge-base with main, 41adb551 (it does not merge cleanly onto main e1251c31).

  • Newly failing: 0. Newly passing: 0.
  • DXIL output changed: 25698 programs (12060 Ps, 8765 Ms, 2681 Cs, 2192 Vs); 25627 of them pass the validator, the other 71 failed it on main too (oversized mesh outputs).
The 25698 changed programs by family
  • 488 × MS_VS_Transform_PositionOnly
  • 404 × PS_LinearDepth
  • 386 × PS_DeferredTextured
  • 372 × MS_VS_Transform
  • 368 × PS_MirrorReflectionDeferredTextured
  • 365 × PS_CascadeShadows_fade
  • 355 × MSNC_VS_TransformSkin_PositionOnly
  • 346 × PS_MirrorReflectionTextured_Eight
  • 346 × PS_Textured_Eight
  • 314 × PS_VfxVBuffer_AlphaClip
  • 310 × PS_LinearDepthOpaque
  • 296 × PS_DeferredTextured_AlphaClip
  • 295 × PS_MirrorReflectionDeferredTextured_AlphaClip
  • 294 × PS_VfxVBuffer
  • 294 × PS_VoxelizeVisiblity
  • 288 × PS_PuddleDetect_Zero
  • 274 × MSNC_VS_TransformSkin
  • 268 × PS_AlphaPrepass
  • 262 × PS_EntityMask
  • 260 × MS_VS_MirrorReflectionTransform
  • 252 × MS_VS_CascadeShadows_draw
  • 247 × MS_VS_CascadeShadows_drawTexture
  • 242 × MS_VS_TransformD
  • 242 × PS_CascadeShadows_texture
  • 239 × PS_MirrorReflectionDeferredDecalTextured
  • 235 × MS_VS_LinearDepth
  • 230 × MSNC_VS_MirrorReflectionTransformSkin
  • 226 × MS_VS_MirrorReflectionTransformD
  • 217 × PS_AlphaTransmission
  • 216 × VS_Transform_VfxVBuffer_AlphaClip
  • 214 × MS_VS_TransformEntityMask
  • 205 × VS_Transform_VfxVBuffer
  • 202 × VS_TransformSkin_VfxVBuffer_AlphaClip
  • 195 × VS_TransformSkin_VfxVBuffer
  • 195 × VS_VoxelizeGeneric
  • 192 × MSNC_VS_TransformSkinD
  • 181 × MS_VS_TransformTransmission
  • 176 × MSNC_VS_LinearDepthSkin
  • 176 × MSNC_VS_MirrorReflectionTransformSkinD
  • 176 × MS_VS_TransformAlphaPrepass
  • 174 × MSNC_VS_TransformSkinEntityMask
  • 166 × MSNC_VS_CascadeShadows_drawskinnedTexture
  • 152 × MSNC_VS_CascadeShadows_drawskinned
  • 146 × MSNC_VS_TransformSkinTransmission
  • 146 × MSNC_VS_TransformSkin_AlphaPrepass
  • 146 × MS_VS_MirrorReflectionTransformDecalsD
  • 129 × MSNC_VS_MirrorReflectionTransformSkinDecalsD
  • 109 × PS_MirrorPedTextured_Eight
  • 109 × PS_PedAlphaPrepass
  • 109 × PS_PedTextured_Eight_Alpha
  • 109 × PS_StudioPedTextured_Eight
  • 109 × PS_TexturedDeferred
  • 107 × PS_PedAlphaPrepass_Decals
  • 107 × PS_PedTextured_Eight_Decals
  • 99 × MS_VS_TransformLit
  • 96 × MSNC_VS_PedTransformSkinAlpha
  • 95 × PS_TrailmapDeformData
  • 88 × MS_VS_TrailmapDeformData
  • 83 × MS_VS_TransformSkin_PositionOnly
  • 83 × PS_PedAlphaTransmission
  • 83 × PS_PedAlphaTransmission_Decals
  • 82 × MS_VS_PedTransformAlpha
  • 82 × PS_PuddleDetect
  • 80 × PS_MirrorReflectionTexturedDeferred
  • 79 × PS_CascadeShadows_texture_alpha
  • 76 × PS_TexturedLit_8
  • 75 × MSNC_VS_TrailmapDeformDataSkinned
  • 72 × PS_DeferredPedTexturedNC
  • 71 × PS_MirrorReflectionDeferredPedTexturedNC
  • 70 × PS_DeferredPedDecalTextured
  • 69 × PS_DeferredTextured_AlphaClipNC
  • 69 × PS_MirrorReflectionDeferredTextured_AlphaClipNC
  • 65 × MS_VS_CascadeShadows_PedTransformPreSkinD
  • 59 × PS_TexturedLit
  • 58 × MSR_VS_TransformSkin_PositionOnly
  • 52 × MSNC_VS_PedTransformSkinD_PositionOnly
  • 52 × PS_AlphaPrepass_Fire
  • 51 × MSNC_VS_PedTransformSkinEntityMaskD
  • 51 × MS_VS_PedTransformD_PositionOnly
  • 50 × PS_Textured_Eight_Fire
  • 49 × MSNC_VS_MirrorReflectionPedTransformSkin
  • 49 × MSNC_VS_PedTransformSkinTransmissionAlpha
  • 48 × MSNC_VS_PedTransformSkin_Decals
  • 48 × PS_AlphaTransmission_Fire
  • 47 × MSNC_VS_PedTransformSkinAlpha_Decals
  • 47 × MSNC_VS_PedTransformSkinTransmission_Decals
  • 46 × MS_VS_PedTransformPreSkinD_PositionOnly
  • 46 × PS_PedEntityMask
  • 45 × MS_VS_PedTransformEntityMask
  • 45 × PS_MirrorReflectionTexturedDeferredAlphaClipNC
  • 45 × PS_TexturedDeferredAlphaClipNC
  • 45 × VS_Passthrough
  • 44 × PS_PedEntityMaskD
  • 43 × MS_VS_LinearDepthPreSkin
  • 43 × PS_CascadeShadows_texture_fire
  • 42 × MSNC_VS_MirrorReflectionPedTransformSkinD
  • 42 × MSNC_VS_PedTransformSkinD
  • 42 × PS_PedTexturedCutOutTint_Zero
  • 42 × PS_TrailMapPropDeepSurfaceFlatten_UAV
  • 41 × MS_VS_MirrorReflectionPedTransform
  • 41 × MS_VS_PedTransformTransmissionAlpha
  • 41 × MS_VS_PedTransform_Decals
  • 41 × PS_LinearDepth_Fire
  • 40 × MSNC_VS_MirrorReflectionPedTransformSkinDecalsD
  • 40 × MS_VS_MirrorReflectionPedTransformD
  • 40 × MS_VS_PedTransformAlpha_Decals
  • 40 × MS_VS_PedTransformD
  • 40 × MS_VS_PedTransformTransmissionAlpha_Decals
  • 40 × PS_TrailMapPropGrassFlatten_UAV
  • 39 × MS_VS_MirrorReflectionPedTransformDecalsD
  • 38 × PS_AlphaPrepassSpatter
  • 38 × PS_AlphaTransmissionSpatter
  • 37 × MS_VS_PedTransformPreSkinD
  • 37 × PS_TwoLayerEntityMask
  • 35 × PS_AlphaPrepassSpatter_Fire
  • 35 × PS_AlphaTransmissionSpatter_Fire
  • 35 × PS_PropVehicleDeferred
  • 35 × PS_VehicleLiveryOffComplexDirtOffDeferred
  • 35 × PS_VehicleLiveryOffComplexDirtOffDetailMapsOffDeferred
  • 35 × PS_VehicleLiveryOffDetailMapsOffComplexDirtOffStickersOffFlakesOffDeferred
  • 35 × PS_VehicleLiveryOffDetailMapsOffDeferred
  • 35 × PS_VehicleLiveryOffOnlyDeferred
  • 35 × PS_VehicleLiveryOnDetailMapsOffDeferred
  • 35 × PS_VehicleVariationDeferred
  • 35 × VS_Blit
  • 35 × ptfx_PS
  • 35 × ptfx_PS_alphathreshold_mv_uvdistort
  • 35 × ptfx_PS_alphathreshold_mv_uvdistort_nolocallights
  • 35 × ptfx_PS_nolocallights
  • 34 × MS_VS_TransformTransmissionFire
  • 34 × MS_VS_Transform_Fire
  • 33 × MS_VS_Transform_Fire_AlphaPrepass
  • 32 × MSNC_VS_BakeDecorations
  • 32 × MSR_VS_TransformSkin
  • 32 × MS_VS_TransformSkin
  • 32 × PS_DeferredPedTexturedNC_Packed
  • 31 × PS_TexturedLit_ReflectionMap
  • 28 × MSNC_VS_TransformSkinTransmissionFire
  • 28 × MSNC_VS_TransformSkin_Fire
  • 28 × MSNC_VS_TransformSkin_Fire_AlphaPrepass
  • 28 × PS_BakeDecorations
  • 26 × PS_DeferredPedTextured_AlphaClipNC_Tint
  • 26 × VS_TransformPreSkin_VfxVBuffer
  • 25 × MSR_VS_MirrorReflectionTransformSkinD
  • 25 × MSR_VS_TransformSkinD
  • 25 × MS_VS_MirrorReflectionTransformSkinD
  • 25 × MS_VS_TransformSkinD
  • 25 × MS_VS_TransformSpatterAlphaPrepass
  • 25 × MS_VS_TransformTransmissionSpatter
  • 25 × PS_DeferredPedTextured_AlphaClip_Decal_Tint

How: victory translate <dump> --validate --list built for each side (release, cross-built with cargo-xwin, run under Wine), VICTORY_HOST_WAVE=32, plus the four shader-cache-key settings play starts with (VICTORY_EARLY_DEPTH=1, VICTORY_NAN_SCRUB=1, VICTORY_BVH_MISS=1, VICTORY_SAMPLED_MARKS=1). Validator: dxil.dll from DXC v1.9.2609. "Changed" compares translate's emitted hash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. At the merge-base the same run has the same 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut in mesh_prologue) and CS_TraceShadowRays_FullAdaptive (#2993).

**@⁠VibeCodeGuy** on GitHub · 2026-12-01 00:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3954#issuecomment-7295828313) **Offline corpus check** (every shader container in a v1.0.2.1 dump: 25,699 unique programs), this PR at 494a9df3 against its merge-base with `main`, 41adb551 (it does not merge cleanly onto `main` e1251c31). - Newly failing: **0**. Newly passing: **0**. - DXIL output changed: **25698** programs (12060 Ps, 8765 Ms, 2681 Cs, 2192 Vs); 25627 of them pass the validator, the other 71 failed it on `main` too (oversized mesh outputs). <details><summary>The 25698 changed programs by family</summary> - 488 × `MS_VS_Transform_PositionOnly` - 404 × `PS_LinearDepth` - 386 × `PS_DeferredTextured` - 372 × `MS_VS_Transform` - 368 × `PS_MirrorReflectionDeferredTextured` - 365 × `PS_CascadeShadows_fade` - 355 × `MSNC_VS_TransformSkin_PositionOnly` - 346 × `PS_MirrorReflectionTextured_Eight` - 346 × `PS_Textured_Eight` - 314 × `PS_VfxVBuffer_AlphaClip` - 310 × `PS_LinearDepthOpaque` - 296 × `PS_DeferredTextured_AlphaClip` - 295 × `PS_MirrorReflectionDeferredTextured_AlphaClip` - 294 × `PS_VfxVBuffer` - 294 × `PS_VoxelizeVisiblity` - 288 × `PS_PuddleDetect_Zero` - 274 × `MSNC_VS_TransformSkin` - 268 × `PS_AlphaPrepass` - 262 × `PS_EntityMask` - 260 × `MS_VS_MirrorReflectionTransform` - 252 × `MS_VS_CascadeShadows_draw` - 247 × `MS_VS_CascadeShadows_drawTexture` - 242 × `MS_VS_TransformD` - 242 × `PS_CascadeShadows_texture` - 239 × `PS_MirrorReflectionDeferredDecalTextured` - 235 × `MS_VS_LinearDepth` - 230 × `MSNC_VS_MirrorReflectionTransformSkin` - 226 × `MS_VS_MirrorReflectionTransformD` - 217 × `PS_AlphaTransmission` - 216 × `VS_Transform_VfxVBuffer_AlphaClip` - 214 × `MS_VS_TransformEntityMask` - 205 × `VS_Transform_VfxVBuffer` - 202 × `VS_TransformSkin_VfxVBuffer_AlphaClip` - 195 × `VS_TransformSkin_VfxVBuffer` - 195 × `VS_VoxelizeGeneric` - 192 × `MSNC_VS_TransformSkinD` - 181 × `MS_VS_TransformTransmission` - 176 × `MSNC_VS_LinearDepthSkin` - 176 × `MSNC_VS_MirrorReflectionTransformSkinD` - 176 × `MS_VS_TransformAlphaPrepass` - 174 × `MSNC_VS_TransformSkinEntityMask` - 166 × `MSNC_VS_CascadeShadows_drawskinnedTexture` - 152 × `MSNC_VS_CascadeShadows_drawskinned` - 146 × `MSNC_VS_TransformSkinTransmission` - 146 × `MSNC_VS_TransformSkin_AlphaPrepass` - 146 × `MS_VS_MirrorReflectionTransformDecalsD` - 129 × `MSNC_VS_MirrorReflectionTransformSkinDecalsD` - 109 × `PS_MirrorPedTextured_Eight` - 109 × `PS_PedAlphaPrepass` - 109 × `PS_PedTextured_Eight_Alpha` - 109 × `PS_StudioPedTextured_Eight` - 109 × `PS_TexturedDeferred` - 107 × `PS_PedAlphaPrepass_Decals` - 107 × `PS_PedTextured_Eight_Decals` - 99 × `MS_VS_TransformLit` - 96 × `MSNC_VS_PedTransformSkinAlpha` - 95 × `PS_TrailmapDeformData` - 88 × `MS_VS_TrailmapDeformData` - 83 × `MS_VS_TransformSkin_PositionOnly` - 83 × `PS_PedAlphaTransmission` - 83 × `PS_PedAlphaTransmission_Decals` - 82 × `MS_VS_PedTransformAlpha` - 82 × `PS_PuddleDetect` - 80 × `PS_MirrorReflectionTexturedDeferred` - 79 × `PS_CascadeShadows_texture_alpha` - 76 × `PS_TexturedLit_8` - 75 × `MSNC_VS_TrailmapDeformDataSkinned` - 72 × `PS_DeferredPedTexturedNC` - 71 × `PS_MirrorReflectionDeferredPedTexturedNC` - 70 × `PS_DeferredPedDecalTextured` - 69 × `PS_DeferredTextured_AlphaClipNC` - 69 × `PS_MirrorReflectionDeferredTextured_AlphaClipNC` - 65 × `MS_VS_CascadeShadows_PedTransformPreSkinD` - 59 × `PS_TexturedLit` - 58 × `MSR_VS_TransformSkin_PositionOnly` - 52 × `MSNC_VS_PedTransformSkinD_PositionOnly` - 52 × `PS_AlphaPrepass_Fire` - 51 × `MSNC_VS_PedTransformSkinEntityMaskD` - 51 × `MS_VS_PedTransformD_PositionOnly` - 50 × `PS_Textured_Eight_Fire` - 49 × `MSNC_VS_MirrorReflectionPedTransformSkin` - 49 × `MSNC_VS_PedTransformSkinTransmissionAlpha` - 48 × `MSNC_VS_PedTransformSkin_Decals` - 48 × `PS_AlphaTransmission_Fire` - 47 × `MSNC_VS_PedTransformSkinAlpha_Decals` - 47 × `MSNC_VS_PedTransformSkinTransmission_Decals` - 46 × `MS_VS_PedTransformPreSkinD_PositionOnly` - 46 × `PS_PedEntityMask` - 45 × `MS_VS_PedTransformEntityMask` - 45 × `PS_MirrorReflectionTexturedDeferredAlphaClipNC` - 45 × `PS_TexturedDeferredAlphaClipNC` - 45 × `VS_Passthrough` - 44 × `PS_PedEntityMaskD` - 43 × `MS_VS_LinearDepthPreSkin` - 43 × `PS_CascadeShadows_texture_fire` - 42 × `MSNC_VS_MirrorReflectionPedTransformSkinD` - 42 × `MSNC_VS_PedTransformSkinD` - 42 × `PS_PedTexturedCutOutTint_Zero` - 42 × `PS_TrailMapPropDeepSurfaceFlatten_UAV` - 41 × `MS_VS_MirrorReflectionPedTransform` - 41 × `MS_VS_PedTransformTransmissionAlpha` - 41 × `MS_VS_PedTransform_Decals` - 41 × `PS_LinearDepth_Fire` - 40 × `MSNC_VS_MirrorReflectionPedTransformSkinDecalsD` - 40 × `MS_VS_MirrorReflectionPedTransformD` - 40 × `MS_VS_PedTransformAlpha_Decals` - 40 × `MS_VS_PedTransformD` - 40 × `MS_VS_PedTransformTransmissionAlpha_Decals` - 40 × `PS_TrailMapPropGrassFlatten_UAV` - 39 × `MS_VS_MirrorReflectionPedTransformDecalsD` - 38 × `PS_AlphaPrepassSpatter` - 38 × `PS_AlphaTransmissionSpatter` - 37 × `MS_VS_PedTransformPreSkinD` - 37 × `PS_TwoLayerEntityMask` - 35 × `PS_AlphaPrepassSpatter_Fire` - 35 × `PS_AlphaTransmissionSpatter_Fire` - 35 × `PS_PropVehicleDeferred` - 35 × `PS_VehicleLiveryOffComplexDirtOffDeferred` - 35 × `PS_VehicleLiveryOffComplexDirtOffDetailMapsOffDeferred` - 35 × `PS_VehicleLiveryOffDetailMapsOffComplexDirtOffStickersOffFlakesOffDeferred` - 35 × `PS_VehicleLiveryOffDetailMapsOffDeferred` - 35 × `PS_VehicleLiveryOffOnlyDeferred` - 35 × `PS_VehicleLiveryOnDetailMapsOffDeferred` - 35 × `PS_VehicleVariationDeferred` - 35 × `VS_Blit` - 35 × `ptfx_PS` - 35 × `ptfx_PS_alphathreshold_mv_uvdistort` - 35 × `ptfx_PS_alphathreshold_mv_uvdistort_nolocallights` - 35 × `ptfx_PS_nolocallights` - 34 × `MS_VS_TransformTransmissionFire` - 34 × `MS_VS_Transform_Fire` - 33 × `MS_VS_Transform_Fire_AlphaPrepass` - 32 × `MSNC_VS_BakeDecorations` - 32 × `MSR_VS_TransformSkin` - 32 × `MS_VS_TransformSkin` - 32 × `PS_DeferredPedTexturedNC_Packed` - 31 × `PS_TexturedLit_ReflectionMap` - 28 × `MSNC_VS_TransformSkinTransmissionFire` - 28 × `MSNC_VS_TransformSkin_Fire` - 28 × `MSNC_VS_TransformSkin_Fire_AlphaPrepass` - 28 × `PS_BakeDecorations` - 26 × `PS_DeferredPedTextured_AlphaClipNC_Tint` - 26 × `VS_TransformPreSkin_VfxVBuffer` - 25 × `MSR_VS_MirrorReflectionTransformSkinD` - 25 × `MSR_VS_TransformSkinD` - 25 × `MS_VS_MirrorReflectionTransformSkinD` - 25 × `MS_VS_TransformSkinD` - 25 × `MS_VS_TransformSpatterAlphaPrepass` - 25 × `MS_VS_TransformTransmissionSpatter` - 25 × `PS_DeferredPedTextured_AlphaClip_Decal_Tint` </details> How: `victory translate <dump> --validate --list` built for each side (release, cross-built with cargo-xwin, run under Wine), `VICTORY_HOST_WAVE=32`, plus the four shader-cache-key settings `play` starts with (`VICTORY_EARLY_DEPTH=1`, `VICTORY_NAN_SCRUB=1`, `VICTORY_BVH_MISS=1`, `VICTORY_SAMPLED_MARKS=1`). Validator: `dxil.dll` from DXC v1.9.2609. "Changed" compares translate's `emitted` hash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. At the merge-base the same run has the same 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut in `mesh_prologue`) and `CS_TraceShadowRays_FullAdaptive` (#2993).
# Conflicts:
#	crates/victory-shader/src/emit/bitcode.rs
Author
Owner

@⁠HyperRamzey on GitHub · 2026-12-01 06:50 UTC · original

Thanks for running this — it is the regression signal we wanted, and it lines up with our local runs.

On the 25,698 changed programs. That is expected: Module::write now serialises unify_returns(split_returns(blocks)), so every function with more than one return has its return blocks restructured; only functions with no return or a single return are untouched. The number to read is the validity tally, not the hash churn: your run keeps the same 72 pre-existing failures (the 71 mesh programs over the 32 KiB output shortcut, plus CS_TraceShadowRays_FullAdaptive, #2993) and adds none.

On the merge conflict. The branch is now merged with current main (5fabb46e; merge eaec1641). The only conflict was crates/victory-shader/src/emit/bitcode.rs; the resolution keeps upstream's Predecessors latch-folding and select_operands alongside the split/unify work. cargo test -p victory-shader --lib: 345 passed, 0 failed, 2 ignored (Linux; Windows CI will confirm). main has moved on since your run — it is at 5fabb46e now.

The stock-Proton part got root-caused offline since your run. The old structuriser (pin 8434b06) fails our three remaining reproducers for two concrete reasons:

  1. place_phi_read builds the frontier phi from frontier->pred only; the assert(!frontier->pred_back_edge) above it is compiled out of release builds. A collector block that later becomes a loop header never receives its back-edge incoming, so 42683eebec081520 emits %frontier_phi_6_collector = OpPhi %uint … with three incoming values for four predecessors, and spirv-val rejects it.
  2. Patching that incoming in surfaces the next failure on the same container: OpLoopMerge immediately precedes OpSwitch. collect_and_dispatch_control_flow names the multi-way dispatcher (common_idom->name + ".collector") and assigns it as the loop merge block, so a switch dispatcher is emitted as a loop header.

Return shapes do not rescue them under this pin. As this PR emits them: invalid OpPhi on 42683eebec081520 and 54bcc8478432ba15, a hang on d3e5b737ea7cc150. A split-only shape (per-edge returns, no unify) turns 42683eebec081520 and d3e5b737ea7cc150 into invalid unstructured loop exits. That is why these three stay out of scope here and point at the rewrite.

Which shipped binaries carry the rewrite (fingerprint of the DLLs' strings and PE headers): vkd3d-1.1-5783-g71cae09 (CachyOS 11.0-20261129-nightly) is the rewritten one only; vkd3d-1.1-5742-g2576c0b4 (Proton Experimental) compiles both implementations; vkd3d-1.1-5656-g0bb64c5 (CachyOS Latest) is the old one only. The nightly's sibling vkd3d-low-latency DLL is still the old structuriser despite the same PE timestamp. So "stock Proton" depends on which vkd3d-proton version the build ships — the PR body now tracks that under the milestones.

**@⁠HyperRamzey** on GitHub · 2026-12-01 06:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3954#issuecomment-7303342597) Thanks for running this — it is the regression signal we wanted, and it lines up with our local runs. **On the 25,698 changed programs.** That is expected: `Module::write` now serialises `unify_returns(split_returns(blocks))`, so every function with more than one return has its return blocks restructured; only functions with no return or a single return are untouched. The number to read is the validity tally, not the hash churn: your run keeps the same 72 pre-existing failures (the 71 mesh programs over the 32 KiB output shortcut, plus `CS_TraceShadowRays_FullAdaptive`, #2993) and adds none. **On the merge conflict.** The branch is now merged with current `main` (`5fabb46e`; merge `eaec1641`). The only conflict was `crates/victory-shader/src/emit/bitcode.rs`; the resolution keeps upstream's `Predecessors` latch-folding and `select_operands` alongside the split/unify work. `cargo test -p victory-shader --lib`: 345 passed, 0 failed, 2 ignored (Linux; Windows CI will confirm). `main` has moved on since your run — it is at `5fabb46e` now. **The stock-Proton part got root-caused offline since your run.** The old structuriser (pin `8434b06`) fails our three remaining reproducers for two concrete reasons: 1. `place_phi_read` builds the frontier phi from `frontier->pred` only; the `assert(!frontier->pred_back_edge)` above it is compiled out of release builds. A collector block that later becomes a loop header never receives its back-edge incoming, so `42683eebec081520` emits `%frontier_phi_6_collector = OpPhi %uint …` with three incoming values for four predecessors, and `spirv-val` rejects it. 2. Patching that incoming in surfaces the next failure on the same container: `OpLoopMerge` immediately precedes `OpSwitch`. `collect_and_dispatch_control_flow` names the multi-way dispatcher (`common_idom->name + ".collector"`) and assigns it as the loop merge block, so a switch dispatcher is emitted as a loop header. **Return shapes do not rescue them under this pin.** As this PR emits them: invalid `OpPhi` on `42683eebec081520` and `54bcc8478432ba15`, a hang on `d3e5b737ea7cc150`. A split-only shape (per-edge returns, no unify) turns `42683eebec081520` and `d3e5b737ea7cc150` into invalid unstructured loop exits. That is why these three stay out of scope here and point at the rewrite. **Which shipped binaries carry the rewrite** (fingerprint of the DLLs' strings and PE headers): `vkd3d-1.1-5783-g71cae09` (CachyOS 11.0-20261129-nightly) is the rewritten one only; `vkd3d-1.1-5742-g2576c0b4` (Proton Experimental) compiles both implementations; `vkd3d-1.1-5656-g0bb64c5` (CachyOS Latest) is the old one only. The nightly's sibling `vkd3d-low-latency` DLL is still the old structuriser despite the same PE timestamp. So "stock Proton" depends on which vkd3d-proton version the build ships — the PR body now tracks that under the milestones.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/3954/head:github-bot/gh-3954'
git switch 'github-bot/gh-3954'

Merge

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