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
zmasi commented 2026-11-30 02:35:29 +00:00 (Migrated from github.com)

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 warm overflowing even a 64 MB stack inside VKD3D-Proton's dxil-spirv converter on translated compute pipelines before .spv emission).

Root cause:
VKD3D-Proton 3.1 (4522cc1a) embeds dxil-spirv (8b48f0e), where CFGStructurizer::flatten_subgroup_shuffles() runs recompute_cfg() on shaders with subgroup shuffles (such as WaveReadLaneAt) before CFGStructurizer::run() executes rewrite_multiple_back_edges() (also tracked upstream in HansKristian-Work/dxil-spirv#380). Whenever leonida-shader emits a conditional branch block whose two targets are distinct loop headers (rpo[t] <= rpo[b] && rpo[f] <= rpo[b]), an assertions-enabled build of pinned dxil-spirv aborts immediately at:

dxil_spv::CFGStructurizer::visit
  !entry.succ_back_edge || entry.succ_back_edge == succ
  cfg_structurizer.cpp:3452
<- CFGStructurizer::recompute_cfg
<- CFGStructurizer::flatten_subgroup_shuffles
<- Converter::Impl::convert_entry_point
<- dxil_spv_converter_run

In release VKD3D-Proton builds where assertions are compiled out, entry.succ_back_edge retains a cycle and dxil-spirv's recursive CFG traversal overflows any finite thread stack regardless of /STACK size or RADV flags.

Fix (d3d12/crates/leonida-shader/src/emit/{bitcode.rs, mod.rs}):

  1. Module::split_multiple_back_edges / dual_back_edges (bitcode.rs):
    • Computes reachable reverse postorder (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 cloning Module on the common single-latch path.
    • Splits the outer back edge into a dedicated unconditional branch block (Term::Br(header)) and updates incoming predecessors in header's PHI nodes.
  2. Prevent empty-latch folding from re-forming dual back edges (folded_empty_latches, bitcode.rs):
    • When lower.rs emits separate empty latch blocks (body: CondBr(c, l1, l2) with l1: Br(inner), l2: Br(outer) or body: CondBr(c, inner, l2) with l2: Br(outer)), folded_empty_latches skips folding a back-edge latch into its CondBr predecessor 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

  • Red -> Green on Linux + Wine + VKD3D-Proton 3.1 + RADV (AMD Radeon Pro Vega II, gfx906):
    • Before the fix, synthetic dual-back-edge + waveReadLaneAt DXIL hit cfg_structurizer.cpp:3452 (!entry.succ_back_edge || entry.succ_back_edge == succ) in pinned dxil-spirv.
    • After the fix, pinned VKD3D-Proton 3.1 dxil-spirv converts the DXIL cleanly to SPIR-V (1,656 bytes), 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 or known-pipelines.bin was run.)
  • Windows 11 + NVIDIA GeForce RTX 3090 D3D12 + Microsoft WARP + Windows SDK dxil.dll validator:
    • 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 with LEONIDA_D3D12_DEBUG=1 (0 debug-layer errors), and LEONIDA_D3D12_WARP=1.
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::bitcode::tests -> 10/10 passed (covering dual-back-edge splitting, unreachable CondBr non-splitting, and Shapes A & B empty-latch non-refolding).
    • cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --features host --lib -- --test-threads=4 and --lib -> 375/375 passed.
    • cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-shader --all-targets (default and --features host) -> 0 warnings in touched code; python -I scripts/check_no_game_data.py -> 0 issues.

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 WARP

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: d3d12/crates/leonida-shader DXIL bitcode preparation; docs/design.md covers tools/rdna2spirv.py)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5557953221 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686). Originally posted by [zmasi](https://github.com/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 warm` overflowing even a 64 MB stack inside VKD3D-Proton's `dxil-spirv` converter on translated compute pipelines before `.spv` emission). **Root cause:** VKD3D-Proton 3.1 (`4522cc1a`) embeds `dxil-spirv` (`8b48f0e`), where `CFGStructurizer::flatten_subgroup_shuffles()` runs `recompute_cfg()` on shaders with subgroup shuffles (such as `WaveReadLaneAt`) *before* `CFGStructurizer::run()` executes `rewrite_multiple_back_edges()` (also tracked upstream in `HansKristian-Work/dxil-spirv#380`). Whenever `leonida-shader` emits a conditional branch block whose two targets are distinct loop headers (`rpo[t] <= rpo[b] && rpo[f] <= rpo[b]`), an assertions-enabled build of pinned `dxil-spirv` aborts immediately at: ```text dxil_spv::CFGStructurizer::visit !entry.succ_back_edge || entry.succ_back_edge == succ cfg_structurizer.cpp:3452 <- CFGStructurizer::recompute_cfg <- CFGStructurizer::flatten_subgroup_shuffles <- Converter::Impl::convert_entry_point <- dxil_spv_converter_run ``` In release VKD3D-Proton builds where assertions are compiled out, `entry.succ_back_edge` retains a cycle and `dxil-spirv`'s recursive CFG traversal overflows any finite thread stack regardless of `/STACK` size or RADV flags. **Fix (`d3d12/crates/leonida-shader/src/emit/{bitcode.rs, mod.rs}`):** 1. **`Module::split_multiple_back_edges` / `dual_back_edges` (`bitcode.rs`)**: - Computes reachable reverse postorder (`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 cloning `Module` on the common single-latch path. - Splits the outer back edge into a dedicated unconditional branch block (`Term::Br(header)`) and updates incoming predecessors in `header`'s PHI nodes. 2. **Prevent empty-latch folding from re-forming dual back edges (`folded_empty_latches`, `bitcode.rs`)**: - When `lower.rs` emits separate empty latch blocks (`body: CondBr(c, l1, l2)` with `l1: Br(inner), l2: Br(outer)` or `body: CondBr(c, inner, l2)` with `l2: Br(outer)`), `folded_empty_latches` skips folding a back-edge latch into its `CondBr` predecessor 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 - **Red -> Green on Linux + Wine + VKD3D-Proton 3.1 + RADV (`AMD Radeon Pro Vega II`, `gfx906`)**: - Before the fix, synthetic dual-back-edge + `waveReadLaneAt` DXIL hit `cfg_structurizer.cpp:3452` (`!entry.succ_back_edge || entry.succ_back_edge == succ`) in pinned `dxil-spirv`. - After the fix, pinned VKD3D-Proton 3.1 `dxil-spirv` converts the DXIL cleanly to SPIR-V (`1,656` bytes), 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 or `known-pipelines.bin` was run.) - **Windows 11 + NVIDIA GeForce RTX 3090 D3D12 + Microsoft WARP + Windows SDK `dxil.dll` validator**: - `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 with `LEONIDA_D3D12_DEBUG=1` (`0` debug-layer errors), and `LEONIDA_D3D12_WARP=1`. - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --lib emit::bitcode::tests` -> `10/10` passed (covering dual-back-edge splitting, unreachable `CondBr` non-splitting, and Shapes A & B empty-latch non-refolding). - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-shader --features host --lib -- --test-threads=4` and `--lib` -> `375/375` passed. - `cargo clippy --manifest-path d3d12/Cargo.toml -p leonida-shader --all-targets` (default and `--features host`) -> `0` warnings in touched code; `python -I scripts/check_no_game_data.py` -> `0` issues. 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 WARP AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: `d3d12/crates/leonida-shader` DXIL bitcode preparation; `docs/design.md` covers `tools/rdna2spirv.py`)
OreoFR commented 2026-11-30 02:39:33 +00:00 (Migrated from github.com)

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, main 182d0c174, PR head 874019914. MEASURED, partial:

  • main: 224 passed / 2 ignored; main + this PR: 229 passed / 2 ignored. The 5 new host-independent tests pass, including an_ordinary_conditional_latch_keeps_its_layout and dual_latches_are_given_dedicated_back_edges in emit/bitcode.rs.
  • No red: those tests live in the same file as the change, so I could not run them against main's code.
  • Not covered: dual_backedge_wave_read_compiles_and_dispatches and the other #[cfg(windows)] cases in emit/mod.rs (need Windows, dxil.dll and a GPU).
  • Merges cleanly with main and with #2566.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7267198484 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7267198484). Originally posted by [OreoFR](https://github.com/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`, main 182d0c174, PR head 874019914. MEASURED, partial: - main: 224 passed / 2 ignored; main + this PR: **229 passed / 2 ignored**. The 5 new host-independent tests pass, including `an_ordinary_conditional_latch_keeps_its_layout` and `dual_latches_are_given_dedicated_back_edges` in `emit/bitcode.rs`. - No red: those tests live in the same file as the change, so I could not run them against main's code. - Not covered: `dual_backedge_wave_read_compiles_and_dispatches` and the other `#[cfg(windows)]` cases in `emit/mod.rs` (need Windows, `dxil.dll` and a GPU). - Merges cleanly with main and with #2566. AI-assisted: Claude Code
OreoFR commented 2026-11-30 07:09:39 +00:00 (Migrated from github.com)

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, 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 new emit/bitcode.rs tests pass on Windows too (they passed on macOS, 224 → 229, in my comment above).
  • clippy: 5 warnings on both sides, none added.
  • Not covered: the cfg(windows) dispatch test needing dxil.dll and a GPU, and a red.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7271421498 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7271421498). Originally posted by [OreoFR](https://github.com/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, 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 new `emit/bitcode.rs` tests pass on Windows too (they passed on macOS, 224 → 229, in my comment above). - clippy: 5 warnings on both sides, none added. - Not covered: the `cfg(windows)` dispatch test needing `dxil.dll` and a GPU, and a red. AI-assisted: Claude Code
merzleckeier commented 2026-11-30 07:29:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T07:29:39Z.


Independent GPU check of 874019914 on GitHub merge ce9044270 (base 182d0c174). MEASURED on CachyOS with Wine 11.22 and VKD3D-Proton 3.1.0 (0bb64c56c8f0dcc).

  • NVIDIA GeForce RTX 4070 SUPER (620.73.04) and AMD Radeon 610M / Raphael (RADV 26.3.1) each created the D3D12 compute PSO, dispatched dual_backedge_wave_read_compiles_and_dispatches, and read back 0x1234.
  • I used a local test-only change to make device creation mandatory and log the readback. The shader and the PR's implementation were unchanged. The stock native leonida-shader --lib suite 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7271794519 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7271794519). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T07:29:39Z. --- Independent GPU check of `874019914` on GitHub merge `ce9044270` (base `182d0c174`). **MEASURED** on CachyOS with Wine 11.22 and VKD3D-Proton 3.1.0 (`0bb64c56c8f0dcc`). - NVIDIA GeForce RTX 4070 SUPER (620.73.04) and AMD Radeon 610M / Raphael (RADV 26.3.1) each created the D3D12 compute PSO, dispatched `dual_backedge_wave_read_compiles_and_dispatches`, and read back `0x1234`. - I used a local test-only change to make device creation mandatory and log the readback. The shader and the PR's implementation were unchanged. The stock native `leonida-shader --lib` suite 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.
KelboLive commented 2026-11-30 16:19:06 +00:00 (Migrated from github.com)

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 current main's 386; no failures in the emit/bitcode paths this touches.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7284470209 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7284470209). Originally posted by [KelboLive](https://github.com/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 current `main`'s 386; no failures in the emit/bitcode paths this touches. AI-assisted: yes (opencode).
MoonEyes commented 2026-12-02 12:24:29 +00:00 (Migrated from github.com)

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:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone 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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345292894 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7345292894). Originally posted by [MoonEyes](https://github.com/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`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone 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).
Kal0s-design commented 2026-12-02 14:35:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:35:28Z.


Ran natively on Windows 11, head 337bc1a7d merged into current main (d0bf821fa, no commit), from d3d12/ with the pinned toolchain and --locked. The comments above are all on 874019914. This is the current head.

The merge does not build its tests on Windows. git merge reports no conflict, but cargo test -p leonida-shader --lib stops with:

error[E0063]: missing field `ray_queries` in initializer of `emit::HostShader`
    --> crates\leonida-shader\src\emit\mod.rs:1968:22

main added HostShader::ray_queries in 3fdfbaa46 (hardware ray tracing), and that commit is not in this branch. The literal in dual_backedge_wave_read_compiles_and_dispatches sits 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 which main its merge ref used; 3fdfbaa46 may have landed after that run. One line fixes it: ray_queries: Default::default(), after half_views. I added that line locally for everything below.

Suite on the merge (with that line)

result
cargo test -p leonida-shader --lib 432 passed, 1 failed, 6 ignored. The failure was valu_tests::host_forms_give_what_the_spelled_out_ones_give with "dispatch failed: Not enough memory resources" while other builds were using the card. Run again alone, it passes.
cargo clippy -p leonida-shader --all-targets 6 warnings, all in valu_tests.rs, none in bitcode.rs or mod.rs
cargo test -p leonida-shader --lib -- emit::bitcode::tests dual_backedge --nocapture 11 passed, 1 ignored (the bench)

Red on Windows: none, as expected. I put main's bitcode.rs back and kept this PR's mod.rs test. dual_backedge_wave_read_compiles_and_dispatches still passes. It skips both its validator and its dispatch on Err, 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 from main on Windows. It follows (I did not run this mutation) that if Module::write() skipped the split and called write_prepared() directly, no test would fail on Windows. The new unit tests call the helpers (split_multiple_back_edges, cfg_layout), and written_bytes_unchanged calls write() 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:

modules written with a dual back edge
main's writer, whole lib suite (430 tests, including this PR's test and my probe) 5,482 5: this PR's synthetic test and my 4 synthetic shapes below
this PR's writer, those 5 synthetic modules 5 0

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_unchanged passes. 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 waveReadLaneAt in the inner loop, a known result stored to the UAV). Each was checked by the dxil.dll validator, dumped with dxc -dumpbin, and dispatched on the card, on WARP (Host::new(true)), and on the card again with LEONIDA_D3D12_DEBUG=1, which Host::new reads without any feature gate.

shape main emitted this PR emitted validator card / WARP / card with debug layer
latch CondBr(c, inner, outer) (the PR's order) dual latch → inner or a new block → outer accepted 0x1009 on all three
arms swapped, CondBr(c, outer, inner) dual latch → outer or a new block → inner accepted 0x1009
inner header is its own latch, CondBr(c, inner, outer) dual (br i1 %17, label %9, label %3) self edge kept, outer through a new block accepted 0x1009
three levels, a middle block CondBr(c, middle, outer) dual split accepted 0x1012

No debug-layer message was printed. A note on the swapped case: dual_back_edges always 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 on main and returns 560 bytes here. I only saw Module::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-spirv run (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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7348804573 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7348804573). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T14:35:28Z. --- Ran natively on Windows 11, head `337bc1a7d` merged into current `main` (`d0bf821fa`, no commit), from `d3d12/` with the pinned toolchain and `--locked`. The comments above are all on `874019914`. This is the current head. **The merge does not build its tests on Windows.** `git merge` reports no conflict, but `cargo test -p leonida-shader --lib` stops with: ```text error[E0063]: missing field `ray_queries` in initializer of `emit::HostShader` --> crates\leonida-shader\src\emit\mod.rs:1968:22 ``` `main` added `HostShader::ray_queries` in `3fdfbaa46` (hardware ray tracing), and that commit is not in this branch. The literal in `dual_backedge_wave_read_compiles_and_dispatches` sits 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 which `main` its merge ref used; `3fdfbaa46` may have landed after that run. One line fixes it: `ray_queries: Default::default(),` after `half_views`. I added that line locally for everything below. **Suite on the merge (with that line)** | | result | |---|---| | `cargo test -p leonida-shader --lib` | 432 passed, 1 failed, 6 ignored. The failure was `valu_tests::host_forms_give_what_the_spelled_out_ones_give` with "dispatch failed: Not enough memory resources" while other builds were using the card. Run again alone, it passes. | | `cargo clippy -p leonida-shader --all-targets` | 6 warnings, all in `valu_tests.rs`, none in `bitcode.rs` or `mod.rs` | | `cargo test -p leonida-shader --lib -- emit::bitcode::tests dual_backedge --nocapture` | 11 passed, 1 ignored (the bench) | **Red on Windows: none, as expected.** I put `main`'s `bitcode.rs` back and kept this PR's `mod.rs` test. `dual_backedge_wave_read_compiles_and_dispatches` still passes. It skips both its validator and its dispatch on `Err`, 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 from `main` on Windows. It follows (I did not run this mutation) that if `Module::write()` skipped the split and called `write_prepared()` directly, no test would fail on Windows. The new unit tests call the helpers (`split_multiple_back_edges`, `cfg_layout`), and `written_bytes_unchanged` calls `write()` 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: | | modules written | with a dual back edge | |---|---|---| | `main`'s writer, whole lib suite (430 tests, including this PR's test and my probe) | 5,482 | 5: this PR's synthetic test and my 4 synthetic shapes below | | this PR's writer, those 5 synthetic modules | 5 | 0 | 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_unchanged` passes. 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 `waveReadLaneAt` in the inner loop, a known result stored to the UAV). Each was checked by the `dxil.dll` validator, dumped with `dxc -dumpbin`, and dispatched on the card, on WARP (`Host::new(true)`), and on the card again with `LEONIDA_D3D12_DEBUG=1`, which `Host::new` reads without any feature gate. | shape | `main` emitted | this PR emitted | validator | card / WARP / card with debug layer | |---|---|---|---|---| | latch `CondBr(c, inner, outer)` (the PR's order) | dual | latch → inner or a new block → outer | accepted | `0x1009` on all three | | arms swapped, `CondBr(c, outer, inner)` | dual | latch → outer or a new block → inner | accepted | `0x1009` | | inner header is its own latch, `CondBr(c, inner, outer)` | dual (`br i1 %17, label %9, label %3`) | self edge kept, outer through a new block | accepted | `0x1009` | | three levels, a middle block `CondBr(c, middle, outer)` | dual | split | accepted | `0x1012` | No debug-layer message was printed. A note on the swapped case: `dual_back_edges` always 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 on `main` and returns 560 bytes here. I only saw `Module::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-spirv` run (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).
MoonEyes commented 2026-12-02 18:13:01 +00:00 (Migrated from github.com)

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-viewer job is a real defect of this branch: d3d12/docs/switches.md does not list the new LEONIDA_SYNTHETIC_DXIL_FILE.

Head 337bc1a7df
Merge with main 45dc41f95c clean (git merge-tree); merge base d741a9f8f6, 291 commits behind
CI on head linux-python-and-viewer and check failed (tests/test_d3d12_switches.py); d3d12 (windows-latest) passed

Ran (Linux, Python 3.13.18, on an export of the merge tree in its own git repository so git ls-files works)

python -I tools/d3d12_switches.py --check d3d12/docs/switches.md
  missing from the page: LEONIDA_SYNTHETIC_DXIL_FILE        exit 1
python -I tests/test_d3d12_switches.py                      Ran 20 tests  FAILED (failures=1)

The same check on main alone and on #3072 / #2851 merged onto the same main passes, so the failure comes from this branch: d3d12/crates/leonida-shader/src/emit/mod.rs (new test) reads std::env::var_os("LEONIDA_SYNTHETIC_DXIL_FILE"). Fix: python -I tools/d3d12_switches.py --out d3d12/docs/switches.md on a merge with current main and commit the page (the generator puts a test-only name under "Only in tests").

Review (not built here)

  • The fix is in the emitter, not a workaround in the runtime: Module::split_multiple_back_edges finds reachable CondBr blocks whose two targets are both back edges in reverse postorder and gives one of them its own latch, so dxil-spirv's flatten_subgroup_shuffles -> recompute_cfg never sees a block with two back-edge successors. That matches the assertion quoted in the description (cfg_structurizer.cpp:3452).
  • Cost: one reverse-postorder walk per emitted module at translation time, not per frame.
  • Windows results from OreoFR/MoonEyes, merzleckeier (GPU, CachyOS), KelboLive and Kal0s-design (merged onto d0bf821fa) are on this head or its parent and agree.
  • The in-game run MoonEyes asked for on 2 December (render path) has not been posted.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354142831 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7354142831). Originally posted by [MoonEyes](https://github.com/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-viewer` job is a real defect of this branch: `d3d12/docs/switches.md` does not list the new `LEONIDA_SYNTHETIC_DXIL_FILE`.** | | | |---|---| | Head | `337bc1a7df` | | Merge with `main` `45dc41f95c` | clean (`git merge-tree`); merge base `d741a9f8f6`, 291 commits behind | | CI on head | `linux-python-and-viewer` and `check` failed (`tests/test_d3d12_switches.py`); `d3d12 (windows-latest)` passed | **Ran (Linux, Python 3.13.18, on an export of the merge tree in its own git repository so `git ls-files` works)** ``` python -I tools/d3d12_switches.py --check d3d12/docs/switches.md missing from the page: LEONIDA_SYNTHETIC_DXIL_FILE exit 1 python -I tests/test_d3d12_switches.py Ran 20 tests FAILED (failures=1) ``` The same check on `main` alone and on #3072 / #2851 merged onto the same `main` passes, so the failure comes from this branch: `d3d12/crates/leonida-shader/src/emit/mod.rs` (new test) reads `std::env::var_os("LEONIDA_SYNTHETIC_DXIL_FILE")`. Fix: `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md` on a merge with current `main` and commit the page (the generator puts a test-only name under "Only in tests"). **Review (not built here)** - The fix is in the emitter, not a workaround in the runtime: `Module::split_multiple_back_edges` finds reachable `CondBr` blocks whose two targets are both back edges in reverse postorder and gives one of them its own latch, so `dxil-spirv`'s `flatten_subgroup_shuffles -> recompute_cfg` never sees a block with two back-edge successors. That matches the assertion quoted in the description (`cfg_structurizer.cpp:3452`). - Cost: one reverse-postorder walk per emitted module at translation time, not per frame. - Windows results from OreoFR/MoonEyes, merzleckeier (GPU, CachyOS), KelboLive and Kal0s-design (merged onto `d0bf821fa`) are on this head or its parent and agree. - The in-game run MoonEyes asked for on 2 December (render path) has not been posted. **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](https://claude.ai/code)_
zmasi commented 2026-12-02 18:36:48 +00:00 (Migrated from github.com)

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 pushed 4ce7951275:

  1. emit/mod.rs test compile fix (ray_queries): initialized ray_queries: Default::default() in dual_backedge_wave_read_compiles_and_dispatches's HostShader literal (433 passed, 0 failed, 6 ignored in cargo test --locked --target x86_64-pc-windows-msvc -p leonida-shader --lib).
  2. d3d12/docs/switches.md (LEONIDA_SYNTHETIC_DXIL_FILE): regenerated via python -I tools/d3d12_switches.py --out d3d12/docs/switches.md (tools/d3d12_switches.py --check exit 0, tests/test_d3d12_switches.py 20/20 OK).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354877382 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7354877382). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-02T18:36:48Z. --- Thanks @Kal0s-design and @MoonEyes for catching both post-merge issues! Merged `origin/main` (`45dc41f95`) and pushed `4ce7951275`: 1. **`emit/mod.rs` test compile fix (`ray_queries`)**: initialized `ray_queries: Default::default()` in `dual_backedge_wave_read_compiles_and_dispatches`'s `HostShader` literal (`433 passed, 0 failed, 6 ignored` in `cargo test --locked --target x86_64-pc-windows-msvc -p leonida-shader --lib`). 2. **`d3d12/docs/switches.md` (`LEONIDA_SYNTHETIC_DXIL_FILE`)**: regenerated via `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md` (`tools/d3d12_switches.py --check` exit 0, `tests/test_d3d12_switches.py` `20/20` OK).
MoonEyes commented 2026-12-02 21:40:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:40:05Z.


RUN (independent run on Windows, head 4ce795127570bd56135f879fe6d61b92b905126f, merged into main b41763227aeed2d23c98af84bcbc1bddc7acdc90 with git merge --no-ff)

Windows 11, pinned toolchain (Rust 1.98.1), --release --locked, CPU/native D3D12 only. The merge had no conflict (merge commit 1861cdda8, local only). The PR touches leonida-shader (emit/bitcode.rs, emit/mod.rs) and d3d12/docs/switches.md; it does not touch leonida-gpu or any diagnostics code.

Green

Check Result
cargo test -p leonida-shader --release --locked --lib 433 passed, 0 failed, 6 ignored (771 s)
cargo test ... -- emit::bitcode::tests dual_backedge 11 passed, 0 failed, 1 ignored
python -I tools/d3d12_switches.py --check d3d12/docs/switches.md exit 0
python -I tests/test_d3d12_switches.py 20 tests OK
python -I scripts/check_no_game_data.py on the 3 changed files 0 issues

The ray_queries compile error and the missing LEONIDA_SYNTHETIC_DXIL_FILE entry reported on the previous head are both fixed on this head. cargo test -p leonida-gpu was not run: the PR changes nothing it uses.

Red

The 5 new tests (4 in emit/bitcode.rs, 1 in emit/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 with git checkout HEAD -- <file>):

Mutation Result
M1: dual_back_edges never reports a dual latch (rpo[f] <= rpo[b] replaced by false) killed by dual_latches_are_given_dedicated_back_edges. NOT killed by dual_backedge_wave_read_compiles_and_dispatches (it passes on native Windows D3D12, which accepts the unsplit CFG)
M2: split_back_edges no longer rewrites the header PHI predecessor killed by dual_latches_are_given_dedicated_back_edges and by dual_backedge_wave_read_compiles_and_dispatches (the DXIL validator rejects the module)
M3: folded_empty_latches always folds (the would_make_dual guard off) killed by empty_latches_do_not_refold_into_dual_back_edges and dual_latches_are_given_dedicated_back_edges

No mutation survived. The original failure (the pinned dxil-spirv assertion 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

  • Default-off: this is not a switch. The splitting and the changed latch folding are always on, for every shader and every platform, not only for the Linux warm path. A module with no dual back edge takes the old path (no clone, same layout); the unit test an_ordinary_conditional_latch_keeps_its_layout covers that shape only.
  • Ordering: write() computes the split on the reachable reverse postorder before write_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).
  • Lifetimes and fences: nothing runtime-side; no GPU object, fence or barrier is touched.
  • Behaviour change to check: folded_empty_latches now 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.
  • Claim: D3D12-LINUX-WARM-DXIL-RECURSION is claimed in the coordination issue 2570 (comment by the author); the PR body links it and relates to 2621.
  • Open reviewer questions: none unanswered. The CI findings on the earlier head (compile error, switches page) were answered by the author with this head.
  • Overlap: other open PRs touching emit/bitcode.rs or emit/mod.rs exist (3126, 2661, 3197, 2834, 3128, 2580, 2698, 2958); a text conflict with this head is absent on current main, but I did not merge them together.
  • In-game runs posted on this exact head: none. Posted checks are on older heads: unit suites (macOS, Windows), a Wine/VKD3D GPU dispatch on two cards, and a Windows run of the previous head that found the compile error. The maintainer's request for an in-game run (300 s, device-loss count) is still open.

Not covered

  • No in-game run, no AMD or Linux run, no corpus count of changed shaders, no run of the retail shader set (none allowed here).
  • leonida-gpu tests, --features diagnostics, clippy.
  • Whether the GPU half of dual_backedge_wave_read_compiles_and_dispatches ran here: the test skips it silently when no device or validator loads, and I did not check which happened.
  • Interaction with the other open PRs on the same files.

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359607898 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7359607898). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:40:05Z. --- RUN (independent run on Windows, head `4ce795127570bd56135f879fe6d61b92b905126f`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) Windows 11, pinned toolchain (Rust 1.98.1), `--release --locked`, CPU/native D3D12 only. The merge had no conflict (merge commit `1861cdda8`, local only). The PR touches `leonida-shader` (`emit/bitcode.rs`, `emit/mod.rs`) and `d3d12/docs/switches.md`; it does not touch `leonida-gpu` or any diagnostics code. ### Green | Check | Result | |---|---| | `cargo test -p leonida-shader --release --locked --lib` | 433 passed, 0 failed, 6 ignored (771 s) | | `cargo test ... -- emit::bitcode::tests dual_backedge` | 11 passed, 0 failed, 1 ignored | | `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` | exit 0 | | `python -I tests/test_d3d12_switches.py` | 20 tests OK | | `python -I scripts/check_no_game_data.py` on the 3 changed files | 0 issues | The `ray_queries` compile error and the missing `LEONIDA_SYNTHETIC_DXIL_FILE` entry reported on the previous head are both fixed on this head. `cargo test -p leonida-gpu` was not run: the PR changes nothing it uses. ### Red The 5 new tests (4 in `emit/bitcode.rs`, 1 in `emit/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 with `git checkout HEAD -- <file>`): | Mutation | Result | |---|---| | M1: `dual_back_edges` never reports a dual latch (`rpo[f] <= rpo[b]` replaced by `false`) | killed by `dual_latches_are_given_dedicated_back_edges`. NOT killed by `dual_backedge_wave_read_compiles_and_dispatches` (it passes on native Windows D3D12, which accepts the unsplit CFG) | | M2: `split_back_edges` no longer rewrites the header PHI predecessor | killed by `dual_latches_are_given_dedicated_back_edges` and by `dual_backedge_wave_read_compiles_and_dispatches` (the DXIL validator rejects the module) | | M3: `folded_empty_latches` always folds (the `would_make_dual` guard off) | killed by `empty_latches_do_not_refold_into_dual_back_edges` and `dual_latches_are_given_dedicated_back_edges` | No mutation survived. The original failure (the pinned `dxil-spirv` assertion 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 - Default-off: this is not a switch. The splitting and the changed latch folding are always on, for every shader and every platform, not only for the Linux warm path. A module with no dual back edge takes the old path (no clone, same layout); the unit test `an_ordinary_conditional_latch_keeps_its_layout` covers that shape only. - Ordering: `write()` computes the split on the reachable reverse postorder before `write_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). - Lifetimes and fences: nothing runtime-side; no GPU object, fence or barrier is touched. - Behaviour change to check: `folded_empty_latches` now 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. - Claim: `D3D12-LINUX-WARM-DXIL-RECURSION` is claimed in the coordination issue 2570 (comment by the author); the PR body links it and relates to 2621. - Open reviewer questions: none unanswered. The CI findings on the earlier head (compile error, switches page) were answered by the author with this head. - Overlap: other open PRs touching `emit/bitcode.rs` or `emit/mod.rs` exist (3126, 2661, 3197, 2834, 3128, 2580, 2698, 2958); a text conflict with this head is absent on current `main`, but I did not merge them together. - In-game runs posted on this exact head: none. Posted checks are on older heads: unit suites (macOS, Windows), a Wine/VKD3D GPU dispatch on two cards, and a Windows run of the previous head that found the compile error. The maintainer's request for an in-game run (300 s, device-loss count) is still open. ### Not covered - No in-game run, no AMD or Linux run, no corpus count of changed shaders, no run of the retail shader set (none allowed here). - `leonida-gpu` tests, `--features diagnostics`, clippy. - Whether the GPU half of `dual_backedge_wave_read_compiles_and_dispatches` ran here: the test skips it silently when no device or validator loads, and I did not check which happened. - Interaction with the other open PRs on the same files. ### 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.
enlight3d commented 2026-12-03 00:54:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:17Z.


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-ff onto main f3865cae8. One conflict, in the credit table of d3d12/README.md when #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) and d3d12/README.md (#2588, #3119). Built with diagnostics,mimalloc, target x86_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 this main the 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:

Reached the world 75 s
Time in the world 331 s
Device losses 0
Crashes 0
Frame median 35.0 ms (28.2 fps rendered)
Card busy 85 %
Private memory, max 28.1 GB

Warnings: only kinds that a run on the same main with 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)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363727037 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7363727037). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-03T00:54:17Z. --- 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-ff` onto `main` f3865cae8. One conflict, in the credit table of `d3d12/README.md` when #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) and `d3d12/README.md` (#2588, #3119). Built with `diagnostics,mimalloc`, target `x86_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 this `main` the 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: | | | |---|---| | Reached the world | 75 s | | Time in the world | 331 s | | Device losses | 0 | | Crashes | 0 | | Frame median | 35.0 ms (28.2 fps rendered) | | Card busy | 85 % | | Private memory, max | 28.1 GB | Warnings: only kinds that a run on the same `main` with 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)
fiestorra commented 2026-12-03 05:29:40 +00:00 (Migrated from github.com)

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

d3d12/crates/leonida-shader/src/emit/bitcode.rs   +343/−52
d3d12/crates/leonida-shader/src/emit/mod.rs       +105
d3d12/docs/switches.md                            +2/−1

cargo test -p leonida-shader --lib
  433 passed; 0 failed; 6 ignored   (480 s)

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.md cambia 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-spirv no 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-spirv reconozca 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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368798858 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7368798858). Originally posted by [fiestorra](https://github.com/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 ``` d3d12/crates/leonida-shader/src/emit/bitcode.rs +343/−52 d3d12/crates/leonida-shader/src/emit/mod.rs +105 d3d12/docs/switches.md +2/−1 cargo test -p leonida-shader --lib 433 passed; 0 failed; 6 ignored (480 s) ``` **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.md` cambia 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-spirv` no 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-spirv` reconozca 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.**
zmasi commented 2026-12-03 11:25:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-03T11:25:04Z.


Merged origin/main (6e97990505, #3318) into c5269801b9 strictly to regenerate d3d12/docs/switches.md (needs rebase); both Rust files (emit/bitcode.rs and emit/mod.rs) have byte-identical diffs against origin/main compared to 4ce7951275.

AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7376671260 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7376671260). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-03T11:25:04Z. --- Merged `origin/main` (`6e97990505`, `#3318`) into `c5269801b9` strictly to regenerate `d3d12/docs/switches.md` (`needs rebase`); both Rust files (`emit/bitcode.rs` and `emit/mod.rs`) have byte-identical diffs against `origin/main` compared to `4ce7951275`. AI-assisted: Gemini 4 Carbon (High) and Gemini 4 Neon (XHigh).
MoonEyes commented 2026-12-03 14:31:55 +00:00 (Migrated from github.com)

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-ff onto main b053a1813, in one build: #2686 c5269801b, #2643 2e0b23a00, #2789 4cd9d71f8, #3072 0f1e26355, #2999 91537d2af. 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.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (46 samples) median 16.3, mean 16.4
Rendered fps, last 120 s median 16.2
Frames over 100 ms 21.3 per 1000; 2 pauses over 1 s
Time under 5 fps in the world 0 %

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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7381600644 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2686#issuecomment-7381600644). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T14:31:55Z. --- RUN (in game, third party, batch of five pull requests), each head merged with `git merge --no-ff` onto main `b053a1813`, in one build: #2686 `c5269801b`, #2643 `2e0b23a00`, #2789 `4cd9d71f8`, #3072 `0f1e26355`, #2999 `91537d2af`. 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. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (46 samples) | median 16.3, mean 16.4 | | Rendered fps, last 120 s | median 16.2 | | Frames over 100 ms | 21.3 per 1000; 2 pauses over 1 s | | Time under 5 fps in the world | 0 % | 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).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2686:upstream-pr/2686'
git switch 'upstream-pr/2686'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2686'
git switch 'upstream-pr/2686'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2686'
git switch 'upstream-pr/2686'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2686'
git switch 'main'
git merge --squash 'upstream-pr/2686'
git switch 'main'
git merge --ff-only 'upstream-pr/2686'
git switch 'main'
git merge 'upstream-pr/2686'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!2686
No description provided.