gpu/pipeline: reject empty descriptor source joins in bound_view_stores (D3D12-GPU-BOUND-STORES-EMPTY-LEAVES) #2892

Open
djrolfes wants to merge 1 commit from upstream-pr/2892 into main
djrolfes commented 2026-12-01 15:37:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-12-01T15:37:07Z.


Claimed in the coordination issue as: D3D12-GPU-BOUND-STORES-EMPTY-LEAVES.

What and why

Close a vacuous-truth soundness bug in stores_in_bound_views (d3d12/crates/leonida-gpu/src/pipeline.rs): require at least one leaf descriptor source (!leaves.is_empty()) before declaring a buffer store or atomic bound.

  • Why: On main, stores_in_bound_views checks:
    found.all(|d| d.source.leaves().into_iter().all(declared))
    
    Because Rust's Iterator::all returns true on an empty iterator, any descriptor whose tracked source has zero leaves — such as Source::LanePhi { args: [] }, Source::LanePhi { args: [None, None] }, Source::Phi { args: [] }, or Source::Select { args: [] } — vacuously evaluated to true and was misclassified as provably bound for LEONIDA_INDIRECT_BATCH=4.
  • Change:
    • Extracts bound_view_stores(program, &p, &res) from stores_in_bound_views so tracked IR edge cases can be unit-tested directly.
    • Checks let leaves = d.source.leaves(); !leaves.is_empty() && leaves.into_iter().all(declared).
  • Orthogonality check: Touches ONLY d3d12/crates/leonida-gpu/src/pipeline.rs and keeps stores_bound() -> bool signature unchanged — zero overlap with enlight3d's #2868 (D3D12-BATCH-HEAP-READS, which touches draw.rs + indirect/batch.rs) or #2569.
  • Evidence classification: READ IN CODE (d3d12/crates/leonida-gpu/src/pipeline.rs) + red→green unit test + MEASURED 300 s in-world Option-A roam gate.

Tested

  • python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs → exit 0.
  • Cross-compiled leonida-gpu unit test binary (x86_64-pc-windows-msvc) and ran under Wine:
    • RED on origin/main (with bound_view_stores extracted preserving origin/main's .all(declared) logic and the new test bound_view_stores_rejects_empty_joins_and_missing_descriptors):
      running 1 test
      thread 'pipeline::bound_tests::bound_view_stores_rejects_empty_joins_and_missing_descriptors' panicked:
      unproven descriptor: LanePhi { block: 0, args: [] }
      test result: FAILED. 0 passed; 1 failed; 0 ignored
      
    • GREEN on PR head 2e7c3467d (rebased onto 3e7b34a52):
      test pipeline::bound_tests::bound_view_stores_rejects_empty_joins_and_missing_descriptors ... ok
      test pipeline::bound_tests::stores_through_bound_views_are_told_from_the_others ... ok
      test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 689 filtered out
      
      (Plus pipeline::tests:: 3 passed; 0 failed.)
  • 300 s in-world game gate (MEASURED on exact PR head 2e7c3467d, Series S + DLSS Quality 1280×720 → 1920×1080, LEONIDA_INDIRECT_BATCH=4, Option A mods/gate_driver mode = roam):
    • Verdict: PASS (310.70 s in-world after world entry at 66.99 s; also passed an earlier cold-cache 310.19 s run with 0 errors).
    • Frames & pacing: 1,708 frames after +60 s (1,796 total world presents), 10.52 median FPS (12.26 end median FPS), 394.52 ms p95 frame time, 4.022 s longest present gap (<= 10.0 s).
    • Memory & stability: 6,759 MiB peak VRAM (<= 7,400 MiB), 0 device losses (0x887A0005), 0 crashes, 0 panics, 0 faults before stop, 0 kernel NVRM: Xid errors.
    • Option A roam control: GATE CONTROL reached at t = 70.0 s (moved = 7.63 m, mode = roam), 32 GATE MARK roam ticks, 0 GATE FAIL.

GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0).

AI-assisted: yes (authored by Gemini 4 Neon; reviewed in a separate independent review pass by Gemini 4 Neon).

Checklist

  • Based on current main (3e7b34a52) 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 (check_no_game_data.py clean on both source and PR description).
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — GPU bound-store proof soundness fix)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5589006678 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-12-01T15:37:07Z. --- Claimed in the coordination issue as: [`D3D12-GPU-BOUND-STORES-EMPTY-LEAVES`](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7313473815). ### What and why Close a vacuous-truth soundness bug in `stores_in_bound_views` (`d3d12/crates/leonida-gpu/src/pipeline.rs`): require at least one leaf descriptor source (`!leaves.is_empty()`) before declaring a buffer store or atomic bound. - **Why:** On `main`, `stores_in_bound_views` checks: ```rust found.all(|d| d.source.leaves().into_iter().all(declared)) ``` Because Rust's `Iterator::all` returns `true` on an empty iterator, any descriptor whose tracked source has zero leaves — such as `Source::LanePhi { args: [] }`, `Source::LanePhi { args: [None, None] }`, `Source::Phi { args: [] }`, or `Source::Select { args: [] }` — vacuously evaluated to `true` and was misclassified as provably bound for `LEONIDA_INDIRECT_BATCH=4`. - **Change:** - Extracts `bound_view_stores(program, &p, &res)` from `stores_in_bound_views` so tracked IR edge cases can be unit-tested directly. - Checks `let leaves = d.source.leaves(); !leaves.is_empty() && leaves.into_iter().all(declared)`. - **Orthogonality check:** Touches ONLY `d3d12/crates/leonida-gpu/src/pipeline.rs` and keeps `stores_bound() -> bool` signature unchanged — zero overlap with `enlight3d`'s `#2868` (`D3D12-BATCH-HEAP-READS`, which touches `draw.rs` + `indirect/batch.rs`) or `#2569`. - **Evidence classification:** **READ IN CODE** (`d3d12/crates/leonida-gpu/src/pipeline.rs`) + red→green unit test + **MEASURED** 300 s in-world Option-A roam gate. ### Tested - `python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs` → exit 0. - Cross-compiled `leonida-gpu` unit test binary (`x86_64-pc-windows-msvc`) and ran under Wine: - **RED on `origin/main`** (with `bound_view_stores` extracted preserving `origin/main`'s `.all(declared)` logic and the new test `bound_view_stores_rejects_empty_joins_and_missing_descriptors`): ```text running 1 test thread 'pipeline::bound_tests::bound_view_stores_rejects_empty_joins_and_missing_descriptors' panicked: unproven descriptor: LanePhi { block: 0, args: [] } test result: FAILED. 0 passed; 1 failed; 0 ignored ``` - **GREEN on PR head `2e7c3467d` (rebased onto `3e7b34a52`)**: ```text test pipeline::bound_tests::bound_view_stores_rejects_empty_joins_and_missing_descriptors ... ok test pipeline::bound_tests::stores_through_bound_views_are_told_from_the_others ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 689 filtered out ``` (Plus `pipeline::tests::` `3 passed; 0 failed`.) - **300 s in-world game gate (MEASURED on exact PR head `2e7c3467d`, Series S + DLSS Quality `1280×720 → 1920×1080`, `LEONIDA_INDIRECT_BATCH=4`, Option A `mods/gate_driver` `mode = roam`):** - **Verdict:** **PASS** (`310.70 s` in-world after world entry at `66.99 s`; also passed an earlier cold-cache 310.19 s run with `0` errors). - **Frames & pacing:** `1,708` frames after +60 s (`1,796` total world presents), `10.52` median FPS (`12.26` end median FPS), `394.52 ms` p95 frame time, `4.022 s` longest present gap (`<= 10.0 s`). - **Memory & stability:** `6,759 MiB` peak VRAM (`<= 7,400 MiB`), `0` device losses (`0x887A0005`), `0` crashes, `0` panics, `0` faults before stop, `0` kernel `NVRM: Xid` errors. - **Option A roam control:** `GATE CONTROL` reached at `t = 70.0 s` (`moved = 7.63 m`, `mode = roam`), `32` `GATE MARK` roam ticks, `0` `GATE FAIL`. GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0). AI-assisted: yes (authored by Gemini 4 Neon; reviewed in a separate independent review pass by Gemini 4 Neon). ### Checklist - [x] Based on current `main` (`3e7b34a52`) 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 (`check_no_game_data.py` clean on both source and PR description). - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — GPU bound-store proof soundness fix)
Kal0s-design commented 2026-12-01 17:22:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-01T17:22:45Z.


Verified on native Windows 11 (MSVC target, rustc 1.98.1), since the runs in the description are under Wine.

Head 2e7c3467d merged with main d2a564b66 (clean merge):

  • cargo test -p leonida-gpu --lib pipeline::: 39 passed, 0 failed, 8 ignored. Both bound_tests pass.
  • cargo clippy -p leonida-gpu --all-targets: nothing in pipeline.rs.

The test catches the change. With !leaves.is_empty() && removed (the main logic in the extracted function), bound_view_stores_rejects_empty_joins_and_missing_descriptors fails at pipeline.rs:1382 with unproven descriptor: LanePhi { block: 0, args: [] }. That matches the red in the description.

Not checked: the full leonida-gpu suite and the game.

GPUs tested: n/a (CPU unit tests only).

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319204116 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7319204116). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-01T17:22:45Z. --- Verified on native Windows 11 (MSVC target, rustc 1.98.1), since the runs in the description are under Wine. Head `2e7c3467d` merged with `main` `d2a564b66` (clean merge): - `cargo test -p leonida-gpu --lib pipeline::`: 39 passed, 0 failed, 8 ignored. Both `bound_tests` pass. - `cargo clippy -p leonida-gpu --all-targets`: nothing in `pipeline.rs`. The test catches the change. With `!leaves.is_empty() &&` removed (the `main` logic in the extracted function), `bound_view_stores_rejects_empty_joins_and_missing_descriptors` fails at `pipeline.rs:1382` with `unproven descriptor: LanePhi { block: 0, args: [] }`. That matches the red in the description. Not checked: the full `leonida-gpu` suite and the game. GPUs tested: n/a (CPU unit tests only). AI-assisted: yes (Claude Code).
KelboLive commented 2026-12-01 17:26:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:26:07Z.

Review: COMMENTED


The guard is sound and minimal: leaves() is non-empty for Loaded/Built (resource.rs:101-110), so single-source descriptors still pass, while empty Phi/Select/LanePhi joins now fail closed — and the loss is visible through BOUND_SAID, undeclared_why and batch closure rather than silently dropped. Extracting bound_view_stores (pipeline.rs:599-650) so the proof can be tested directly is the right move, and deleting !leaves.is_empty() && fails the new test exactly at pipeline.rs:1382 (unproven descriptor: LanePhi { block: 0, args: [] }). 632/0/59 on the crate, merge clean against current main.

Two follow-ups worth doing in this PR or a note:

  1. Make the test case reachable in practice. per_lane really can emit LanePhi with every arg None (resource.rs:1954-1976), so a captured real shader/pipeline would be stronger than only the synthetic overwrite — the test currently proves the predicate, not that the tracker produces such a join.
  2. The same vacuous .all() over leaves() sits at emit/lower.rs:9185 and :9771. If empty joins are reachable there, the class is only half closed; either audit those two sites or reject empty joins where they are built.

One correction to the body: #2868 is not zero-overlap at file level — it also edits pipeline.rs (+199), and the two conflict textually where both append tests to bound_tests (merge-tree against its head exits 1). Semantically orthogonal and trivial to resolve by keeping both, but "zero overlap" will mislead whoever merges second. Against current main alone, this is clean.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6136426220 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#pullrequestreview-6136426220). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T17:26:07Z. **Review:** COMMENTED --- The guard is sound and minimal: `leaves()` is non-empty for `Loaded`/`Built` (`resource.rs:101-110`), so single-source descriptors still pass, while empty `Phi`/`Select`/`LanePhi` joins now fail closed — and the loss is visible through `BOUND_SAID`, `undeclared_why` and batch closure rather than silently dropped. Extracting `bound_view_stores` (`pipeline.rs:599-650`) so the proof can be tested directly is the right move, and deleting `!leaves.is_empty() &&` fails the new test exactly at `pipeline.rs:1382` (`unproven descriptor: LanePhi { block: 0, args: [] }`). 632/0/59 on the crate, merge clean against current main. Two follow-ups worth doing in this PR or a note: 1. **Make the test case reachable in practice.** `per_lane` really can emit `LanePhi` with every arg `None` (`resource.rs:1954-1976`), so a captured real shader/pipeline would be stronger than only the synthetic overwrite — the test currently proves the predicate, not that the tracker produces such a join. 2. **The same vacuous `.all()` over `leaves()` sits at `emit/lower.rs:9185` and `:9771`.** If empty joins are reachable there, the class is only half closed; either audit those two sites or reject empty joins where they are built. One correction to the body: #2868 is not zero-overlap at file level — it also edits `pipeline.rs` (+199), and the two **conflict textually** where both append tests to `bound_tests` (merge-tree against its head exits 1). Semantically orthogonal and trivial to resolve by keeping both, but "zero overlap" will mislead whoever merges second. Against current main alone, this is clean.
EdenBendheim commented 2026-12-02 00:07:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T00:07:55Z.


Independent native Windows 11 + RTX 3090 verification (VERIFY-2892-RTX3090, claimed in #2570): PASS (with one non-blocking soundness note below)

  • Tested: PR head 2e7c3467d merged cleanly onto main 913b88b90 (diagnostics,mimalloc, exe_sha16: fea732e495041a36).
  • Hardware / OS: Windows 11, AMD Ryzen 9 5900X, 32 GiB RAM, NVIDIA GeForce RTX 3090 24 GiB (driver 610.88).
  • Clean-room check: python -I scripts/check_no_game_data.py passed on all changed files.
  • Unit red/green (cargo test -p leonida-gpu --locked -- bound_view_stores_rejects_empty_joins_and_missing_descriptors --test-threads=1):
    • Baseline 913b88b90 with PR test overlaid: compile red on base; testing the old predicate against the extracted helper failed on empty LanePhi.
    • Merged PR (default and --features diagnostics): 1 passed, 0 failed in both configurations.
  • Retail 300 s in-game dynamic-stress gate (scripts/game-gate.ps1, Series X 1080–1440p, -NoFrameGen, upgraded 8-leg sprint/wide-turn/jump gate_driver + LEONIDA_GAME_ACTIONS_RUN="150:weather RAIN"):
    • Verdict: PASS (reasons=[], warnings=[], exit=clean, stop=target, cache_saved=true, GATE CONTROL fired with moved=1.80 m, max from_control_m=9.8 m, weather RAIN confirmed PASS).
    • Metrics (world_s=305.9s, world+60s, 4,847 presents, 6,528.5 median draws): 20.47 FPS median, 15.22 FPS p5, 65.69 ms p95 frame time, 2.396 s longest present gap, 0 missed pipeline waits, 32,455 MB max private memory, 303 MB min commit left, 13,419 MB max VRAM (0 s over budget).
  • Code-review note: The fix rejects a wholly empty join, but a nested empty join alongside a declared source can still disappear when leaves() flattens the tree (worth checking whether the tracker can emit nested empty joins).

AI-assisted: yes (Gemini 4 Neon orchestrator; Codex GPT-6.2 Astra build, unit tests, and serialized RTX 3090 gate execution).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7330178294 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7330178294). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-02T00:07:55Z. --- Independent native Windows 11 + RTX 3090 verification (**`VERIFY-2892-RTX3090`**, claimed in #2570): **PASS** (with one non-blocking soundness note below) - **Tested:** PR head `2e7c3467d` merged cleanly onto `main` `913b88b90` (`diagnostics,mimalloc`, `exe_sha16`: `fea732e495041a36`). - **Hardware / OS:** Windows 11, AMD Ryzen 9 5900X, 32 GiB RAM, NVIDIA GeForce RTX 3090 24 GiB (driver `610.88`). - **Clean-room check:** `python -I scripts/check_no_game_data.py` passed on all changed files. - **Unit red/green (`cargo test -p leonida-gpu --locked -- bound_view_stores_rejects_empty_joins_and_missing_descriptors --test-threads=1`):** - Baseline `913b88b90` with PR test overlaid: compile red on base; testing the old predicate against the extracted helper failed on empty `LanePhi`. - Merged PR (default and `--features diagnostics`): **1 passed, 0 failed** in both configurations. - **Retail 300 s in-game dynamic-stress gate (`scripts/game-gate.ps1`, Series X 1080–1440p, `-NoFrameGen`, upgraded 8-leg sprint/wide-turn/jump `gate_driver` + `LEONIDA_GAME_ACTIONS_RUN="150:weather RAIN"`):** - **Verdict:** **`PASS`** (`reasons=[]`, `warnings=[]`, `exit=clean`, `stop=target`, `cache_saved=true`, `GATE CONTROL` fired with `moved=1.80 m`, max `from_control_m=9.8 m`, `weather RAIN` confirmed PASS). - **Metrics (`world_s=305.9s`, `world+60s`, 4,847 presents, 6,528.5 median draws):** `20.47 FPS` median, `15.22 FPS` p5, `65.69 ms` p95 frame time, `2.396 s` longest present gap, `0` missed pipeline waits, `32,455 MB` max private memory, `303 MB` min commit left, `13,419 MB` max VRAM (`0 s` over budget). - **Code-review note:** The fix rejects a wholly empty join, but a nested empty join alongside a declared source can still disappear when `leaves()` flattens the tree (worth checking whether the tracker can emit nested empty joins). *AI-assisted: yes (Gemini 4 Neon orchestrator; Codex GPT-6.2 Astra build, unit tests, and serialized RTX 3090 gate execution).*
MoonEyes commented 2026-12-02 12:30:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:30:47Z.


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:7345451265 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7345451265). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:30:47Z. --- 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).
MoonEyes commented 2026-12-02 18:12:40 +00:00 (Migrated from github.com)

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


Reviewed #2892 (code review only, not built here: Windows-only). The fix is right and its test is meaningful. The red CI is not from this change, but it is from a 1 December run on a 493-commits-old base, so CI needs a fresh run. The requested in-game run is missing.

Head 2e7c3467d8 (unchanged since 1 December)
Merge with main 45dc41f95c clean (git merge-tree); merge base 3e7b34a52a, 493 commits behind
Switches registry on the merge exit 0
CI on head linux-python-and-viewer red on tests/test_x64_recomp_qemu_runner.py, test_x64_recomp.py, test_wave_trace.py, test_wave_diff.py (files this PR does not touch); check red as their aggregate; d3d12 (windows-latest) green
Windows evidence Kal0s-design (native Windows 11), EdenBendheim (VERIFY-2892-RTX3090, PASS)

Review of d3d12/crates/leonida-gpu/src/pipeline.rs

  • The bug: found.all(|d| d.source.leaves().into_iter().all(declared)) is vacuously true when a descriptor's source has no leaves (a LanePhi/Phi/Select with no live arguments), so a store through a descriptor nobody proved bound passed stores_in_bound_views. The fix (!leaves.is_empty() && ...) makes an empty join unproven. That is the conservative answer, and it is the root cause, not a special case.
  • Splitting bound_view_stores out of stores_in_bound_views lets the test feed hand-made Resources (empty LanePhi, all-None LanePhi, empty Phi/Select, a Phi joining a bound source with a constant, a Sampler role, no descriptors) without depending on the tracker producing those shapes. Each one asserts the conservative answer, and the positive case (one live edge with a declared source) still passes. Without the fix, at least the empty-join cases would return true, so the test fails on main's code.
  • Cost: pipeline-creation time only, not per draw.

Verdict: ready after a CI rerun on a current merge (merge main into the branch) and the in-game run MoonEyes asked for on 2 December 12:30.

AI-assisted: Claude Opus 5.5 (Claude Code), review only.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354130364 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7354130364). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:12:40Z. --- **Reviewed #2892 (code review only, not built here: Windows-only). The fix is right and its test is meaningful. The red CI is not from this change, but it is from a 1 December run on a 493-commits-old base, so CI needs a fresh run. The requested in-game run is missing.** | | | |---|---| | Head | `2e7c3467d8` (unchanged since 1 December) | | Merge with `main` `45dc41f95c` | clean (`git merge-tree`); merge base `3e7b34a52a`, 493 commits behind | | Switches registry on the merge | exit 0 | | CI on head | `linux-python-and-viewer` red on `tests/test_x64_recomp_qemu_runner.py`, `test_x64_recomp.py`, `test_wave_trace.py`, `test_wave_diff.py` (files this PR does not touch); `check` red as their aggregate; `d3d12 (windows-latest)` green | | Windows evidence | Kal0s-design (native Windows 11), EdenBendheim (`VERIFY-2892-RTX3090`, PASS) | **Review of `d3d12/crates/leonida-gpu/src/pipeline.rs`** - The bug: `found.all(|d| d.source.leaves().into_iter().all(declared))` is vacuously true when a descriptor's source has no leaves (a `LanePhi`/`Phi`/`Select` with no live arguments), so a store through a descriptor nobody proved bound passed `stores_in_bound_views`. The fix (`!leaves.is_empty() && ...`) makes an empty join unproven. That is the conservative answer, and it is the root cause, not a special case. - Splitting `bound_view_stores` out of `stores_in_bound_views` lets the test feed hand-made `Resources` (empty `LanePhi`, all-`None` `LanePhi`, empty `Phi`/`Select`, a `Phi` joining a bound source with a constant, a `Sampler` role, no descriptors) without depending on the tracker producing those shapes. Each one asserts the conservative answer, and the positive case (one live edge with a declared source) still passes. Without the fix, at least the empty-join cases would return `true`, so the test fails on `main`'s code. - Cost: pipeline-creation time only, not per draw. **Verdict: ready** after a CI rerun on a current merge (merge `main` into the branch) and the in-game run MoonEyes asked for on 2 December 12:30. AI-assisted: Claude Opus 5.5 (Claude Code), review only. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:40:08 +00:00 (Migrated from github.com)

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


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

Merge: clean, no conflict. Diff against main is d3d12/crates/leonida-gpu/src/pipeline.rs only (+50/-4). Windows 11, MSVC, release profile, --locked.

Green

  • cargo test -p leonida-gpu --release --locked --lib: 704 passed, 0 failed, 59 ignored. Both bound_tests pass, including bound_view_stores_rejects_empty_joins_and_missing_descriptors.
  • --features diagnostics --lib not run: the PR touches no diagnostics code. No Python test is touched.

Red

The new test calls bound_view_stores, which does not exist on main, so restoring main's pipeline.rs removes the test and the helper together: that is a compile-level red only. I used mutations of the new code instead, each run with cargo test ... --lib bound_:

Mutation Result
Remove !leaves.is_empty() && (the main logic) killed: new test fails on the empty LanePhi case
Replace it with leaves.len() > 1 && killed: both bound_tests fail
all(declared) changed to any(declared) killed: the Phi of a declared source and a constant case fails
Whole predicate replaced by true killed: both tests fail

No mutation survived. The worktree was restored after each one.

Review

  • Default-off: no new switch, no behaviour change when LEONIDA_INDIRECT_BATCH is not 4; the proof only gets stricter (fails closed). docs/switches.md needs no regeneration.
  • Ordering, lifetimes, fences: nothing touched. The change is a pure predicate over tracked IR, plus a move of the use lines into the extracted function.
  • Claim: claimed as D3D12-GPU-BOUND-STORES-EMPTY-LEAVES in #2570 (the claim and done posts are in that thread).
  • Overlap: #2868 (named by a reviewer as editing pipeline.rs) is now closed. No other open overlap checked beyond that.
  • In-game runs on this exact head are posted by others: the author's 300 s Wine/VKD3D run (RTX 3070 Ti, LEONIDA_INDIRECT_BATCH=4, PASS, 0 device losses), merged onto main 3e7b34a52 (554 commits behind main b41763227), and EdenBendheim's native Windows RTX 3090 300 s gate (PASS, clean exit), merged onto main 913b88b90. Kal0s-design verified the unit tests natively.
  • Open reviewer points, not addressed by the head: (1) the test only proves the predicate on hand-made Resources, not that the tracker emits an all-None LanePhi in a real program; (2) the same .all() over leaves() pattern exists in leonida-shader/src/emit/lower.rs (two sites, now around lines 9326 and 9912); (3) a nested empty join next to a declared source.
  • Point (3), read in code only (resource.rs, Source::leaves): leaves() flattens, so a Phi of an empty LanePhi and a declared Loaded source yields one leaf and passes. This matches the semantics the PR's own test asserts on purpose (LanePhi { args: [None, Some(bound)] } passes: a live edge with a declared source is sufficient); the nested case is the same meaning one level deeper. I did not run it, so it is read, not measured.

Not covered

  • No in-game run by me. The maintainer's firm request on the PR was a run of this head merged onto current main; the two posted runs above used older mains (3e7b34a52, 554 commits behind b41763227, and 913b88b90), so that request is not met. A main-only comparison was asked for only "if you can"; it is absent too.
  • Linux/Wine not run by me. The CI state on a fresh run was not checked; the earlier red was in unrelated Python tests.
  • Reviewer points (1) and (2) are neither tested nor fixed; (3) is read in code only.

Verdict

PARTIAL. Not PASS, because two conditions are open: (a) no in-game run of this head merged onto current main (the maintainer's firm request; posted runs are on older mains), and (b) CI not re-checked on a fresh base. The fix itself is correct for the case it claims, its test is non-vacuous (4 of 4 mutations killed), and lib tests are green on merge (704 passed). The lower.rs sites and reviewer point (1) are follow-ups, not blockers. Once a run on current main and a green CI are posted, this can move to PASS.

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359608926 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7359608926). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:40:08Z. --- RUN (independent run on Windows, head `2e7c3467d8b001b47c1bef2d80366abc97d2f8be`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) Merge: clean, no conflict. Diff against `main` is `d3d12/crates/leonida-gpu/src/pipeline.rs` only (+50/-4). Windows 11, MSVC, release profile, `--locked`. ### Green - `cargo test -p leonida-gpu --release --locked --lib`: 704 passed, 0 failed, 59 ignored. Both `bound_tests` pass, including `bound_view_stores_rejects_empty_joins_and_missing_descriptors`. - `--features diagnostics --lib` not run: the PR touches no diagnostics code. No Python test is touched. ### Red The new test calls `bound_view_stores`, which does not exist on `main`, so restoring `main`'s `pipeline.rs` removes the test and the helper together: that is a compile-level red only. I used mutations of the new code instead, each run with `cargo test ... --lib bound_`: | Mutation | Result | |---|---| | Remove `!leaves.is_empty() &&` (the `main` logic) | killed: new test fails on the empty `LanePhi` case | | Replace it with `leaves.len() > 1 &&` | killed: both `bound_tests` fail | | `all(declared)` changed to `any(declared)` | killed: the `Phi` of a declared source and a constant case fails | | Whole predicate replaced by `true` | killed: both tests fail | No mutation survived. The worktree was restored after each one. ### Review - Default-off: no new switch, no behaviour change when `LEONIDA_INDIRECT_BATCH` is not 4; the proof only gets stricter (fails closed). `docs/switches.md` needs no regeneration. - Ordering, lifetimes, fences: nothing touched. The change is a pure predicate over tracked IR, plus a move of the `use` lines into the extracted function. - Claim: claimed as `D3D12-GPU-BOUND-STORES-EMPTY-LEAVES` in #2570 (the claim and done posts are in that thread). - Overlap: #2868 (named by a reviewer as editing `pipeline.rs`) is now closed. No other open overlap checked beyond that. - In-game runs on this exact head are posted by others: the author's 300 s Wine/VKD3D run (RTX 3070 Ti, `LEONIDA_INDIRECT_BATCH=4`, PASS, 0 device losses), merged onto `main` `3e7b34a52` (554 commits behind `main` `b41763227`), and EdenBendheim's native Windows RTX 3090 300 s gate (PASS, clean exit), merged onto `main` `913b88b90`. Kal0s-design verified the unit tests natively. - Open reviewer points, not addressed by the head: (1) the test only proves the predicate on hand-made `Resources`, not that the tracker emits an all-`None` `LanePhi` in a real program; (2) the same `.all()` over `leaves()` pattern exists in `leonida-shader/src/emit/lower.rs` (two sites, now around lines 9326 and 9912); (3) a nested empty join next to a declared source. - Point (3), read in code only (`resource.rs`, `Source::leaves`): `leaves()` flattens, so a `Phi` of an empty `LanePhi` and a declared `Loaded` source yields one leaf and passes. This matches the semantics the PR's own test asserts on purpose (`LanePhi { args: [None, Some(bound)] }` passes: a live edge with a declared source is sufficient); the nested case is the same meaning one level deeper. I did not run it, so it is read, not measured. ### Not covered - No in-game run by me. The maintainer's firm request on the PR was a run of this head merged onto current `main`; the two posted runs above used older mains (`3e7b34a52`, 554 commits behind `b41763227`, and `913b88b90`), so that request is not met. A main-only comparison was asked for only "if you can"; it is absent too. - Linux/Wine not run by me. The CI state on a fresh run was not checked; the earlier red was in unrelated Python tests. - Reviewer points (1) and (2) are neither tested nor fixed; (3) is read in code only. ### Verdict PARTIAL. Not PASS, because two conditions are open: (a) no in-game run of this head merged onto current `main` (the maintainer's firm request; posted runs are on older mains), and (b) CI not re-checked on a fresh base. The fix itself is correct for the case it claims, its test is non-vacuous (4 of 4 mutations killed), and lib tests are green on merge (704 passed). The `lower.rs` sites and reviewer point (1) are follow-ups, not blockers. Once a run on current `main` and a green CI are posted, this can move to PASS. AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
OreoFR commented 2026-12-02 22:53:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T22:53:46Z.


In-game run (batch with #2891, #2911, #2952, #2965 on main f3865cae87, merged --no-ff): PASS

  • head 2e7c3467d8
  • RTX 4070 Laptop 8 GB, driver 621.40, Series S, no DLSS, no frame generation, BAR 0, texture budget 1024; 300 s in the world walking (W + J/L turns), 0 device removed, no crash, clean close; 25.2 fps / 39.7 ms over the last 296 s.

AI-assisted (oreofr-agent)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361299057 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7361299057). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T22:53:46Z. --- In-game run (batch with #2891, #2911, #2952, #2965 on main f3865cae87c963952067743a2684a9c2c3aaea5b, merged --no-ff): **PASS** - head 2e7c3467d8b001b47c1bef2d80366abc97d2f8be - RTX 4070 Laptop 8 GB, driver 621.40, Series S, no DLSS, no frame generation, BAR 0, texture budget 1024; 300 s in the world walking (W + J/L turns), 0 device removed, no crash, clean close; 25.2 fps / 39.7 ms over the last 296 s. AI-assisted (oreofr-agent)
fiestorra commented 2026-12-03 03:25:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:25:54Z.


VERIFY-2892 — el test nuevo pasa, y el cambio se separa en dos para poder probarlo

Un fichero, pipeline.rs, +50/−4, cuatro días abierto:

cargo test -p leonida-gpu --lib bound_view_stores_rejects   1 passed

Y lo que el cambio hace consigo mismo es la parte que quiero acreditar: saca bound_view_stores a una función propia, con este comentario:

"The proof over tracked IR, kept separate so missing descriptors and empty source joins can be tested without relying on the tracker to produce those conservative failure cases."

Eso es refactorizar para que el caso raro sea alcanzable desde un test — la alternativa habría sido un test que monta medio tracker para llegar a un estado que el tracker, en la práctica, casi nunca produce. Separar la función es más código y mucho menos test.

Y el caso que cubre es de los que fallan en silencio: un join de descriptores vacío en bound_view_stores — si no se rechaza, la textura se ve negra y nada en el log dice por qué.

Lo que no probé: un shader real con un join vacío — el test construye el IR a mano, que es exactamente lo que el comentario dice que buscaba.

Y una nota sobre la suite: como en #2841, el total de leonida-gpu tiene 1 falla y es la de la iGPU de esta máquina, no de esta PR — corrido su test solo, pasa.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366558849 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2892#issuecomment-7366558849). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:25:54Z. --- ## VERIFY-2892 — el test nuevo pasa, y el cambio se separa en dos para poder probarlo **Un fichero, `pipeline.rs`, +50/−4, cuatro días abierto**: ``` cargo test -p leonida-gpu --lib bound_view_stores_rejects 1 passed ``` **Y lo que el cambio hace consigo mismo es la parte que quiero acreditar**: **saca `bound_view_stores` a una función propia**, **con este comentario**: > *"The proof over tracked IR, kept separate so missing descriptors and empty source joins can be tested without relying on the tracker to produce those conservative failure cases."* **Eso es refactorizar para que el caso raro sea alcanzable desde un test** — **la alternativa habría sido un test que monta medio tracker para llegar a un estado que el tracker, en la práctica, casi nunca produce.** **Separar la función es más código y mucho menos test.** **Y el caso que cubre es de los que fallan en silencio**: **un *join* de descriptores vacío en `bound_view_stores`** — **si no se rechaza, la textura se ve negra y nada en el log dice por qué.** **Lo que no probé**: **un shader real con un *join* vacío** — **el test construye el IR a mano**, **que es exactamente lo que el comentario dice que buscaba.** **Y una nota sobre la suite**: **como en `#2841`, el total de `leonida-gpu` tiene 1 falla y es la de la iGPU de esta máquina, no de esta PR** — **corrido su test solo, pasa.**
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/2892:upstream-pr/2892'
git switch 'upstream-pr/2892'

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/2892'
git switch 'upstream-pr/2892'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2892'
git switch 'upstream-pr/2892'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2892'
git switch 'main'
git merge --squash 'upstream-pr/2892'
git switch 'main'
git merge --ff-only 'upstream-pr/2892'
git switch 'main'
git merge 'upstream-pr/2892'
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!2892
No description provided.