Repository navigation
Shaders: one latch per loop in emitted DXIL (dxil-spirv asserts on two back edges and stalls the pipeline workers under vkd3d-proton) - #257
Conversation
…several blocks got two back edges; vkd3d-proton's dxil-spirv asserts at cfg_structurizer.cpp:3492 on them, 505 shaders incl. world e4a9f58e3acfcf7b, 38e119267baa5fd9, db07933e964ee6d6) (cherry picked from commit 0226cdbbc77a159837061932acb966a9891d0bc8) (cherry picked from commit 20bc18f2869e5a85c38ca40887e01d832d0bb36f)
…ranches back to another loop's header (one block with two back edges asserts in dxil-spirv, cfg_structurizer.cpp:3486: CS_{Prop,Tree}_BatchNoCull, CS_{Prop,Tree}_BatchCullReflect); a block continuing two loops reaches all but one through a block of its own
(cherry picked from commit 4547046286ae5bef1a24f763c9496f03977a878d)
ErRusso
left a comment
There was a problem hiding this comment.
Reviewed at 39b17eb against 2119b0e.
The emitter now gives each loop one latch, redirecting multiple back edges through a latch block and joining the header's phis there. The extra via-block pass handles a block that continues two loops. The fold guard also prevents putting two back edges on one block.
Verified: emit::bitcode::tests::single_latches passes under Wine. The author's offline run over 505 title programs (none assert after, 505 before) and the live vkd3d-proton run are strong integration evidence.
Non-blocking: the unit test covers the main multiple-back-edge case but not the via-block path (a block continuing two loops). A second bitcode test for that shape would protect the first pass.
LGTM.
|
Tested on Linux with an RTX 4080, on top of c96b4f2 (plus local Linux patches that do not touch the emitter). For our set, both commits are needed: the second is what fixes fdd56d97a806bcca. Offline gate. 935 compute programs saved from one world run (compute only, so not the whole pack), translated for 32-lane waves as the runtime does on this card, then each run through dxil-spirv 114e664e (the version inside vkd3d-proton 2576c0b4a), built natively, Release:
In game (GE-Proton11-12's Wine, vkd3d-proton 2576c0b4a). Each failing program kills one pipeline worker ("has overflowed its stack"), and its pipeline is never built.
Not checked:
Environment: CachyOS, kernel 7.3.5, NVIDIA 620.73.04, RTX 4080; GE-Proton11-12 (Wine) with vkd3d-proton 2576c0b4a; offline dxil-spirv 114e664e. AI-assisted (Hermes). |
The single-latch test covered a header continued from several blocks. This one covers the other pass: a block with back edges to an inner and an outer header keeps one, the other goes through a block of its own, and that header's phis name the new block. Asked for in review of fxceless#257.
|
Thanks @ErRusso and @gingertonik.
I did not rebase, so the reviewed commits are unchanged; the head is AI-assisted (Claude Code); built and tested locally on CachyOS, Wine 11.22, RTX 5080. |
The single-latch test covered a header continued from several blocks. This one covers the other pass: a block with back edges to an inner and an outer header keeps one, the other goes through a block of its own, and that header's phis name the new block. Asked for in review of fxceless#257.
|
Thanks. One more data point for current main, at the conversion level rather than unit tests. On The tree I used carries local patches outside Still not checked here: an image comparison of the four programs the second commit changes, and an in-game run on the merged tree (next). Environment: CachyOS, kernel 7.3.5, NVIDIA 620.73.04, RTX 4080; offline dxil-spirv 114e664e. AI-assisted (Hermes). |
The single-latch test covered a header continued from several blocks. This one covers the other pass: a block with back edges to an inner and an outer header keeps one, the other goes through a block of its own, and that header's phis name the new block. Asked for in review of fxceless#257.
Changes
vkd3d-proton's dxil-spirv asserts on both shapes (
cfg_structurizer.cpp:3492and:3486). Under Wine the assert ends the thread, so each failing program takes one pipeline worker with it. On4e17478all eight workers were gone by world entry, and about 2,100 pipelines stayed "being made" for the rest of the run, with a black world frame.This is a different failure from the one #210 documents (a merge block without a terminator in the legacy structurizer), and it does not replace that note. Here the converter asserts instead of emitting invalid SPIR-V, and the emitter change avoids it.
Validation
f2963ee2), RTX 5080, driver 620.73.04.4e17478: 8_wasserthits on 8 threads, no host pipeline logged afterwards, 2,111 pipelines still pending three minutes later.:3492assert in standalone dxil-spirv before the first commit and none after; the second commit clears the four batch-cull compute programs that hit:3486.cargo clippy --workspace --all-targets --locked -- -D warningsfor the Windows target, with and without--all-features, andcargo test -p victory-shader -p xtaskpass on this branch (cross-compiled from Linux with the pinned toolchain). One unit test is added.AI-assisted patch with local build and runtime validation.