d3d12/pipeline: offload sample-mask twin builds to pipeline workers with bounded wait (D3D12-MASKED-TWIN-WORKER-WAIT) #3200

Open
zmasi wants to merge 7 commits from upstream-pr/3200 into main
zmasi commented 2026-12-02 18:31:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-02T18:31:52Z.


Claimed in the coordination issue as: D3D12-MASKED-TWIN-WORKER-WAIT (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7353810942)

Depends on: #3132 (stacked on #3132 head 8eedef9b4 merged with origin/main at 5d2dddbfe; this PR's own commit d1a91afd1 touches d3d12/crates/leonida-gpu/src/pipeline/make.rs only)

Addresses #3105 (does not close it: targets the open-world > 0.6–2.3 s list-thread freezes on cold sample-mask twin PSO compiles confirmed by @TripyFox in #3105; in-game validation on the reporter's RTX 3090 save remains to be run).

What and why

Routes pipeline::make::masked_for through ready instead of invoking Pending::make synchronously on leonida-list-* recording threads:

  1. Root cause confirmed in #3105:
    • Commit 65f372c08 ("gpu: honor coverage on the first masked draw") changed masked_for from made_or_start (0 ms wait) to a synchronous p.make() on the calling command-list thread so fast/cached masked twins would be ready on their first LOD-fade draw.
    • However, running p.make() directly on leonida-list-N bypassed leonida-pipelines-* workers, ignored LEONIDA_PIPELINE_WAIT_MS and LEONIDA_PIPELINE_WAIT_ONCE, left all pipeline worker threads idle when multiple list threads hit cold masked twins in the same frame, blocked second list threads hitting the same twin inside OnceLock's WaitOnAddress, skipped WAITING / C::PipelineWaitUs (waiting for pipelines) accounting, and skipped worker-side library::save(false).
    • On #3105, @TripyFox confirmed that 10 of 14 open-world log silences >= 600 ms and all 4 silences > 1 s (1.0–2.3 s) ended within 30 ms on host mesh pipeline shaders=[..., pixel ... masked], and LEONIDA_SAMPLE_MASK=0 reduced >= 1 s freezes from 5 to 1 (1,436 ms -> 716 ms longest silence).
  2. Worker offload + bounded wait (d3d12/crates/leonida-gpu/src/pipeline/make.rs):
    • masked_for resolves any render-target format variant (variant) as before and delegates to ready(p) (start(p, REQUESTED) + wait(p, crate::frame::current())).
    • Fast and pipeline-library-cached masked twins finish on leonida-pipelines-* within LEONIDA_PIPELINE_WAIT_MS (with AWAITED promotion and #3132's live-waiter THREAD_PRIORITY_NORMAL donation), preserving first-draw sample-mask coverage without LOD-fade flicker.
    • Cold multi-second driver compiles that exceed the frame's wait budget return None when the budget expires, leaving p.made unset (Gone::Making, never poisoned as Gone::Refused) and demoting the worker back to background priority while draw::State::graphics_pipeline (draw.rs:2537) falls back cleanly to the already-built unmasked pipeline until the worker publishes Some(HostPipeline).

Tested

  • Red -> Green + mutation check (d1a91afd1 onto --base 5d2dddbfe, #3132 head 8eedef9b4 merged with origin/main):
    • python -I scripts/red_green.py HEAD --base 5d2dddbfe --no-fetch --no-python --mutate (pipeline::make:: runner): verdict: red then green (2/2 new tests red -> green, 36/36 existing pipeline::make:: tests pass on both, code hunk make.rs:393 mutation caught).
  • Rust & repository suites (x86_64-pc-windows-msvc):
    • cargo test --locked --target x86_64-pc-windows-msvc -p leonida-gpu --lib pipeline:: — 67 passed, 0 failed, 8 ignored.
    • cargo test --locked --target x86_64-pc-windows-msvc -p leonida-gpu --features diagnostics --lib pipeline:: — 68 passed, 0 failed, 8 ignored.
    • cargo clippy --locked --target x86_64-pc-windows-msvc -p leonida-gpu [--features diagnostics] --all-targets --no-deps — exit 0 (0 warnings in pipeline/make.rs).
    • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md, python -I tests/test_d3d12_switches.py, python -I scripts/check_no_game_data.py, and python -I tests/test_text_write_line_endings.py — all exit 0.
    • Verified 3-way merge-clean (git apply --cached --3way, rc=0) against open PRs #2957 (pipeline.rs, pipeline/known.rs) and #3185 (pipeline/library.rs).

GPUs tested: NVIDIA GeForce RTX 3090 24 GB, driver 610.88, Windows 11 Pro 10.0.26200 (synthetic D3D12 compute PSO + pipeline worker scheduling and priority-donation tests; no retail title run).

AI-assisted: yes — authored with Gemini Carbon and independently audited in read-only mode by Gemini 4 Neon XHigh (opus-systems-critic).

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: no translator rule added).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5612450531 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-02T18:31:52Z. --- Claimed in the coordination issue as: `D3D12-MASKED-TWIN-WORKER-WAIT` (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7353810942) Depends on: #3132 (stacked on `#3132` head `8eedef9b4` merged with `origin/main` at `5d2dddbfe`; this PR's own commit `d1a91afd1` touches `d3d12/crates/leonida-gpu/src/pipeline/make.rs` only) Addresses #3105 (does not close it: targets the open-world `> 0.6–2.3 s` list-thread freezes on cold sample-mask twin PSO compiles confirmed by `@TripyFox` in #3105; in-game validation on the reporter's RTX 3090 save remains to be run). ### What and why Routes `pipeline::make::masked_for` through `ready` instead of invoking `Pending::make` synchronously on `leonida-list-*` recording threads: 1. **Root cause confirmed in `#3105`:** - Commit `65f372c08` (`"gpu: honor coverage on the first masked draw"`) changed `masked_for` from `made_or_start` (`0 ms` wait) to a synchronous `p.make()` on the calling command-list thread so fast/cached masked twins would be ready on their first LOD-fade draw. - However, running `p.make()` directly on `leonida-list-N` bypassed `leonida-pipelines-*` workers, ignored `LEONIDA_PIPELINE_WAIT_MS` and `LEONIDA_PIPELINE_WAIT_ONCE`, left all pipeline worker threads idle when multiple list threads hit cold masked twins in the same frame, blocked second list threads hitting the same twin inside `OnceLock`'s `WaitOnAddress`, skipped `WAITING` / `C::PipelineWaitUs` (`waiting for pipelines`) accounting, and skipped worker-side `library::save(false)`. - On `#3105`, `@TripyFox` confirmed that **10 of 14** open-world log silences `>= 600 ms` and **all 4** silences `> 1 s` (`1.0–2.3 s`) ended within `30 ms` on `host mesh pipeline shaders=[..., pixel ... masked]`, and `LEONIDA_SAMPLE_MASK=0` reduced `>= 1 s` freezes from `5` to `1` (`1,436 ms -> 716 ms` longest silence). 2. **Worker offload + bounded wait (`d3d12/crates/leonida-gpu/src/pipeline/make.rs`):** - `masked_for` resolves any render-target format variant (`variant`) as before and delegates to `ready(p)` (`start(p, REQUESTED)` + `wait(p, crate::frame::current())`). - Fast and pipeline-library-cached masked twins finish on `leonida-pipelines-*` within `LEONIDA_PIPELINE_WAIT_MS` (with `AWAITED` promotion and `#3132`'s live-waiter `THREAD_PRIORITY_NORMAL` donation), preserving first-draw sample-mask coverage without LOD-fade flicker. - Cold multi-second driver compiles that exceed the frame's wait budget return `None` when the budget expires, leaving `p.made` unset (`Gone::Making`, never poisoned as `Gone::Refused`) and demoting the worker back to background priority while `draw::State::graphics_pipeline` (`draw.rs:2537`) falls back cleanly to the already-built unmasked pipeline until the worker publishes `Some(HostPipeline)`. ### Tested - **Red -> Green + mutation check (`d1a91afd1` onto `--base 5d2dddbfe`, `#3132` head `8eedef9b4` merged with `origin/main`):** - `python -I scripts/red_green.py HEAD --base 5d2dddbfe --no-fetch --no-python --mutate` (`pipeline::make::` runner): `verdict: red then green` (`2/2` new tests `red -> green`, `36/36` existing `pipeline::make::` tests pass on both, code hunk `make.rs:393` mutation caught). - **Rust & repository suites (`x86_64-pc-windows-msvc`):** - `cargo test --locked --target x86_64-pc-windows-msvc -p leonida-gpu --lib pipeline::` — `67 passed, 0 failed, 8 ignored`. - `cargo test --locked --target x86_64-pc-windows-msvc -p leonida-gpu --features diagnostics --lib pipeline::` — `68 passed, 0 failed, 8 ignored`. - `cargo clippy --locked --target x86_64-pc-windows-msvc -p leonida-gpu [--features diagnostics] --all-targets --no-deps` — exit `0` (`0` warnings in `pipeline/make.rs`). - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md`, `python -I tests/test_d3d12_switches.py`, `python -I scripts/check_no_game_data.py`, and `python -I tests/test_text_write_line_endings.py` — all exit `0`. - Verified 3-way merge-clean (`git apply --cached --3way`, `rc=0`) against open PRs `#2957` (`pipeline.rs`, `pipeline/known.rs`) and `#3185` (`pipeline/library.rs`). GPUs tested: NVIDIA GeForce RTX 3090 24 GB, driver 610.88, Windows 11 Pro `10.0.26200` (synthetic D3D12 compute PSO + pipeline worker scheduling and priority-donation tests; no retail title run). AI-assisted: yes — authored with Gemini Carbon and independently audited in read-only mode by Gemini 4 Neon XHigh (`opus-systems-critic`). ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed (n/a: no translator rule added).
Kal0s-design commented 2026-12-02 19:00:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T19:00:38Z.


Ran natively on Windows 11, head d1a91afd1 merged into current main (f1a559851, clean merge).

The branch still carries #3132 (completion.rs, completion_tests.rs, library.rs, switches.md, most of make.rs), so the merge needs #3132 first. This PR's own change is the one masked_for hunk (now ready(p)) plus its tests. To keep the two apart I also ran "merge with that hunk reverted" (= main + #3132 + the new tests).

Suites (leonida-gpu --lib, --test-threads=4)

tree card WARP card, debug layer
main 703 passed, 0 failed, 59 ignored
merge 711 passed, 0 failed, 59 ignored 711 / 0 / 59 711 / 0 / 59
merge, --features diagnostics 792 passed, 0 failed, 59 ignored

The +8 are 2 from this PR and 6 from #3132.

Red check (masked_for hunk reverted, tests kept): both new tests fail, masked_twin_dispatches_to_pipeline_worker_with_priority_donation (built on the caller thread) and masked_twin_exceeding_wait_budget_returns_promptly_and_resolves_once_built (caller stalled 813 ms against a 40 ms budget). The other pipeline:: tests pass: 65 passed, 2 failed, 8 ignored.

Clippy --all-targets --no-deps: 0 warnings on the merge, 12 with --features diagnostics on both main and the merge, none in pipeline/. So no new warnings.

Switch (read). There's no new switch and nothing that brings back the old inline build. The switches.md line is #3132's rewording of LEONIDA_PIPELINE_LOWEST. The bound on a twin is the normal pipeline wait budget (LEONIDA_PIPELINE_WAIT_MS, per-pipeline with WAIT_ONCE, shared per frame). When it runs out, masked_for returns None and graphics_pipeline draws with the unmasked pipeline. It is not dropped, not built inline and not blocked. The twin stays queued and is picked up on a later draw. Twin builds have no queue limit of their own.

Concurrency, measured. Throwaway tests, not part of the PR. They use empty-shader Pendings, which are refused before any D3D12 call, so they test scheduling and not the driver. Card vs WARP doesn't change anything for them. 50 iterations on the card, 50 on WARP and 5 with the debug layer, all on the merge, all passed. The PR's own three masked tests also passed 50/50 on the card and 50/50 on WARP.

scenario result
12 threads x 32 twins (half are format variants), all threads hit the same key first, workers 1/4/16, wait 0/1/500 ms every twin ends Refused, no hangs, one variant per format set, waiting() back to 0, longest pair of calls 270 ms at 500 ms budget, under 10 ms at 0/1 ms
twin build panics (catch on) Refused, caller unaffected, next twin fine
twin build panics with LEONIDA_PIPELINE_PANIC_CATCH=0, 1 worker worker thread dies, twin stays Making for good, later twins never made, caller doesn't panic (before this PR the recording thread panicked). That is the same as any other pipeline under that switch
process exit with the only worker inside a build and 63 twins queued clean exit in about 30 ms

The trade-off, measured. One case changes in a way you can see. If a frame has already used up its wait budget on another pipeline (a cold plain pipeline, say), a twin asked for later in that same frame gets no wait at all, even when it would build in microseconds and workers are idle:

workers, budget this PR: twin made when masked_for returns hunk reverted
2 or 4, 50 ms no (returns after ~0.3 ms) yes
2 or 4, 200 ms no yes
same, next frame yes yes

So in frames that are already waiting on cold pipelines, the first masked draws go out unmasked, which is the LOD-fade case 65f372c08 fixed. It lasts one frame per twin when the twin is fast. That seems a fair price for the 0.6–2.3 s stalls in #3105, but it would be good to say so in the PR. Along the same lines, the PR rewrote first_masked_draw_observes_the_finished_build. With the old body (twin already marked MAKING), the merge now waits the full 500 ms and returns with the twin unmade, where main returned the finished refusal at once. So the old invariant is gone, not just moved to a new test.

Races (read). Build twice: no, the worker, the no-worker fallback in start and now() all go through the same OnceLock (I couldn't count builds in the stress test because the refusal is logged once per process). A draw seeing the twin missing is the intended fallback. Stale twin after a library reset: n/a, I found no path that clears made or masked, and the twin belongs to the title pipeline. Small thing: when a twin uses up its own budget, wait_with logs "its draws are dropped until it is", but a masked draw isn't dropped, it uses the unmasked pipeline.

Other open PRs (git merge-tree against the merge, all clean): #2588, #2654, #2774, #2789, #2919, #2957, #3071, #3150, #3185.

  • #3185 (read): with its compile gate, a twin on a worker waits behind any other compile. Here that wait is capped by the budget. Before this PR the list thread would have sat in the gate with no limit, so the two fit together. The priority boost from #3132 doesn't pass through that mutex, though. A boosted twin worker can sit behind a gate held by a worker at lowest priority.
  • #2957 (warm masked twins into the book) and #3150 (warm build once): these work together with this PR. A warmed or cached twin finishes inside the budget.
  • #2588 (64 MB worker stack): twin compiles now run on worker stacks instead of list threads. Both are default-size on main, so nothing changes today.

Not checked: in-game run or any retail title, a real masked draw on the GPU (the only sample-mask test in draw.rs checks the mask word and builds no pipeline), timing under a real cold driver compile, release build, Wine.

GPUs tested: one NVIDIA desktop card + WARP

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7355485963 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7355485963). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T19:00:38Z. --- Ran natively on Windows 11, head `d1a91afd1` merged into current `main` (`f1a559851`, clean merge). The branch still carries #3132 (completion.rs, completion_tests.rs, library.rs, switches.md, most of make.rs), so the merge needs #3132 first. This PR's own change is the one `masked_for` hunk (now `ready(p)`) plus its tests. To keep the two apart I also ran "merge with that hunk reverted" (= main + #3132 + the new tests). **Suites (`leonida-gpu --lib`, `--test-threads=4`)** | tree | card | WARP | card, debug layer | |---|---|---|---| | main | 703 passed, 0 failed, 59 ignored | | | | merge | 711 passed, 0 failed, 59 ignored | 711 / 0 / 59 | 711 / 0 / 59 | | merge, `--features diagnostics` | 792 passed, 0 failed, 59 ignored | | | The +8 are 2 from this PR and 6 from #3132. Red check (masked_for hunk reverted, tests kept): both new tests fail, `masked_twin_dispatches_to_pipeline_worker_with_priority_donation` (built on the caller thread) and `masked_twin_exceeding_wait_budget_returns_promptly_and_resolves_once_built` (caller stalled 813 ms against a 40 ms budget). The other `pipeline::` tests pass: 65 passed, 2 failed, 8 ignored. Clippy `--all-targets --no-deps`: 0 warnings on the merge, 12 with `--features diagnostics` on both main and the merge, none in `pipeline/`. So no new warnings. **Switch (read).** There's no new switch and nothing that brings back the old inline build. The switches.md line is #3132's rewording of `LEONIDA_PIPELINE_LOWEST`. The bound on a twin is the normal pipeline wait budget (`LEONIDA_PIPELINE_WAIT_MS`, per-pipeline with `WAIT_ONCE`, shared per frame). When it runs out, `masked_for` returns `None` and `graphics_pipeline` draws with the unmasked pipeline. It is not dropped, not built inline and not blocked. The twin stays queued and is picked up on a later draw. Twin builds have no queue limit of their own. **Concurrency, measured.** Throwaway tests, not part of the PR. They use empty-shader `Pending`s, which are refused before any D3D12 call, so they test scheduling and not the driver. Card vs WARP doesn't change anything for them. 50 iterations on the card, 50 on WARP and 5 with the debug layer, all on the merge, all passed. The PR's own three masked tests also passed 50/50 on the card and 50/50 on WARP. | scenario | result | |---|---| | 12 threads x 32 twins (half are format variants), all threads hit the same key first, workers 1/4/16, wait 0/1/500 ms | every twin ends `Refused`, no hangs, one variant per format set, `waiting()` back to 0, longest pair of calls 270 ms at 500 ms budget, under 10 ms at 0/1 ms | | twin build panics (catch on) | `Refused`, caller unaffected, next twin fine | | twin build panics with `LEONIDA_PIPELINE_PANIC_CATCH=0`, 1 worker | worker thread dies, twin stays `Making` for good, later twins never made, caller doesn't panic (before this PR the recording thread panicked). That is the same as any other pipeline under that switch | | process exit with the only worker inside a build and 63 twins queued | clean exit in about 30 ms | **The trade-off, measured.** One case changes in a way you can see. If a frame has already used up its wait budget on another pipeline (a cold plain pipeline, say), a twin asked for later in that same frame gets no wait at all, even when it would build in microseconds and workers are idle: | workers, budget | this PR: twin made when `masked_for` returns | hunk reverted | |---|---|---| | 2 or 4, 50 ms | no (returns after ~0.3 ms) | yes | | 2 or 4, 200 ms | no | yes | | same, next frame | yes | yes | So in frames that are already waiting on cold pipelines, the first masked draws go out unmasked, which is the LOD-fade case 65f372c08 fixed. It lasts one frame per twin when the twin is fast. That seems a fair price for the 0.6–2.3 s stalls in #3105, but it would be good to say so in the PR. Along the same lines, the PR rewrote `first_masked_draw_observes_the_finished_build`. With the old body (twin already marked `MAKING`), the merge now waits the full 500 ms and returns with the twin unmade, where main returned the finished refusal at once. So the old invariant is gone, not just moved to a new test. **Races (read).** Build twice: no, the worker, the no-worker fallback in `start` and `now()` all go through the same `OnceLock` (I couldn't count builds in the stress test because the refusal is logged once per process). A draw seeing the twin missing is the intended fallback. Stale twin after a library reset: n/a, I found no path that clears `made` or `masked`, and the twin belongs to the title pipeline. Small thing: when a twin uses up its own budget, `wait_with` logs "its draws are dropped until it is", but a masked draw isn't dropped, it uses the unmasked pipeline. **Other open PRs** (`git merge-tree` against the merge, all clean): #2588, #2654, #2774, #2789, #2919, #2957, #3071, #3150, #3185. - #3185 (read): with its compile gate, a twin on a worker waits behind any other compile. Here that wait is capped by the budget. Before this PR the list thread would have sat in the gate with no limit, so the two fit together. The priority boost from #3132 doesn't pass through that mutex, though. A boosted twin worker can sit behind a gate held by a worker at lowest priority. - #2957 (warm masked twins into the book) and #3150 (warm build once): these work together with this PR. A warmed or cached twin finishes inside the budget. - #2588 (64 MB worker stack): twin compiles now run on worker stacks instead of list threads. Both are default-size on main, so nothing changes today. Not checked: in-game run or any retail title, a real masked draw on the GPU (the only sample-mask test in `draw.rs` checks the mask word and builds no pipeline), timing under a real cold driver compile, release build, Wine. GPUs tested: one NVIDIA desktop card + WARP AI-assisted: yes (Claude Code).
Kal0s-design commented 2026-12-02 19:38:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T19:38:43Z.


Correction to my comment above. In leonida-gpu, LEONIDA_D3D12_WARP and LEONIDA_D3D12_DEBUG only take effect in a build with --features diagnostics (host.rs, cfg!(feature = "diagnostics") && switch::on(..)). My WARP and debug-layer runs were built without it, so they were repeats on the card.

What that changes:

  • The suite table's "WARP" and "card, debug layer" columns (711 / 0 / 59) are card runs. Only the card column is real.
  • "50 iterations on WARP and 5 with the debug layer" for the stress tests, and "50/50 on WARP" for the PR's masked tests, were card runs too. The stress tests use refused empty-shader pipelines and never reach a device, so their findings stand. They just aren't evidence for any adapter.
  • "GPUs tested" should read: one NVIDIA desktop card. No WARP, no debug layer.

The rest is unaffected: the merge, the red check, clippy, the merge-tree results and the same-frame budget finding were all measured on the card.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7356499137 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7356499137). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T19:38:43Z. --- Correction to my comment above. In `leonida-gpu`, `LEONIDA_D3D12_WARP` and `LEONIDA_D3D12_DEBUG` only take effect in a build with `--features diagnostics` (`host.rs`, `cfg!(feature = "diagnostics") && switch::on(..)`). My WARP and debug-layer runs were built without it, so they were repeats on the card. What that changes: - The suite table's "WARP" and "card, debug layer" columns (711 / 0 / 59) are card runs. Only the card column is real. - "50 iterations on WARP and 5 with the debug layer" for the stress tests, and "50/50 on WARP" for the PR's masked tests, were card runs too. The stress tests use refused empty-shader pipelines and never reach a device, so their findings stand. They just aren't evidence for any adapter. - "GPUs tested" should read: one NVIDIA desktop card. No WARP, no debug layer. The rest is unaffected: the merge, the red check, clippy, the merge-tree results and the same-frame budget finding were all measured on the card. AI-assisted: yes (Claude Code).
lixonik commented 2026-12-02 20:17:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T20:17:48Z.


RUN (in game) -- unit tests + 300 s render-path verification for PR #3200:

  • PR head SHA: d1a91afd1
  • Merged onto main SHA: f1a559851 (git merge --no-ff, clean merge; includes stacked #3132 commits)
  • Clean-room & switch-table checks:
    • python -I scripts/check_no_game_data.py PASS
    • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md PASS
  • Unit tests (Windows 10 x64, Rust 1.98.1): cargo test -p leonida-gpu --features diagnostics --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws -- 67 passed, 0 failed, 8 ignored (pre-existing Win10 test tracked in #2855 skipped)
  • Build: diag profile (diagnostics,dlss,mimalloc), Series S profile, DLSS on, Frame Gen off, same restored save snapshot
  • GPU / Driver / OS: NVIDIA GeForce RTX 5070 (12 GB), driver 595.79, Windows 10 x64
Run Time in world World samples Device lost / crashes / errors Median rendered FPS (ms) Slowest / fastest tenth (fps) Median draws
PR #3200 (d1a91afd1 on f1a559851) 315 s (459.2 s total) 64 0 / 0 / 0 26.7 fps (37.5 ms) 20.2 / 27.7 4,392
main alone (f1a559851) 303.2 s (480.0 s total) 62 0 / 0 / 0 27.2 fps (36.8 ms) 21.8 / 28.7 4,385

Loaded cleanly into the world, stayed up past 300 s in-world with 0 device lost / 0 crashes / 0 ERROR lines, and closed cleanly. Steady-state FPS matches main within single-run variance.

Verdict: PASS.

AI-assisted: yes (Antigravity).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7357516979 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7357516979). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T20:17:48Z. --- RUN (in game) -- unit tests + 300 s render-path verification for PR #3200: - **PR head SHA:** `d1a91afd1` - **Merged onto `main` SHA:** `f1a559851` (`git merge --no-ff`, clean merge; includes stacked #3132 commits) - **Clean-room & switch-table checks:** - `python -I scripts/check_no_game_data.py` PASS - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` PASS - **Unit tests (Windows 10 x64, Rust 1.98.1):** `cargo test -p leonida-gpu --features diagnostics --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws` -- **67 passed, 0 failed, 8 ignored** (pre-existing Win10 test tracked in #2855 skipped) - **Build:** `diag` profile (`diagnostics,dlss,mimalloc`), Series S profile, DLSS on, Frame Gen off, same restored save snapshot - **GPU / Driver / OS:** NVIDIA GeForce RTX 5070 (12 GB), driver 595.79, Windows 10 x64 | Run | Time in world | World samples | Device lost / crashes / errors | Median rendered FPS (ms) | Slowest / fastest tenth (fps) | Median draws | | --- | ---: | ---: | --- | ---: | ---: | ---: | | **PR #3200 (`d1a91afd1` on `f1a559851`)** | 315 s (459.2 s total) | 64 | **0 / 0 / 0** | **26.7 fps** (37.5 ms) | 20.2 / 27.7 | 4,392 | | **`main` alone (`f1a559851`)** | 303.2 s (480.0 s total) | 62 | **0 / 0 / 0** | **27.2 fps** (36.8 ms) | 21.8 / 28.7 | 4,385 | Loaded cleanly into the world, stayed up past 300 s in-world with 0 device lost / 0 crashes / 0 `ERROR` lines, and closed cleanly. Steady-state FPS matches `main` within single-run variance. Verdict: **PASS**. AI-assisted: yes (Antigravity).
icdmkg2 commented 2026-12-02 20:36:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by icdmkg2 on 2026-12-02T20:36:17Z.


Third-party Windows verification of #3200 (D3D12-MASKED-TWIN-WORKER-WAIT) on head d1a91afd1 (--features diagnostics, HW + WARP + D3D12 Debug Layer)

Adds the --features diagnostics WARP + D3D12 Debug Layer run noted as missing above.

  • Head / base: d1a91afd1 merged cleanly (git merge --no-ff) onto origin/main b41763227 (still carries stacked #3132 commits, so #3132 remains a prerequisite).
  • Machine: NVIDIA GeForce RTX 5060 Laptop GPU (8 GB, Profile M laptop), driver 621.24 (32.0.16.2124), AMD Ryzen 7 H 260 w/ Radeon 780M, 32 GB RAM, Windows 11 10.0.26300.9974, rustc 1.98.1.
  • Scope: synthetic / D3D12 hardware + WARP + D3D12 debug-layer unit tests with --features diagnostics (no retail title run).

Results (MEASURED)

Check Result
python -I scripts/check_no_game_data.py (all 5 touched files) exit 0
python -I tools/d3d12_switches.py --check d3d12/docs/switches.md exit 0
LEONIDA_ADAPTER=5060 + LEONIDA_D3D12_DEBUG=1 cargo test -p leonida-gpu --features diagnostics --locked --lib -- pipeline:: --skip depth_bounds_pipeline_loads_and_filters_draws 67 passed, 0 failed, 8 ignored (including first_masked_draw_observes_the_finished_build, masked_twin_dispatches_to_pipeline_worker_with_priority_donation, and masked_twin_exceeding_wait_budget_returns_promptly_and_resolves_once_built)
LEONIDA_D3D12_WARP=1 + LEONIDA_D3D12_DEBUG=1 (same pipeline:: command, --features diagnostics) 67 passed, 0 failed, 8 ignored

AI-assisted: Gemini 4 Neon (High) via Antigravity (test execution, diff review, and write-up).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358008864 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7358008864). Originally posted by [icdmkg2](https://github.com/icdmkg2) on 2026-12-02T20:36:17Z. --- **Third-party Windows verification of #3200 (`D3D12-MASKED-TWIN-WORKER-WAIT`) on head `d1a91afd1` (`--features diagnostics`, HW + WARP + D3D12 Debug Layer)** Adds the `--features diagnostics` WARP + D3D12 Debug Layer run noted as missing above. - **Head / base:** `d1a91afd1` merged cleanly (`git merge --no-ff`) onto `origin/main` `b41763227` (still carries stacked #3132 commits, so #3132 remains a prerequisite). - **Machine:** NVIDIA GeForce RTX 5060 Laptop GPU (8 GB, Profile M laptop), driver `621.24` (`32.0.16.2124`), AMD Ryzen 7 H 260 w/ Radeon 780M, 32 GB RAM, Windows 11 `10.0.26300.9974`, `rustc 1.98.1`. - **Scope:** synthetic / D3D12 hardware + WARP + D3D12 debug-layer unit tests with `--features diagnostics` (no retail title run). ### Results (MEASURED) | Check | Result | |---|---| | `python -I scripts/check_no_game_data.py` (all 5 touched files) | exit `0` | | `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` | exit `0` | | `LEONIDA_ADAPTER=5060` + `LEONIDA_D3D12_DEBUG=1` `cargo test -p leonida-gpu --features diagnostics --locked --lib -- pipeline:: --skip depth_bounds_pipeline_loads_and_filters_draws` | `67 passed, 0 failed, 8 ignored` (including `first_masked_draw_observes_the_finished_build`, `masked_twin_dispatches_to_pipeline_worker_with_priority_donation`, and `masked_twin_exceeding_wait_budget_returns_promptly_and_resolves_once_built`) | | `LEONIDA_D3D12_WARP=1` + `LEONIDA_D3D12_DEBUG=1` (same `pipeline::` command, `--features diagnostics`) | `67 passed, 0 failed, 8 ignored` | AI-assisted: Gemini 4 Neon (High) via Antigravity (test execution, diff review, and write-up).
EdenBendheim commented 2026-12-02 21:01:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T21:01:09Z.


RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch) — PASS covering exact head d1a91afd1f011eb8b14f98b1fadfe72a5dd20904.

  • Base & build: Merged cleanly via git merge --no-ff onto main b41763227 (diagnostics,dlss,mimalloc, exe_sha16 = c47eeb717f761d9d; changed-file clean-room scan exit 0; workspace test targets compiled).
  • Batch heads (14 PRs): #3200 d1a91afd1, #3198 80a627bb1, #3191 93b47ac9d, #3189 c182fc392, #3176 ae0075d9a, #3168 337388052, #3164 1065952da, #3146 ebc0253ff, #3124 64600ef0c, #3069 311d33a40, #3031 8df1bfce7, #3029 e49404808, #3054 ff53fd8b9, #3010 d645712a3.
  • Hardware & setup: Windows 11, Ryzen 9 5900X (32 GB RAM), NVIDIA GeForce RTX 3090 24 GB, driver 610.88, Series X profile, 2560x1440, -NoFrameGen, scripts/game-gate.ps1 (301.3 s in world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (GATE CONTROL moved=2.51 m, max_from_ctrl=5,053.9 m).
Metric 14-PR Batch (c47eeb717f761d9d) main b41763227 baseline (cf499737bf684f6a)
Gate verdict / exit PASS (clean, 0 reasons, 0 warnings) PASS (clean, 0 reasons, 0 warnings)
World time 301.3 s (4,504 frames) 305.6 s
Device lost / crashes / missed pipeline waits 0 / 0 / 0 0 / 0 / 0
Rendered FPS (median) / p95 frame time 20.10 FPS / 69.76 ms 19.13 FPS / 74.01 ms
Median draws/frame / longest present gap 8,048 / 5.222 s 7,983 / 2.358 s
Peak private commit / peak VRAM 35,619 MB / 15,251 MB 37,803 MB / 16,220 MB

Verdict: PASS for the 300 s in-game stability gate on d1a91afd1. (Single combined-batch stability check, not an isolated single-PR FPS gain measurement; if the head changes, this run no longer covers it.)

(AI-assisted verification: gemini-4-neon + gpt-6.2-astra.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358670450 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7358670450). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-02T21:01:09Z. --- **RUN (in-game RTX 3090 300 s stress gate, 14-PR combined batch)** — **PASS** covering exact head `d1a91afd1f011eb8b14f98b1fadfe72a5dd20904`. - **Base & build:** Merged cleanly via `git merge --no-ff` onto `main` `b41763227` (`diagnostics,dlss,mimalloc`, `exe_sha16 = c47eeb717f761d9d`; changed-file clean-room scan exit `0`; workspace test targets compiled). - **Batch heads (`14` PRs):** `#3200` `d1a91afd1`, `#3198` `80a627bb1`, `#3191` `93b47ac9d`, `#3189` `c182fc392`, `#3176` `ae0075d9a`, `#3168` `337388052`, `#3164` `1065952da`, `#3146` `ebc0253ff`, `#3124` `64600ef0c`, `#3069` `311d33a40`, `#3031` `8df1bfce7`, `#3029` `e49404808`, `#3054` `ff53fd8b9`, `#3010` `d645712a3`. - **Hardware & setup:** Windows 11, Ryzen 9 5900X (32 GB RAM), NVIDIA GeForce RTX 3090 24 GB, driver `610.88`, Series X profile, `2560x1440`, `-NoFrameGen`, `scripts/game-gate.ps1` (`301.3 s` in world) with downtown street-level teleport + 8-leg dynamic sprint/turn/strafe stress mod (`GATE CONTROL moved=2.51 m`, `max_from_ctrl=5,053.9 m`). | Metric | 14-PR Batch (`c47eeb717f761d9d`) | `main` `b41763227` baseline (`cf499737bf684f6a`) | |---|---:|---:| | Gate verdict / exit | **PASS** (`clean`, `0` reasons, `0` warnings) | **PASS** (`clean`, `0` reasons, `0` warnings) | | World time | `301.3 s` (`4,504` frames) | `305.6 s` | | Device lost / crashes / missed pipeline waits | `0` / `0` / `0` | `0` / `0` / `0` | | Rendered FPS (median) / p95 frame time | `20.10 FPS` / `69.76 ms` | `19.13 FPS` / `74.01 ms` | | Median draws/frame / longest present gap | `8,048` / `5.222 s` | `7,983` / `2.358 s` | | Peak private commit / peak VRAM | `35,619 MB` / `15,251 MB` | `37,803 MB` / `16,220 MB` | **Verdict:** **PASS** for the 300 s in-game stability gate on `d1a91afd1`. *(Single combined-batch stability check, not an isolated single-PR FPS gain measurement; if the head changes, this run no longer covers it.)* *(AI-assisted verification: `gemini-4-neon` + `gpt-6.2-astra`.)*
fiestorra commented 2026-12-02 21:20:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T21:20:09Z.


VERIFY-3200 — Windows nativo: los tests pasan, el control muerde, y el PR trae #3132 dentro

Head (this PR)
Merge base 45dc41f95 (behind main b41763227)
Merged onto main — merge-tree clean, git merge --no-ff clean (switches.md auto-merged)

Ran

cargo test -p leonida-gpu --lib     710 passed; 1 failed; 59 ignored   (16.7 s)
  pipeline::make::completion_tests::*  (8 new tests) ... ok

The one failure is this machine's, unchanged all day: descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in (the iGPU artefact of D3D12CreateDevice(None, ..) that #2995 addresses).

Negative control (synthetic — the tests ship with the change): I made Worker::boost a no-op under a test variable, rebuilt and ran → FAILED: priority_tracks_live_waiters_during_an_early_build, assertion left == right failed. The priority tests bite.

The thing a merger should know: this branch carries #3132

git log 45dc41f95..refs/pull/3200 is:

d1a91afd1 perf(gpu): build sample-mask pipeline twins on workers within wait budget
5d2dddbfe Merge origin/main
8eedef9b4 Merge origin/main into perf/d3d12-pipeline-wait-and-slow-early
20dab512d d3d12: donate pipeline worker priority only for live waits
958bdee65 d3d12: wake and boost only the pipeline a recording thread needs

#3132 ("per-pipeline waiter wakeups and live-waiter priority") is still OPEN, and its two commits are inside this branch. Merging #3200 as it stands lands #3132's work as well — so either merge #3132 first (and this becomes a clean diff against it), or a maintainer should knowingly approve both in one go. The body does say "Depends on: #3132", but the merge button does not.

Correspondingly, my run above exercised both PRs together — that is the state the branch is in, and it is the state a merge would produce.

What I read and what I could not test

  • The unit side is what can be checked here: refusal wakes every waiter independently, a waiter whose budget expired does not boost a later build, and the boost is restored even on unwind (a_worker_with_a_waiter_restores_its_priority_even_on_unwind) — that last one is the test I would have written: a panicking build must not leave worker threads at normal priority for the rest of the run.
  • The freezes this targets (#3105, the > 0.6–2.3 s list-thread silences): needs a game run with a cold sample-mask twin; no run here, and the thresholds are timing-dependent.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359133406 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7359133406). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T21:20:09Z. --- ## VERIFY-3200 — Windows nativo: los tests pasan, el control muerde, y el PR trae #3132 dentro | | | |---|---| | Head | `(this PR)` | | Merge base | `45dc41f95` (behind `main` `b41763227`) | | Merged onto | `main` — `merge-tree` clean, `git merge --no-ff` clean (`switches.md` auto-merged) | **Ran** ``` cargo test -p leonida-gpu --lib 710 passed; 1 failed; 59 ignored (16.7 s) pipeline::make::completion_tests::* (8 new tests) ... ok ``` **The one failure is this machine's**, unchanged all day: `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` (the iGPU artefact of `D3D12CreateDevice(None, ..)` that #2995 addresses). **Negative control (synthetic — the tests ship with the change)**: I made `Worker::boost` a no-op under a test variable, rebuilt and ran → `FAILED: priority_tracks_live_waiters_during_an_early_build`, `assertion left == right failed`. **The priority tests bite.** ## The thing a merger should know: this branch carries #3132 `git log 45dc41f95..refs/pull/3200` is: ``` d1a91afd1 perf(gpu): build sample-mask pipeline twins on workers within wait budget 5d2dddbfe Merge origin/main 8eedef9b4 Merge origin/main into perf/d3d12-pipeline-wait-and-slow-early 20dab512d d3d12: donate pipeline worker priority only for live waits 958bdee65 d3d12: wake and boost only the pipeline a recording thread needs ``` **`#3132` ("per-pipeline waiter wakeups and live-waiter priority") is still OPEN**, and its two commits are inside this branch. **Merging #3200 as it stands lands #3132's work as well** — so either merge #3132 first (and this becomes a clean diff against it), or a maintainer should knowingly approve both in one go. The body does say "Depends on: #3132", but the merge button does not. **Correspondingly, my run above exercised both PRs together** — that is the state the branch is in, and it is the state a merge would produce. ## What I read and what I could not test - **The unit side is what can be checked here**: refusal wakes every waiter independently, a waiter whose budget expired does not boost a later build, and the boost is restored **even on unwind** (`a_worker_with_a_waiter_restores_its_priority_even_on_unwind`) — that last one is the test I would have written: a panicking build must not leave worker threads at normal priority for the rest of the run. - **The freezes this targets (#3105, the `> 0.6–2.3 s` list-thread silences)**: needs a game run with a cold sample-mask twin; no run here, and the thresholds are timing-dependent. Written with an AI assistant.
x2Tweek commented 2026-12-02 22:28:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-12-02T22:28:37Z.


Game run on an RTX 5090 with hardware RT: a device loss about 6 minutes in, with masked twins loading from the workers just before. The same build without this PR ran clean right after.

Setup: RTX 5090 32 GB, driver 621.40, i9-14900KS, 64 GB DDR5, Windows 11 (26300). Base: upstream main
0d7a451ab plus #3113, #3182 and #3204, plus two local hardware-RT CPU changes (index-buffer arena, BLAS buffer
pool), diag build. Candidate: the same plus this PR at d1a91afd1. Series X profile, 3840x2160 output, render
scale 0.6667, -HardwareRT -SmoothMotion -PrecompileAll -Log, LEONIDA_PIPELINE_WAIT_MS=0, fullscreen.

Tests: cargo test -p leonida-gpu --lib pipeline gives 67 passed, 0 failed and 8 ignored.

Run with this PR: I loaded the save at the player's house, then drove.

  • Device loss at 22:16:28 UTC, about 6 minutes into the session:
    relay: fence 18446744073709551615 did not reach 290299; device removed ... (0x887A0006) (DXGI_ERROR_DEVICE_HUNG),
    and device-removed data; none (DRED was not on).
  • The last events the crash report lists, in the 8 s before the loss, are about ten masked twins loaded from the
    library on separate threads. For example:
    8080.0 ms before, thread 25768: pipeline library: loaded [mesh 8fc72d8fa74c12f0, pixel 3488a0567a9d10df masked] in 132.3 ms
    7974.8 ms before, thread 33456: pipeline library: loaded [mesh 41b1fbed3ee9b8ff, pixel b36c288fccc767b0 masked] in 236.5 ms
    1844.1 ms before, thread 35780: pipeline library: loaded [mesh 9c6c7fb345f39611, pixel 68cf7088c42fc83f masked] in 7.0 ms
    
  • Before the loss there were no frames over 1 s (the longest was about 116 ms), so the stalls this PR targets
    were gone while it ran.
  • Glass: the glass doors of the house showed a speckled, stippled pattern (screenshot available). With the build without this PR, at the same door, the glass was clean. That looks like masked draws going out without their sample-mask twin while it is still being made.

Same build without this PR, launched right after: 4+ minutes of driving, no device loss, 0 frames over 1 s,
20.8 fps median.

Context: I ran this hardware-RT setup about eight times today on this card and never lost the device until
this run. One run is not proof, and DRED was off. A repro with LEONIDA_D3D12_DRED=1 would name the command.
The timing points at the worker-made masked twins being used while still in flight, or a twin and its base
pipeline disagreeing in state.

The cold masked-twin stalls themselves are real here: an earlier run without this PR had frames of 1015 ms and
1946 ms, each right after masked twins were made synchronously in masked_for (pipeline/make.rs), with
LEONIDA_PIPELINE_WAIT_MS=0 not applying to them. So the PR's aim is right; it is the stability that needs a look.

AI-assisted: the builds, the runs, the log reading and the write-up were done with Claude Opus 5.5 (Claude Code),
with a log analysis by GPT-6.2 Sol (Codex); the numbers are the runtime's own log lines, and the glass observation
is the player's.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360745534 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7360745534). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-12-02T22:28:37Z. --- Game run on an RTX 5090 with hardware RT: a device loss about 6 minutes in, with masked twins loading from the workers just before. The same build without this PR ran clean right after. **Setup:** RTX 5090 32 GB, driver 621.40, i9-14900KS, 64 GB DDR5, Windows 11 (26300). Base: upstream main `0d7a451ab` plus #3113, #3182 and #3204, plus two local hardware-RT CPU changes (index-buffer arena, BLAS buffer pool), diag build. Candidate: the same plus this PR at `d1a91afd1`. Series X profile, 3840x2160 output, render scale 0.6667, `-HardwareRT -SmoothMotion -PrecompileAll -Log`, `LEONIDA_PIPELINE_WAIT_MS=0`, fullscreen. **Tests:** `cargo test -p leonida-gpu --lib pipeline` gives 67 passed, 0 failed and 8 ignored. **Run with this PR:** I loaded the save at the player's house, then drove. - **Device loss at 22:16:28 UTC**, about 6 minutes into the session: `relay: fence 18446744073709551615 did not reach 290299; device removed ... (0x887A0006)` (DXGI_ERROR_DEVICE_HUNG), and `device-removed data; none` (DRED was not on). - The last events the crash report lists, in the 8 s before the loss, are about ten masked twins loaded from the library on separate threads. For example: ``` 8080.0 ms before, thread 25768: pipeline library: loaded [mesh 8fc72d8fa74c12f0, pixel 3488a0567a9d10df masked] in 132.3 ms 7974.8 ms before, thread 33456: pipeline library: loaded [mesh 41b1fbed3ee9b8ff, pixel b36c288fccc767b0 masked] in 236.5 ms 1844.1 ms before, thread 35780: pipeline library: loaded [mesh 9c6c7fb345f39611, pixel 68cf7088c42fc83f masked] in 7.0 ms ``` - Before the loss there were no frames over 1 s (the longest was about 116 ms), so the stalls this PR targets were gone while it ran. - **Glass:** the glass doors of the house showed a speckled, stippled pattern (screenshot available). With the build without this PR, at the same door, the glass was clean. That looks like masked draws going out without their sample-mask twin while it is still being made. **Same build without this PR, launched right after:** 4+ minutes of driving, no device loss, 0 frames over 1 s, 20.8 fps median. **Context:** I ran this hardware-RT setup about eight times today on this card and never lost the device until this run. One run is not proof, and DRED was off. A repro with `LEONIDA_D3D12_DRED=1` would name the command. The timing points at the worker-made masked twins being used while still in flight, or a twin and its base pipeline disagreeing in state. The cold masked-twin stalls themselves are real here: an earlier run without this PR had frames of 1015 ms and 1946 ms, each right after masked twins were made synchronously in `masked_for` (`pipeline/make.rs`), with `LEONIDA_PIPELINE_WAIT_MS=0` not applying to them. So the PR's aim is right; it is the stability that needs a look. AI-assisted: the builds, the runs, the log reading and the write-up were done with Claude Opus 5.5 (Claude Code), with a log analysis by GPT-6.2 Sol (Codex); the numbers are the runtime's own log lines, and the glass observation is the player's.
NAbobo101 commented 2026-12-02 22:52:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by NAbobo101 on 2026-12-02T22:52:03Z.


One more trace of the case this PR targets, from a run where the noted masked twins had already been made ahead by the precompile (the setup is in my comment on #2957). It shows that precompiling noted twins is not enough on its own: a pipeline drawn for the first time still builds its twin on the list thread.

Rig: Ryzen 7 5700G, 32 GB, RTX 5060 8 GB, driver 621.40, Windows 11 Pro 26300, main at 45dc41f95 plus a local change that precompiles the noted twins (not this PR), diag build, Series X, LEONIDA_PIPELINE_WAIT_MS=0.

The only frame over 1 s in that 9.5-minute run (UTC times from the log):

time log
22:09:43.727 first bind of a pipeline never drawn before (mesh 0d9099a35c000feb, pixel 818a9a0ec6a53abb)
22:09:43.817 shader translated stage="pixel" hash=818a9a0ec6a53abb masked=true
22:09:43.8 to 22:09:45.8 one log line in two seconds
22:09:45.824 host mesh pipeline shaders=[mesh 0d9099a35c000feb, pixel 818a9a0ec6a53abb masked]
22:09:45.93 to 22:09:46.03 the same again for another new pipeline (mesh 9924c82dbd9d9c7e, pixel 1b76b94a7050f184, masked=true)

The frame-time line for that window: 40 frames: median 61.1 ms, ... longest 2127.7; 3 over 100 ms, 2 over 1 s; host pipelines 0 queued or being made, 0.6 made a second. So the cold twin build took about 2.0 s on the list thread, and the "queued or being made" count stays 0 because masked_for does not go through the queue, which fits the accounting gap described above.

Neither twin had been noted by the earlier run (the scripted route varies a little), so no precompile could have made them. With this PR the draw would wait at most the frame's budget and the twin would finish on a worker. With a precompile of noted twins alone it cannot be avoided.

No device removal in any of my runs today (main and this local build, about two hours in the world in all).

AI-assisted: summary prepared with help from Claude Code (Claude Opus 5.5). Numbers and lines taken from my own run's log; no logs or game data attached.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361262561 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7361262561). Originally posted by [NAbobo101](https://github.com/NAbobo101) on 2026-12-02T22:52:03Z. --- One more trace of the case this PR targets, from a run where the noted masked twins had already been made ahead by the precompile (the setup is in my comment on #2957). It shows that precompiling noted twins is not enough on its own: a pipeline drawn for the first time still builds its twin on the list thread. **Rig:** Ryzen 7 5700G, 32 GB, RTX 5060 8 GB, driver 621.40, Windows 11 Pro 26300, `main` at `45dc41f95` plus a local change that precompiles the noted twins (not this PR), diag build, Series X, `LEONIDA_PIPELINE_WAIT_MS=0`. The only frame over 1 s in that 9.5-minute run (UTC times from the log): | time | log | |---|---| | 22:09:43.727 | `first bind` of a pipeline never drawn before (mesh `0d9099a35c000feb`, pixel `818a9a0ec6a53abb`) | | 22:09:43.817 | `shader translated stage="pixel" hash=818a9a0ec6a53abb masked=true` | | 22:09:43.8 to 22:09:45.8 | one log line in two seconds | | 22:09:45.824 | `host mesh pipeline shaders=[mesh 0d9099a35c000feb, pixel 818a9a0ec6a53abb masked]` | | 22:09:45.93 to 22:09:46.03 | the same again for another new pipeline (mesh `9924c82dbd9d9c7e`, pixel `1b76b94a7050f184`, `masked=true`) | The frame-time line for that window: `40 frames: median 61.1 ms, ... longest 2127.7; 3 over 100 ms, 2 over 1 s; host pipelines 0 queued or being made, 0.6 made a second`. So the cold twin build took about 2.0 s on the list thread, and the "queued or being made" count stays 0 because `masked_for` does not go through the queue, which fits the accounting gap described above. Neither twin had been noted by the earlier run (the scripted route varies a little), so no precompile could have made them. With this PR the draw would wait at most the frame's budget and the twin would finish on a worker. With a precompile of noted twins alone it cannot be avoided. No device removal in any of my runs today (`main` and this local build, about two hours in the world in all). AI-assisted: summary prepared with help from Claude Code (Claude Opus 5.5). Numbers and lines taken from my own run's log; no logs or game data attached.
zmasi commented 2026-12-02 23:06:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-02T23:06:17Z.


Thanks @x2Tweek for the detailed RTX 5090 + -HardwareRT report! Cross-referencing your setup (LEONIDA_PIPELINE_WAIT_MS=0 -HardwareRT -SmoothMotion -PrecompileAll on driver 621.40) against pipeline.rs, make.rs, library.rs, warm.rs:167-170, and #3068 / #2821 explains both observations:

1. Why LEONIDA_PIPELINE_WAIT_MS=0 showed stippled glass doors (while default WAIT_MS stays clean)

  • Worker twin state is identical to inline builds: Pipeline::masked (pipeline.rs:816-834) captures PixelMask { position_row } on the list thread before masked_for runs, and Pending::make_with completes CreateRootSignature + LoadPipeline/CreatePipelineState before OnceLock publication (draw.rs:3178-3204 rebinds both masked.root and masked.pso).
  • Why main ignored LEONIDA_PIPELINE_WAIT_MS=0 while #3200 honors it:
    1. Even when prior runs already stored masked twins in host-pipelines.bin and listed their "masked" keys in early-pipelines.txt, hand_out (pipeline.rs:1052-1073) only calls make::early on the unmasked Pipeline.host at CreatePipelineState — Pipeline.masked stays an empty OnceLock until the first in-world masked draw, so zero masked twins are loaded during the loading screen.
    2. With LEONIDA_PIPELINE_WAIT_MS=0, wait_with returns immediately (if budget.is_zero() { return; }), which skips both AWAITED queue promotion and #3132's live-waiter THREAD_PRIORITY_NORMAL donation (waiters == 0). All leonida-pipelines-* workers therefore stay pinned at THREAD_PRIORITY_LOWEST behind un-skipped -HardwareRT RayQuery jobs in Queue::requested while uncapped recording (#3204 + WAIT_MS=0) and DXR BLAS/TLAS builds saturate the CPU.
    3. While one half of a complementary 2x2 sample-mask pair (0b0101 / 0b1010) has finished loading (7 ms) and discards half its quad pixels, any paired draw still queued falls back to unmasked (0xf), producing 2x2 stippling across those frames (and inside any stationary reflection/probe captured during opening frames).

2. Why 0x887A0006 (DXGI_ERROR_DEVICE_HUNG) hit right after the worker LoadPipeline burst

  • Notice every line in the 8 s trail is pipeline library: loaded [mesh ..., pixel ... masked] in 7.0..236.5 ms across separate worker threads (25768, 33456, 35780) — those were ID3D12PipelineLibrary1::LoadPipeline cache hits, ending 1,844.1 ms before removal (~156 ms before Windows's 2,000 ms TdrDelay timer expired!).
  • d3d12/apps/leonida/src/warm.rs:167-170 specifically notes driver 621.40 removing the device "during a burst of their first loads in a new place, twice" (same family as #3068 and #2821's LEONIDA_D3D12_BACKGROUND=0 finding).
  • Because masked twins were not loaded during early() startup prewarm, they stayed cold until 6 minutes into driving; on main, masked_for stalled leonida-list-* for 1–2 s (pausing ExecuteCommandLists so the GPU went idle during LoadPipeline), whereas with #3200 + LEONIDA_PIPELINE_WAIT_MS=0, list threads waited 0 ms and kept submitting heavy DXR + mesh work on the GPU while fanning out ~10 concurrent LoadPipeline calls across worker threads.

Two quick isolation checks (no rebuild needed)

To keep d1a91afd1 intact while #3132 / #3200 hold @EdenBendheim's 300 s RTX 3090 gate PASS, we will prepare a follow-up PR to pre-load early-pipelines.txt masked twins during loading (early()) so cached twins don't wait until mid-drive or Frame 1. If you get a chance on that same RTX 5090 -HardwareRT setup, two quick env checks on d1a91afd1 would confirm both halves directly:

  1. Default/small wait budget (LEONIDA_PIPELINE_WAIT_MS=50 instead of 0): lets 7–50 ms host-pipelines.bin hits finish with AWAITED + THREAD_PRIORITY_NORMAL donation before Frame 1 draws (eliminating the glass stipple while still capping multi-second cold compiles at 50 ms), and did the glass stipple with =0 clear after a few seconds or stay baked into a probe?
  2. LEONIDA_D3D12_DRED=light + LEONIDA_LIBRARY_LOCK=1 (or LEONIDA_D3D12_BACKGROUND=0): serializes worker LoadPipeline bursts on 621.40 (and records the exact faulting GPU op if it still hangs).

AI-assisted: Gemini 4 Carbon (High).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361568372 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7361568372). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-02T23:06:17Z. --- Thanks @x2Tweek for the detailed RTX 5090 + `-HardwareRT` report! Cross-referencing your setup (`LEONIDA_PIPELINE_WAIT_MS=0 -HardwareRT -SmoothMotion -PrecompileAll` on driver `621.40`) against `pipeline.rs`, `make.rs`, `library.rs`, `warm.rs:167-170`, and #3068 / #2821 explains both observations: ### 1. Why `LEONIDA_PIPELINE_WAIT_MS=0` showed stippled glass doors (while default `WAIT_MS` stays clean) - **Worker twin state is identical to inline builds:** `Pipeline::masked` (`pipeline.rs:816-834`) captures `PixelMask { position_row }` on the list thread before `masked_for` runs, and `Pending::make_with` completes `CreateRootSignature` + `LoadPipeline`/`CreatePipelineState` before `OnceLock` publication (`draw.rs:3178-3204` rebinds both `masked.root` and `masked.pso`). - **Why `main` ignored `LEONIDA_PIPELINE_WAIT_MS=0` while `#3200` honors it:** 1. Even when prior runs already stored masked twins in `host-pipelines.bin` and listed their `"masked"` keys in `early-pipelines.txt`, `hand_out` (`pipeline.rs:1052-1073`) only calls `make::early` on the **unmasked** `Pipeline.host` at `CreatePipelineState` — `Pipeline.masked` stays an empty `OnceLock` until the first in-world masked draw, so zero masked twins are loaded during the loading screen. 2. With `LEONIDA_PIPELINE_WAIT_MS=0`, `wait_with` returns immediately (`if budget.is_zero() { return; }`), which skips both `AWAITED` queue promotion and `#3132`'s live-waiter `THREAD_PRIORITY_NORMAL` donation (`waiters == 0`). All `leonida-pipelines-*` workers therefore stay pinned at `THREAD_PRIORITY_LOWEST` behind un-skipped `-HardwareRT` `RayQuery` jobs in `Queue::requested` while uncapped recording (#3204 + `WAIT_MS=0`) and DXR BLAS/TLAS builds saturate the CPU. 3. While one half of a complementary `2x2` sample-mask pair (`0b0101` / `0b1010`) has finished loading (`7 ms`) and discards half its quad pixels, any paired draw still queued falls back to unmasked (`0xf`), producing `2x2` stippling across those frames (and inside any stationary reflection/probe captured during opening frames). ### 2. Why `0x887A0006` (`DXGI_ERROR_DEVICE_HUNG`) hit right after the worker `LoadPipeline` burst - Notice every line in the 8 s trail is `pipeline library: loaded [mesh ..., pixel ... masked] in 7.0..236.5 ms` across separate worker threads (`25768`, `33456`, `35780`) — those were **`ID3D12PipelineLibrary1::LoadPipeline` cache hits**, ending **`1,844.1 ms` before** removal (~`156 ms` before Windows's `2,000 ms` `TdrDelay` timer expired!). - `d3d12/apps/leonida/src/warm.rs:167-170` specifically notes **driver `621.40`** removing the device *"during a burst of their first loads in a new place, twice"* (same family as #3068 and #2821's `LEONIDA_D3D12_BACKGROUND=0` finding). - Because masked twins were not loaded during `early()` startup prewarm, they stayed cold until 6 minutes into driving; on `main`, `masked_for` stalled `leonida-list-*` for `1–2 s` (pausing `ExecuteCommandLists` so the GPU went idle during `LoadPipeline`), whereas with `#3200` + `LEONIDA_PIPELINE_WAIT_MS=0`, list threads waited `0 ms` and kept submitting heavy DXR + mesh work on the GPU while fanning out ~10 concurrent `LoadPipeline` calls across worker threads. ### Two quick isolation checks (no rebuild needed) To keep `d1a91afd1` intact while #3132 / #3200 hold @EdenBendheim's 300 s RTX 3090 gate PASS, we will prepare a follow-up PR to pre-load `early-pipelines.txt` masked twins during loading (`early()`) so cached twins don't wait until mid-drive or Frame 1. If you get a chance on that same RTX 5090 `-HardwareRT` setup, two quick env checks on `d1a91afd1` would confirm both halves directly: 1. **Default/small wait budget (`LEONIDA_PIPELINE_WAIT_MS=50` instead of `0`):** lets `7–50 ms` `host-pipelines.bin` hits finish with `AWAITED` + `THREAD_PRIORITY_NORMAL` donation before Frame 1 draws (eliminating the glass stipple while still capping multi-second cold compiles at `50 ms`), and did the glass stipple with `=0` clear after a few seconds or stay baked into a probe? 2. **`LEONIDA_D3D12_DRED=light` + `LEONIDA_LIBRARY_LOCK=1` (or `LEONIDA_D3D12_BACKGROUND=0`):** serializes worker `LoadPipeline` bursts on `621.40` (and records the exact faulting GPU op if it still hangs). AI-assisted: Gemini 4 Carbon (High).
zmasi commented 2026-12-03 15:09:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-03T15:09:30Z.


Merged updated base #3132 (3e36b182d0, incorporating origin/main 128579e9ef / #3333) into 7681ede4e5 (needs rebase); #3200's delta over #3132 in d3d12/crates/leonida-gpu/src/pipeline/make.rs (+383/-16) is 100% identical to d1a91afd1f (74/74 pipeline:: tests pass).

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7382661167 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7382661167). Originally posted by [zmasi](https://github.com/zmasi) on 2026-12-03T15:09:30Z. --- Merged updated base `#3132` (`3e36b182d0`, incorporating `origin/main` `128579e9ef` / `#3333`) into `7681ede4e5` (`needs rebase`); `#3200`'s delta over `#3132` in `d3d12/crates/leonida-gpu/src/pipeline/make.rs` (`+383/-16`) is 100% identical to `d1a91afd1f` (`74/74` `pipeline::` tests pass). AI-assisted: Gemini 4 Neon (XHigh) and Gemini 4 Carbon (High).
MoonEyes commented 2026-12-03 16:18:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T16:18:29Z.


In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #3132, #3200 and #3226 merged into main d227aa73e; this PR tested at its current head 7681ede4e. Series S 1080, DLSS FG 2x, play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s.

  • Result: PASS. No device lost, no crash, no unhandled exception; the run ended on its time limit.
  • Median over the last 240 s: 17.2 fps (main alone today: 16-17.5); 15.7 frames per 1000 over 100 ms.
  • Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the two others in the batch.

AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7384618905 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3200#issuecomment-7384618905). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T16:18:29Z. --- In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #3132, #3200 and #3226 merged into main `d227aa73e`; this PR tested at its current head `7681ede4e`. Series S 1080, DLSS FG 2x, `play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed`, scripted walk, 330 s. - Result: **PASS**. No device lost, no crash, no unhandled exception; the run ended on its time limit. - Median over the last 240 s: 17.2 fps (main alone today: 16-17.5); 15.7 frames per 1000 over 100 ms. - Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the two others in the batch. AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
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/3200:upstream-pr/3200'
git switch 'upstream-pr/3200'

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