d3d12-shader: split dual-loop latches for dxil-spirv pre-passes (D3D12-LINUX-WARM-DXIL-RECURSION) #2686
Open
zmasi wants to merge 7 commits from
upstream-pr/2686 into main
pull from: upstream-pr/2686
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Reference
ProjectLeonida/mandy!2686
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2686"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T02:35:29Z.
Claimed in the coordination issue as: D3D12-LINUX-WARM-DXIL-RECURSION (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245)
What and why
Relates to #2621 (
leonida.exe warmoverflowing even a 64 MB stack inside VKD3D-Proton'sdxil-spirvconverter on translated compute pipelines before.spvemission).Root cause:
VKD3D-Proton 3.1 (
4522cc1a) embedsdxil-spirv(8b48f0e), whereCFGStructurizer::flatten_subgroup_shuffles()runsrecompute_cfg()on shaders with subgroup shuffles (such asWaveReadLaneAt) beforeCFGStructurizer::run()executesrewrite_multiple_back_edges()(also tracked upstream inHansKristian-Work/dxil-spirv#380). Wheneverleonida-shaderemits a conditional branch block whose two targets are distinct loop headers (rpo[t] <= rpo[b] && rpo[f] <= rpo[b]), an assertions-enabled build of pinneddxil-spirvaborts immediately at:In release VKD3D-Proton builds where assertions are compiled out,
entry.succ_back_edgeretains a cycle anddxil-spirv's recursive CFG traversal overflows any finite thread stack regardless of/STACKsize or RADV flags.Fix (
d3d12/crates/leonida-shader/src/emit/{bitcode.rs, mod.rs}):Module::split_multiple_back_edges/dual_back_edges(bitcode.rs):reverse_postorder) and identifies reachable conditional branches (Term::CondBr(_, t, f),t != f) whose targets are both backward edges (rpo[t] <= rpo[b] && rpo[f] <= rpo[b]), leaving unreachable blocks untouched and avoiding cloningModuleon the common single-latch path.Term::Br(header)) and updates incoming predecessors inheader's PHI nodes.folded_empty_latches,bitcode.rs):lower.rsemits separate empty latch blocks (body: CondBr(c, l1, l2)withl1: Br(inner), l2: Br(outer)orbody: CondBr(c, inner, l2)withl2: Br(outer)),folded_empty_latchesskips folding a back-edge latch into itsCondBrpredecessor whenever the other arm (directly or through an already-folded latch) also branches backward, preserving single-loop empty-latch folding for AMD divergent loops while keeping outer back edges in dedicated blocks.Tested
AMD Radeon Pro Vega II,gfx906):waveReadLaneAtDXIL hitcfg_structurizer.cpp:3452(!entry.succ_back_edge || entry.succ_back_edge == succ) in pinneddxil-spirv.dxil-spirvconverts the DXIL cleanly to SPIR-V (1,656bytes), and the Windows x64 test binary under Wine 11.0 + VKD3D-Proton 3.1 + Mesa 26.0.8 (RADV VEGA20) creates the D3D12 compute PSO, dispatches on GPU, and reads back the expected UAV result. (Only synthetic shaders were used; no retail shader corpus orknown-pipelines.binwas run.)dxil.dllvalidator:cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --features host --lib dual_backedge_wave_read_compiles_and_dispatches -- --exact-> passed DXIL validation and GPU dispatch (out[0][0] == 0x1234) on RTX 3090, RTX 3090 withLEONIDA_D3D12_DEBUG=1(0debug-layer errors), andLEONIDA_D3D12_WARP=1.cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::bitcode::tests->10/10passed (covering dual-back-edge splitting, unreachableCondBrnon-splitting, and Shapes A & B empty-latch non-refolding).cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --features host --lib -- --test-threads=4and--lib->375/375passed.cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-shader --all-targets(default and--features host) ->0warnings in touched code;python -I scripts/check_no_game_data.py->0issues.GPUs tested: AMD Radeon Pro Vega II (Mesa 26.0.8 RADV
gfx906, Wine 11.0 + VKD3D-Proton 3.1 on Linux), NVIDIA GeForce RTX 3090 (driver 610.88, Windows 11 Pro 26200), and Microsoft WARPAI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a:d3d12/crates/leonida-shaderDXIL bitcode preparation;docs/design.mdcoverstools/rdna2spirv.py)Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T02:39:33Z.
Checked by OreoFR on macOS 27.2.1, Apple M5, Rust 1.98.1,
cargo test -p leonida-shader, main182d0c174, PR head874019914. MEASURED, partial:an_ordinary_conditional_latch_keeps_its_layoutanddual_latches_are_given_dedicated_back_edgesinemit/bitcode.rs.dual_backedge_wave_read_compiles_and_dispatchesand the other#[cfg(windows)]cases inemit/mod.rs(need Windows,dxil.dlland a GPU).AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T07:09:39Z.
Windows numbers for the part I could not run on macOS, measured by mooneyes-agent (MoonEyes's agent) and relayed here with their OK: Windows 11,
d3d12/rust-toolchain.toml, CPU only, main1d22590b9+ this PR (head874019914, merge without commit). MEASURED:cargo test -p leonida-shader: main 370 ok, main + this PR 375 ok, 0 failed; the 5 newemit/bitcode.rstests pass on Windows too (they passed on macOS, 224 → 229, in my comment above).cfg(windows)dispatch test needingdxil.dlland a GPU, and a red.AI-assisted: Claude Code
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T07:29:39Z.
Independent GPU check of
874019914on GitHub mergece9044270(base182d0c174). MEASURED on CachyOS with Wine 11.22 and VKD3D-Proton 3.1.0 (0bb64c56c8f0dcc).dual_backedge_wave_read_compiles_and_dispatches, and read back0x1234.leonida-shader --libsuite passed 229 tests, with two ignored.This covers the live GPU dispatch on two Wine/VKD3D backends. The Windows SDK DXIL validator was unavailable in this environment. The inputs were entirely synthetic.
AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T16:19:06Z.
Independent check on Windows (not the author), at
874019914.cargo test --locked -p leonida-shader --lib(shared warm target): 375 passed, 0 failed, 4 ignored in 233 s.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned.
The branch is based on older
main, so the test count is lower than currentmain's 386; no failures in the emit/bitcode paths this touches.AI-assisted: yes (opencode).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:24:29Z.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:35:28Z.
Ran natively on Windows 11, head
337bc1a7dmerged into currentmain(d0bf821fa, no commit), fromd3d12/with the pinned toolchain and--locked. The comments above are all on874019914. This is the current head.The merge does not build its tests on Windows.
git mergereports no conflict, butcargo test -p leonida-shader --libstops with:mainaddedHostShader::ray_queriesin3fdfbaa46(hardware ray tracing), and that commit is not in this branch. The literal indual_backedge_wave_read_compiles_and_dispatchessits behind#[cfg(windows)], so a Linux or macOS build does not see it. The Windows CI job on this head is green. I could not check whichmainits merge ref used;3fdfbaa46may have landed after that run. One line fixes it:ray_queries: Default::default(),afterhalf_views. I added that line locally for everything below.Suite on the merge (with that line)
cargo test -p leonida-shader --libvalu_tests::host_forms_give_what_the_spelled_out_ones_givewith "dispatch failed: Not enough memory resources" while other builds were using the card. Run again alone, it passes.cargo clippy -p leonida-shader --all-targetsvalu_tests.rs, none inbitcode.rsormod.rscargo test -p leonida-shader --lib -- emit::bitcode::tests dual_backedge --nocaptureRed on Windows: none, as expected. I put
main'sbitcode.rsback and kept this PR'smod.rstest.dual_backedge_wave_read_compiles_and_dispatchesstill passes. It skips both its validator and its dispatch onErr, but my probe shapes in the same run loaded the validator, which accepted the dual-back-edge DXIL, created the device and read back the right values. Native D3D12 takes the dual back edge, so this test cannot tell the fix frommainon Windows. It follows (I did not run this mutation) that ifModule::write()skipped the split and calledwrite_prepared()directly, no test would fail on Windows. The new unit tests call the helpers (split_multiple_back_edges,cfg_layout), andwritten_bytes_unchangedcallswrite()only on modules without the shape. The wiring is covered only by the Linux/VKD3D runs.Does the lowering emit the shape today? I added a throwaway check after the block layout in the bitcode writer. It counts emitted blocks whose conditional branch has two distinct backward targets, after empty-latch folding. Then I ran the whole lib suite with
main's writer:main's writer, whole lib suite (430 tests, including this PR's test and my probe)No fixture that goes through the translator produces the shape. The split and the folding guard both act only where
main's output would have a dual back edge, so every other module should be written byte for byte as before (I did not diff the bytes).written_bytes_unchangedpasses. Whether translated game shaders reach the shape is only shown by the Linux runs and #2621.Extra shapes (throwaway, built like the PR's test with
waveReadLaneAtin the inner loop, a known result stored to the UAV). Each was checked by thedxil.dllvalidator, dumped withdxc -dumpbin, and dispatched on the card, on WARP (Host::new(true)), and on the card again withLEONIDA_D3D12_DEBUG=1, whichHost::newreads without any feature gate.mainemittedCondBr(c, inner, outer)(the PR's order)0x1009on all threeCondBr(c, outer, inner)0x1009CondBr(c, inner, outer)br i1 %17, label %9, label %3)0x1009CondBr(c, middle, outer)0x1012No debug-layer message was printed. A note on the swapped case:
dual_back_edgesalways moves the false arm to the new block, so there the inner loop's back edge goes through the dedicated block and the outer one stays on the conditional branch. The PR's order is the reverse. In both orders one loop ends up with an unfolded empty latch. The results were correct everywhere I ran them; I have no AMD run of either order.Side effect:
Module::default().write()(no blocks) panics onmainand returns 560 bytes here. I only sawModule::default()used in tests.Not checked: the two failing checks on this head (
check,linux-python-and-viewer), which I did not open;--features diagnostics; any Linux / VKD3D-Proton /dxil-spirvrun (the actual bug); AMD hardware; an in-game run on this head, which the maintainer asked for above; translated game shaders.GPUs tested: one NVIDIA desktop card + WARP.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:13:01Z.
Checked #2686: the Rust change was reviewed, not built (Windows-only crate path), and the red
linux-python-and-viewerjob is a real defect of this branch:d3d12/docs/switches.mddoes not list the newLEONIDA_SYNTHETIC_DXIL_FILE.337bc1a7dfmain45dc41f95cgit merge-tree); merge based741a9f8f6, 291 commits behindlinux-python-and-viewerandcheckfailed (tests/test_d3d12_switches.py);d3d12 (windows-latest)passedRan (Linux, Python 3.13.18, on an export of the merge tree in its own git repository so
git ls-filesworks)The same check on
mainalone and on #3072 / #2851 merged onto the samemainpasses, so the failure comes from this branch:d3d12/crates/leonida-shader/src/emit/mod.rs(new test) readsstd::env::var_os("LEONIDA_SYNTHETIC_DXIL_FILE"). Fix:python -I tools/d3d12_switches.py --out d3d12/docs/switches.mdon a merge with currentmainand commit the page (the generator puts a test-only name under "Only in tests").Review (not built here)
Module::split_multiple_back_edgesfinds reachableCondBrblocks whose two targets are both back edges in reverse postorder and gives one of them its own latch, sodxil-spirv'sflatten_subgroup_shuffles -> recompute_cfgnever sees a block with two back-edge successors. That matches the assertion quoted in the description (cfg_structurizer.cpp:3452).d0bf821fa) are on this head or its parent and agree.Verdict: blocked-CI. One regenerated file fixes CI; then it still needs the requested in-game run.
AI-assisted: Claude Opus 5.5 (Claude Code), verification only.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-02T18:36:48Z.
Thanks @Kal0s-design and @MoonEyes for catching both post-merge issues! Merged
origin/main(45dc41f95) and pushed4ce7951275:emit/mod.rstest compile fix (ray_queries): initializedray_queries: Default::default()indual_backedge_wave_read_compiles_and_dispatches'sHostShaderliteral (433 passed, 0 failed, 6 ignoredincargo test --locked --target x86_64-pc-windows-msvc -p leonida-shader --lib).d3d12/docs/switches.md(LEONIDA_SYNTHETIC_DXIL_FILE): regenerated viapython -I tools/d3d12_switches.py --out d3d12/docs/switches.md(tools/d3d12_switches.py --checkexit 0,tests/test_d3d12_switches.py20/20OK).Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:40:05Z.
RUN (independent run on Windows, head
4ce795127570bd56135f879fe6d61b92b905126f, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)Windows 11, pinned toolchain (Rust 1.98.1),
--release --locked, CPU/native D3D12 only. The merge had no conflict (merge commit1861cdda8, local only). The PR touchesleonida-shader(emit/bitcode.rs,emit/mod.rs) andd3d12/docs/switches.md; it does not touchleonida-gpuor any diagnostics code.Green
cargo test -p leonida-shader --release --locked --libcargo test ... -- emit::bitcode::tests dual_backedgepython -I tools/d3d12_switches.py --check d3d12/docs/switches.mdpython -I tests/test_d3d12_switches.pypython -I scripts/check_no_game_data.pyon the 3 changed filesThe
ray_queriescompile error and the missingLEONIDA_SYNTHETIC_DXIL_FILEentry reported on the previous head are both fixed on this head.cargo test -p leonida-gpuwas not run: the PR changes nothing it uses.Red
The 5 new tests (4 in
emit/bitcode.rs, 1 inemit/mod.rs) sit in the same files as the change, so restoring main's version of the files removes the tests instead of failing them. I mutated the new code instead (each mutation reverted withgit checkout HEAD -- <file>):dual_back_edgesnever reports a dual latch (rpo[f] <= rpo[b]replaced byfalse)dual_latches_are_given_dedicated_back_edges. NOT killed bydual_backedge_wave_read_compiles_and_dispatches(it passes on native Windows D3D12, which accepts the unsplit CFG)split_back_edgesno longer rewrites the header PHI predecessordual_latches_are_given_dedicated_back_edgesand bydual_backedge_wave_read_compiles_and_dispatches(the DXIL validator rejects the module)folded_empty_latchesalways folds (thewould_make_dualguard off)empty_latches_do_not_refold_into_dual_back_edgesanddual_latches_are_given_dedicated_back_edgesNo mutation survived. The original failure (the pinned
dxil-spirvassertion and stack overflow under Wine/VKD3D-Proton) cannot be reproduced on native Windows, so the red for the bug itself is the author's Linux report plus merzleckeier's Wine run, not mine.Review
an_ordinary_conditional_latch_keeps_its_layoutcovers that shape only.write()computes the split on the reachable reverse postorder beforewrite_prepared; new blocks are appended, so indices recorded before the loop stay valid when several latches split. PHI predecessors of the header are rewritten to the new block. Unreachable blocks are ignored (own test).folded_empty_latchesnow leaves some empty latches unfolded that main folds. The old comment says the folding exists because the AMD driver hangs on divergent loops without it. The PR does not count how many corpus shaders change layout, and does not show that a divergent dual-latch loop still behaves on an AMD card. This is the main risk.d3d12/docs/switches.md: regenerated, one test-only name added under "Only in tests". The check passes.D3D12-LINUX-WARM-DXIL-RECURSIONis claimed in the coordination issue 2570 (comment by the author); the PR body links it and relates to 2621.emit/bitcode.rsoremit/mod.rsexist (3126, 2661, 3197, 2834, 3128, 2580, 2698, 2958); a text conflict with this head is absent on currentmain, but I did not merge them together.Not covered
leonida-gputests,--features diagnostics, clippy.dual_backedge_wave_read_compiles_and_dispatchesran here: the test skips it silently when no device or validator loads, and I did not check which happened.Verdict
PARTIAL. The translator suite is green on this head, the new tests catch 3 of 3 targeted mutations, and the earlier CI defects are fixed. In-game run still required: none is posted on this head, and the change alters the bitcode of every shader with a dual latch on every platform.
AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:17Z.
RUN (in game, gate-style): head
4ce795127tested in a batch of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order withgit merge --no-ffontomainf3865cae8. One conflict, in the credit table ofd3d12/README.mdwhen #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine:d3d12/docs/switches.md(#2686, #3119, #3154) andd3d12/README.md(#2588, #3119). Built withdiagnostics,mimalloc, targetx86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).Launcher defaults except
-PrecompileUsed, Series S settings,-NoDlss -NoFrameGen, standing at the save. On thismainthe launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use-PrecompileUsed(the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world:Warnings: only kinds that a run on the same
mainwith another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally.This pull request's own lines: it changes the translator, so the warm-up translated every shader again (25,687 in the cache, 202 that do not translate, the same count as every other build on this PC). No pipeline was refused in the measured run. The dxil-spirv recursion it avoids is a Linux/VKD3D-Proton case and is not reached on Windows.
Verdict: PASS for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here:
-RayTracing, DLSS and frame generation, other GPUs, Wine/Proton.AI-assisted: Claude Code (Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:29:40Z.
VERIFY-2686 — 433 tests del shader en verde (8 minutos), y el cambio es un split de latches
El título: «split dual-loop latches for dxil-spv pre-passes» — separar los latches de un bucle doble para los pases previos de dxil-spirv.
Y el doc de
switches.mdcambia con él, que en este repositorio es la señal de que un cambio de emisión altera lo que el jugador puede encender: un interruptor nuevo o una descripción que dejaba de ser cierta.Lo que el cambio hace, sin entrar en el emisor: un bucle con dos latches (uno para el cuerpo, otro para la salida) se emite de una forma que el pase previo de
dxil-spirvno reconoce como bucle, así que se separa en la forma que sí reconoce. Es la misma familia que#2800(cadenas canónicas) y#2698(mad_legacy): el emisor produce algo correcto que otra herramienta no sabe leer, y el arreglo es hablar su dialecto.Lo que verifiqué: 433 tests del crate con el cambio, 480 segundos, la suite más grande de la noche.
Lo que no: que
dxil-spirvreconozca el bucle después — eso es otra herramienta, y lo que el test puede comprobar es la forma emitida, no que el consumidor la acepte. Si el autor lo probó con el traductor de verdad, el número de shaders que antes fallaban y ahora no es la mitad que falta en el comentario.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-03T11:25:04Z.
Merged
origin/main(6e97990505,#3318) intoc5269801b9strictly to regenerated3d12/docs/switches.md(needs rebase); both Rust files (emit/bitcode.rsandemit/mod.rs) have byte-identical diffs againstorigin/maincompared to4ce7951275.AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T14:31:55Z.
RUN (in game, third party, batch of five pull requests), each head merged with
git merge --no-ffonto mainb053a1813, in one build: #2686c5269801b, #26432e0b23a00, #27894cd9d71f8, #30720f1e26355, #299991537d2af. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.6 fps on other runs today: a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. #2834 was left out of the batch (it conflicts with the others).
Limits: one run; arrival in the world was driven by keys and not checked on pictures. The precompile took 589 s (the batch changes shader code, so the pipeline cache was cold). Switches that are off by default were not turned on: this run covers their default path only.
AI-assisted (Claude Code, Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.