d3d12-shader: split dual-loop latches for dxil-spirv pre-passes (D3D12-LINUX-WARM-DXIL-RECURSION) #2686
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2686:github-pr/2686" git switch "github-pr/2686"
Open
leonida/mandy
zmasi wants to merge 7 commits from
github-pr/2686 into main
pull from: github-pr/2686
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2686
Loading…
Reference in a new issue
No description provided.
Delete branch "github-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?
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
Reviewers 0 approvals
Details
This pull request has changes conflicting with the target branch.
Merge manually to resolve the conflicts.
d3d12/crates/leonida-shader/src/emit/mod.rsView 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.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)Checked by OreoFR on macOS 27.2.1, Apple M5, Rust 1.98.1,
cargo test -p leonida-shader, main 182d0c174, PR head 874019914. 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
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, main 1d22590b9 + this PR (head 874019914, 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
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.
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).
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).
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).
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
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).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.
RUN (in game, gate-style): head 4ce795127 tested 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 with
git 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)
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.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).
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).