d3d12 pipeline: one compile at a time, opt-in behind LEONIDA_LIBRARY_COMPILE_GATE=1 (D3D12-PIPELINE-ONE-COMPILE-AT-A-TIME) #3185

Open
Noirdex wants to merge 1 commit from upstream-pr/3185 into main
Noirdex commented 2026-12-02 17:20:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Noirdex on 2026-12-02T17:20:32Z.


Claimed in the coordination issue as: D3D12-PIPELINE-ONE-COMPILE-AT-A-TIME (a second claim that corrects the first, whose numbers were misread)

Depends on: none

Fixes: none

What and why

With LEONIDA_LIBRARY_COMPILE_GATE=1, one pipeline compiles at a time through the library's path (COMPILE_GATE in d3d12/crates/leonida-gpu/src/pipeline/library.rs), however many threads ask for one. Off by default. The review measured what a serialised pool costs a card whose driver loads the library — the workers run at one thread's speed, and a light pipeline's waiter sat 611 ms idle, 3.3 to 7.5 s under load, behind one slow compile of a lowest-priority worker — and whether one at a time holds the device on the reporting card is not yet measured. The A/B that shows it is the number the switch waits for. The switch carries the LEONIDA_LIBRARY_* family of its file because LEONIDA_COMPILE_GATE is already the C++ runtime's compile-gate policy (runtime/src/compile_gate_policy.h, docs/d3d12_vulkan.md); the claims linked above still name the shorter one, written before the collision was found.

Revised after the review: the gate is opt-in (the first push had it on by default), and it is now taken before the make call is listed, so a wait for it is not counted in the compile's diagnostic time (MoonEyes' point 3).

On an RTX 3080 Ti (driver 621.47, by nvidia-smi; Windows 11 build 26300) the driver takes the pipeline library file but refuses every load from it with E_INVALIDARG (0x80070057): 58 pipelines refused in the first of two runs and 24 in the second, all 0x80070057; the nine the second run loaded were stores of that same run, so far as the trail shows, none from the file. So each refused pipeline compiles again at every world entry, whatever the precompile put in the library. Both runs had the device removed as the world came up (0x887A0005, the GPU instance suspended): the trail holds nine threads' compiles in the 26 s before the first removal and twelve in the 29 s before the second, one compile of the first run 2.6 s, the rest at most 33.2 ms there and 373.5 ms in the second, and each removal report says "no call running", the 2.6 s compile having ended 12 ms before it. The refusals are the driver's; the many compiles running at once are ours, and that is what the switch bounds, for the driver that refuses loads. The full note, with the machine and the review's measured costs, is in the branch's d3d12/docs/findings.md ("A driver that refuses every library load, and the device it removed"); LEONIDA_LIBRARY_COMPILE_GATE is in the regenerated d3d12/docs/switches.md.

Lines from the layer's own log (no game content in them). From play-1202-101830.log:

11.9 ms before, thread 1948: pipeline library: made [mesh 1382c87722df533b, pixel 4ad6ea7a75ec2098 masked] in 2594.5 ms (the library did not load it: The parameter is incorrect. (0x80070057))

its last line:

ERROR leonida_gpu::host: relay: fence 18446744073709551615 did not reach 445103; device removed: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887A0005)

and the last line of play-1202-104737.log:

ERROR leonida_gpu::host: relay: the fence reports the device removed; device removed: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887A0005)

Related, not claimed fixed: #2789 (a pipeline-library rework — libraries stamped with the driver and discarded across driver updates, refused entries self-healed — works the refusals from the library's own side; this bound is what the title's threads do while they last), #3068 (a device removed right after a masked-twin pipeline was made, RTX 4070 SUPER), #2821 (removals after 5 to 46 minutes, RTX 4070 SUPER), and the 3090 whose run report on #2789 held 35 of these refusals beside a removal. A different one is the walking-loop loss on the same driver that LEONIDA_D3D12_BACKGROUND=0 holds (valenciana-nc, #2570).

Tested

  • The two logs above are of the build without the change; they are the evidence for the cause. The change is in the build we play (with the switch on in our local settings), and the same starts with it will be reported in this thread, with the warm-time number fiestorra asked for.
  • cargo test -p leonida-gpu --lib --locked library on the revised head: 8 passed, 0 failed, 1 ignored (the reviewers' runs of the first head all passed).
  • python -I scripts/check_no_game_data.py on the three changed files.
  • No new test, and why: the switch is read once a process (OnceLock), so a test can only exercise the mode its process starts with — the constraint Kal0s-design's harness noted ("one mode per process"); a device-gated test on its model is possible and we will add one if wanted. The crate's device tests skip themselves where there is no device.

GPUs tested: NVIDIA GeForce RTX 3080 Ti (12 GB), driver 621.47, Windows 11 Pro build 26300; Ryzen 7 5800X, 32 GB RAM. No other GPU. (The reviewers ran Windows 10 and 11 with other cards — see their comments.)

AI-assisted: yes — GLM-5.3 (Z.ai), in the OpenCode coding agent, wrote the change, its comments and the findings.md section from our two crash logs; a separate read-only agent session of the same model audited the diff before this pull request was opened (call sites and re-entry, lock scope, poisoning, clean-room, comment accuracy against the logs, and the LEONIDA_COMPILE_GATE name collision), and audited it again after every edit. The models CONTRIBUTING.md lists for review were not available in this environment, so we name the one that reviewed it.

Checklist

  • Based on current main and merges cleanly (one commit, rebased per fiestorra's note so the diff is the three files only).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in the logs quoted here (the layer's own messages only).
  • n/a: no new translator rule (a runtime concurrency bound, not a translation rule), so no contract-table entry in docs/design.md.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5611457791 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185). Originally posted by [Noirdex](https://github.com/Noirdex) on 2026-12-02T17:20:32Z. --- Claimed in the coordination issue as: [D3D12-PIPELINE-ONE-COMPILE-AT-A-TIME](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7352931769) (a second claim that corrects the first, whose numbers were misread) Depends on: none Fixes: none ### What and why With `LEONIDA_LIBRARY_COMPILE_GATE=1`, one pipeline compiles at a time through the library's path (`COMPILE_GATE` in `d3d12/crates/leonida-gpu/src/pipeline/library.rs`), however many threads ask for one. **Off by default.** The review measured what a serialised pool costs a card whose driver loads the library — the workers run at one thread's speed, and a light pipeline's waiter sat 611 ms idle, 3.3 to 7.5 s under load, behind one slow compile of a lowest-priority worker — and whether one at a time holds the device on the reporting card is not yet measured. The A/B that shows it is the number the switch waits for. The switch carries the `LEONIDA_LIBRARY_*` family of its file because `LEONIDA_COMPILE_GATE` is already the C++ runtime's compile-gate policy (`runtime/src/compile_gate_policy.h`, `docs/d3d12_vulkan.md`); the claims linked above still name the shorter one, written before the collision was found. Revised after the review: the gate is opt-in (the first push had it on by default), and it is now taken before the `make` call is listed, so a wait for it is not counted in the compile's diagnostic time (MoonEyes' point 3). On an RTX 3080 Ti (driver 621.47, by nvidia-smi; Windows 11 build 26300) the driver takes the pipeline library file but refuses every load from it with `E_INVALIDARG` (0x80070057): 58 pipelines refused in the first of two runs and 24 in the second, all 0x80070057; the nine the second run loaded were stores of that same run, so far as the trail shows, none from the file. So each refused pipeline compiles again at every world entry, whatever the precompile put in the library. Both runs had the device removed as the world came up (0x887A0005, the GPU instance suspended): the trail holds nine threads' compiles in the 26 s before the first removal and twelve in the 29 s before the second, one compile of the first run 2.6 s, the rest at most 33.2 ms there and 373.5 ms in the second, and each removal report says "no call running", the 2.6 s compile having ended 12 ms before it. The refusals are the driver's; the many compiles running at once are ours, and that is what the switch bounds, for the driver that refuses loads. The full note, with the machine and the review's measured costs, is in the branch's [d3d12/docs/findings.md](https://github.com/Noirdex/mandy/blob/pipeline-one-compile-at-a-time/d3d12/docs/findings.md) ("A driver that refuses every library load, and the device it removed"); `LEONIDA_LIBRARY_COMPILE_GATE` is in the regenerated `d3d12/docs/switches.md`. Lines from the layer's own log (no game content in them). From `play-1202-101830.log`: ``` 11.9 ms before, thread 1948: pipeline library: made [mesh 1382c87722df533b, pixel 4ad6ea7a75ec2098 masked] in 2594.5 ms (the library did not load it: The parameter is incorrect. (0x80070057)) ``` its last line: ``` ERROR leonida_gpu::host: relay: fence 18446744073709551615 did not reach 445103; device removed: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887A0005) ``` and the last line of `play-1202-104737.log`: ``` ERROR leonida_gpu::host: relay: the fence reports the device removed; device removed: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887A0005) ``` Related, not claimed fixed: #2789 (a pipeline-library rework — libraries stamped with the driver and discarded across driver updates, refused entries self-healed — works the refusals from the library's own side; this bound is what the title's threads do while they last), #3068 (a device removed right after a masked-twin pipeline was made, RTX 4070 SUPER), #2821 (removals after 5 to 46 minutes, RTX 4070 SUPER), and the 3090 whose run report on #2789 held 35 of these refusals beside a removal. A different one is the walking-loop loss on the same driver that `LEONIDA_D3D12_BACKGROUND=0` holds (valenciana-nc, #2570). ### Tested - The two logs above are of the build **without** the change; they are the evidence for the cause. The change is in the build we play (with the switch on in our local settings), and the same starts with it will be reported in this thread, with the warm-time number fiestorra asked for. - `cargo test -p leonida-gpu --lib --locked library` on the revised head: 8 passed, 0 failed, 1 ignored (the reviewers' runs of the first head all passed). - `python -I scripts/check_no_game_data.py` on the three changed files. - No new test, and why: the switch is read once a process (`OnceLock`), so a test can only exercise the mode its process starts with — the constraint Kal0s-design's harness noted ("one mode per process"); a device-gated test on its model is possible and we will add one if wanted. The crate's device tests skip themselves where there is no device. GPUs tested: NVIDIA GeForce RTX 3080 Ti (12 GB), driver 621.47, Windows 11 Pro build 26300; Ryzen 7 5800X, 32 GB RAM. No other GPU. (The reviewers ran Windows 10 and 11 with other cards — see their comments.) AI-assisted: yes — GLM-5.3 (Z.ai), in the OpenCode coding agent, wrote the change, its comments and the findings.md section from our two crash logs; a separate read-only agent session of the same model audited the diff before this pull request was opened (call sites and re-entry, lock scope, poisoning, clean-room, comment accuracy against the logs, and the `LEONIDA_COMPILE_GATE` name collision), and audited it again after every edit. The models CONTRIBUTING.md lists for review were not available in this environment, so we name the one that reviewed it. ### Checklist - [x] Based on current `main` and merges cleanly (one commit, rebased per fiestorra's note so the diff is the three files only). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in the logs quoted here (the layer's own messages only). - [ ] n/a: no new translator rule (a runtime concurrency bound, not a translation rule), so no contract-table entry in docs/design.md.
fiestorra commented 2026-12-02 17:55:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T17:55:34Z.


Verified here: it applies, the library tests pass, and the switch table matches - but nothing tests the gate itself, which is the whole change.

merge base 5b1fff821 (= current origin/main), head 1f6275849
git apply on main

cargo test -p leonida-gpu --lib -- library     test result: ok. 8 passed; 0 failed; 1 ignored
python -I tools/d3d12_switches.py --check d3d12/docs/switches.md    exit 0

So nothing is broken, and the documentation check is happy. What is missing is evidence that the gate does what it says.

COMPILE_GATE is a serialisation, and a serialisation is the kind of thing a test can hold: two threads ask the library for a pipeline at once and the test asserts that one compile ran at a time - or, more usefully, that the second waits rather than getting a second compile. As it stands, the only thing exercising it is a real run of the title, and the body says the A/B numbers come from such runs - but the mechanism itself has no unit test, which means a future refactor of library.rs can remove the gate silently.

For the merge: the branch carries drift - 12 files applied for a +53/-2 change - so a rebase before a reviewer looks at it would make the diff readable. And BLOCKED with no test to justify the change is the thing I would expect a reviewer to ask about first.

What I could not test: the contention it is for. Two concurrent pipeline compiles need the title and a library being filled, which this machine cannot do - the same limit as every other compile-path pull request I have checked today.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353778651 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7353778651). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T17:55:34Z. --- **Verified here: it applies, the library tests pass, and the switch table matches - but nothing tests the gate itself, which is the whole change.** ``` merge base 5b1fff821 (= current origin/main), head 1f6275849 git apply on main cargo test -p leonida-gpu --lib -- library test result: ok. 8 passed; 0 failed; 1 ignored python -I tools/d3d12_switches.py --check d3d12/docs/switches.md exit 0 ``` **So nothing is broken, and the documentation check is happy.** **What is missing is evidence that the gate does what it says.** **`COMPILE_GATE` is a serialisation**, and **a serialisation is the kind of thing a test can hold**: two threads ask the library for a pipeline at once and the test asserts that one compile ran at a time - **or, more usefully, that the second waits rather than getting a second compile.** **As it stands, the only thing exercising it is a real run of the title**, **and the body says the A/B numbers come from such runs - but the mechanism itself has no unit test**, which means **a future refactor of `library.rs` can remove the gate silently.** **For the merge**: **the branch carries drift** - 12 files applied for a `+53/-2` change - **so a rebase before a reviewer looks at it would make the diff readable.** **And `BLOCKED` with no test to justify the change is the thing I would expect a reviewer to ask about first.** **What I could not test**: **the contention it is for.** **Two concurrent pipeline compiles need the title and a library being filled, which this machine cannot do** - **the same limit as every other compile-path pull request I have checked today.** **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
MoonEyes commented 2026-12-02 17:59:47 +00:00 (Migrated from github.com)

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


Code review of head 1f6275849 against current main 45dc41f95 (it is based on it; merge-tree clean). Not built: leonida-gpu is Windows-only. No CI runs exist on this head yet.

merge base 45dc41f95 (= current main), 3 files:
  d3d12/crates/leonida-gpu/src/pipeline/library.rs  +26/-1
  d3d12/docs/findings.md                            +25
  d3d12/docs/switches.md                            +2/-1

What it does: a process-wide COMPILE_GATE: Mutex<()> taken around create() in library::pipeline (library.rs:~631), on by default, off with LEONIDA_LIBRARY_COMPILE_GATE=0.

Defects

  1. A default-on change justified by an unmeasured hypothesis. The findings section itself says "whether it holds the device on this card is not yet measured" (findings.md, new section, last sentence of its second paragraph). Two removals on one RTX 3080 Ti whose driver refused every library load are the only evidence, and the gate is not shown to change them. AGENTS.md asks for the root cause and a measurement before a default changes; as written this should be opt-in (LEONIDA_LIBRARY_COMPILE_GATE=1) until an A/B on that card shows the removals go away.

  2. It serialises every compile on every machine, not only on the driver that refuses loads. create() runs whenever load fails, and a load fails for every pipeline that is simply not in the library yet: a cold cache, any new variant, every leonida warm --these child. The in-process pool is 2 to 16 workers (pipeline/make.rs:1036-1041) plus SCREEN_WORKERS = 2 (make.rs:1017); with the gate they become one compile at a time. Two consequences:

    • the screen-first workers now wait behind a background compile (the PR's own log has one of 2.6 s), which is a priority inversion on exactly the pipelines the frame is waiting for, and it interacts with the per-pipeline waiter work in #3132;
    • each warm-up child process (apps/leonida/src/warm.rs:350-360) is serialised internally too, so the full warm that main now runs by default (#3172, "can take an hour or more") gets slower in proportion to the workers per child.
      No measurement of either is given. If the driver-refusal case is the target, gating could at least be limited to it (for example, on after N refused loads in a row), rather than taxing healthy drivers.
  3. The diagnostic timing now includes the queueing. let _call = call("make", name); is taken before _gate (library.rs, the let pso = { ... } block), so CALLS records the wait for the gate as part of "make", and the removal report's "calls running" and the trail's made ... in N ms (from began) will show long "compiles" that were waits. Take the gate first, then call("make"), or record the wait separately.

  4. No test. Nothing checks that the switch reads as documented (0 off, anything else or unset on) or that the gate is released on the create()? error path (it is, by drop order, but a unit test with two threads and a counter would pin it).

Docs: switches.md count 682 -> 683 and the new row are consistent with the code comment. The findings text is careful to call the link to the removals a hypothesis, which is right; the code default does not follow it.

Verdict: defects (make it opt-in or measure it on the reporting card and on a healthy driver's cold start before it becomes the default).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353843301 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7353843301). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T17:59:47Z. --- **Code review of head `1f6275849` against current `main` `45dc41f95` (it is based on it; merge-tree clean). Not built: `leonida-gpu` is Windows-only. No CI runs exist on this head yet.** ``` merge base 45dc41f95 (= current main), 3 files: d3d12/crates/leonida-gpu/src/pipeline/library.rs +26/-1 d3d12/docs/findings.md +25 d3d12/docs/switches.md +2/-1 ``` **What it does:** a process-wide `COMPILE_GATE: Mutex<()>` taken around `create()` in `library::pipeline` (`library.rs:~631`), **on by default**, off with `LEONIDA_LIBRARY_COMPILE_GATE=0`. **Defects** 1. **A default-on change justified by an unmeasured hypothesis.** The findings section itself says "whether it holds the device on this card is not yet measured" (`findings.md`, new section, last sentence of its second paragraph). Two removals on one RTX 3080 Ti whose driver refused every library load are the only evidence, and the gate is not shown to change them. AGENTS.md asks for the root cause and a measurement before a default changes; as written this should be opt-in (`LEONIDA_LIBRARY_COMPILE_GATE=1`) until an A/B on that card shows the removals go away. 2. **It serialises every compile on every machine, not only on the driver that refuses loads.** `create()` runs whenever `load` fails, and a load fails for every pipeline that is simply not in the library yet: a cold cache, any new variant, every `leonida warm --these` child. The in-process pool is 2 to 16 workers (`pipeline/make.rs:1036-1041`) plus `SCREEN_WORKERS = 2` (`make.rs:1017`); with the gate they become one compile at a time. Two consequences: - the screen-first workers now wait behind a background compile (the PR's own log has one of 2.6 s), which is a priority inversion on exactly the pipelines the frame is waiting for, and it interacts with the per-pipeline waiter work in #3132; - each warm-up child process (`apps/leonida/src/warm.rs:350-360`) is serialised internally too, so the full warm that `main` now runs by default (#3172, "can take an hour or more") gets slower in proportion to the workers per child. No measurement of either is given. If the driver-refusal case is the target, gating could at least be limited to it (for example, on after N refused loads in a row), rather than taxing healthy drivers. 3. **The diagnostic timing now includes the queueing.** `let _call = call("make", name);` is taken before `_gate` (`library.rs`, the `let pso = { ... }` block), so `CALLS` records the wait for the gate as part of "make", and the removal report's "calls running" and the trail's `made ... in N ms` (from `began`) will show long "compiles" that were waits. Take the gate first, then `call("make")`, or record the wait separately. 4. **No test.** Nothing checks that the switch reads as documented (`0` off, anything else or unset on) or that the gate is released on the `create()?` error path (it is, by drop order, but a unit test with two threads and a counter would pin it). Docs: `switches.md` count 682 -> 683 and the new row are consistent with the code comment. The findings text is careful to call the link to the removals a hypothesis, which is right; the code default does not follow it. **Verdict: defects** (make it opt-in or measure it on the reporting card and on a healthy driver's cold start before it becomes the default). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
lixonik commented 2026-12-02 20:10:05 +00:00 (Migrated from github.com)

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


Verified PR #3185 (1f6275849) merged cleanly onto main (f1a559851) on native Windows 10 x64 (Rust 1.98.1):

  • 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: cargo test -p leonida-gpu --features diagnostics --lib --locked pipeline::library:: -- 6 passed, 0 failed (0.24 s).

Verdict: PASS (Windows unit tests only; no game launch).

AI-assisted: yes (Antigravity).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7357317980 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7357317980). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T20:10:05Z. --- Verified PR #3185 (`1f6275849`) merged cleanly onto `main` (`f1a559851`) on native Windows 10 x64 (Rust 1.98.1): - **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:** `cargo test -p leonida-gpu --features diagnostics --lib --locked pipeline::library::` -- **6 passed, 0 failed** (0.24 s). Verdict: **PASS** (Windows unit tests only; no game launch). AI-assisted: yes (Antigravity).
fiestorra commented 2026-12-02 20:31:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T20:31:05Z.


VERIFY-3185 — suite en Windows nativo, y revisión del candado (no hay test: red not constructible)

Head 1f6275849
Merge base 45dc41f95
Merged onto main b41763227 — merge-tree clean, git merge --no-ff clean (auto-merged findings.md and switches.md)

Ran

cargo test -p leonida-gpu --lib     702 passed; 1 failed; 59 ignored   (16.7s)

The one failure is this machine's, not this PR's: descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in fails identically on clean main b41763227 (0 passed; 1 failed) and on the merged head — it is the iGPU artefact of D3D12CreateDevice(None, ..) that #2995 addresses, and it has failed on this machine all day.

No test in the PR, so there is no red side to construct: by this repository's own vocabulary this is red not constructible: the pull request changes no test, and the evidence for the change is a measured in-game run (the two RTX 3080 Ti logs), not a test. That is the right kind of evidence for a scheduling policy; I say it plainly rather than pretend otherwise.

What I read carefully, since a mutex held across a compile is where this kind of change goes wrong

  • Order: the gate is taken only after the load-side locks are released (one_call, same_name), and released before MADE, trail, one_call and saving.read(); saving.write() in the save path never waits for it. No nesting in either direction.
  • Re-entry: the three library::pipeline call sites (host.rs:862, :1055, :1154) pass closures that only call CreateComputePipelineState / CreateGraphicsPipelineState / CreatePipelineState; none calls back into pipeline(), so the non-reentrant Mutex cannot deadlock itself.
  • Poisoning: unwrap_or_else(|e| e.into_inner()) — one panicking compile does not wedge every later compile.
  • Opt-out name matches the docs and switches.md (LEONIDA_LIBRARY_COMPILE_GATE=0), and findings.md is honest that holding the device "is not yet measured".

Two things I would want the author to answer

  1. The gate does not apply when there is no library. pipeline() returns create() early when name or the library is None (library.rs:600-602), so with LEONIDA_PIPELINE_LIBRARY=0 (or a library that failed to open) compiles still run concurrently. If the common factor in those two removals is "several threads compiling at once" and not "recompiles after refused loads", that path keeps it.
  2. What serialising costs the first start is not measured. With -PrecompileAll the default (#3172), a gate that admits one compile at a time can stretch warm-up; the findings quantify the two removed runs but not the time this adds. A number from the same card would settle whether the gate belongs on by default.

What I could not test: the behaviour itself — a compile storm needs the RTX 3080 Ti and the title; this machine's 4090 loads the library (no refusals), so the gate changes nothing measurable here.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7357861984 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7357861984). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T20:31:05Z. --- ## VERIFY-3185 — suite en Windows nativo, y revisión del candado (no hay test: `red not constructible`) | | | |---|---| | Head | `1f6275849` | | Merge base | `45dc41f95` | | Merged onto | `main` `b41763227` — `merge-tree` clean, `git merge --no-ff` clean (auto-merged `findings.md` and `switches.md`) | **Ran** ``` cargo test -p leonida-gpu --lib 702 passed; 1 failed; 59 ignored (16.7s) ``` **The one failure is this machine's, not this PR's**: `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` fails identically on clean `main` `b41763227` (`0 passed; 1 failed`) and on the merged head — it is the iGPU artefact of `D3D12CreateDevice(None, ..)` that #2995 addresses, and it has failed on this machine all day. **No test in the PR**, so there is no red side to construct: by this repository's own vocabulary this is **`red not constructible: the pull request changes no test`**, and the evidence for the change is a measured in-game run (the two RTX 3080 Ti logs), not a test. That is the right kind of evidence for a scheduling policy; I say it plainly rather than pretend otherwise. ## What I read carefully, since a mutex held across a compile is where this kind of change goes wrong - **Order**: the gate is taken only after the load-side locks are released (`one_call`, `same_name`), and released before `MADE`, `trail`, `one_call` and `saving.read()`; `saving.write()` in the save path never waits for it. No nesting in either direction. - **Re-entry**: the three `library::pipeline` call sites (`host.rs:862`, `:1055`, `:1154`) pass closures that only call `CreateComputePipelineState` / `CreateGraphicsPipelineState` / `CreatePipelineState`; none calls back into `pipeline()`, so the non-reentrant `Mutex` cannot deadlock itself. - **Poisoning**: `unwrap_or_else(|e| e.into_inner())` — one panicking compile does not wedge every later compile. - **Opt-out name** matches the docs and `switches.md` (`LEONIDA_LIBRARY_COMPILE_GATE=0`), and `findings.md` is honest that holding the device "is not yet measured". ## Two things I would want the author to answer 1. **The gate does not apply when there is no library.** `pipeline()` returns `create()` early when `name` or the library is `None` (`library.rs:600-602`), so with `LEONIDA_PIPELINE_LIBRARY=0` (or a library that failed to open) compiles still run concurrently. If the common factor in those two removals is "several threads compiling at once" and not "recompiles after refused loads", that path keeps it. 2. **What serialising costs the first start is not measured.** With `-PrecompileAll` the default (#3172), a gate that admits one compile at a time can stretch warm-up; the findings quantify the two removed runs but not the time this adds. A number from the same card would settle whether the gate belongs on by default. **What I could not test**: the behaviour itself — a compile storm needs the RTX 3080 Ti and the title; this machine's 4090 loads the library (no refusals), so the gate changes nothing measurable here. Written with an AI assistant.
Kal0s-design commented 2026-12-02 20:40:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T20:40:17Z.


Ran natively on Windows 11, head 1f6275849 merged into current main (b41763227, clean merge).

One thing first, since the title says "behind" a switch: the gate is on by default (is_none_or(|v| v != "0")), and LEONIDA_LIBRARY_COMPILE_GATE=0 is the path that matches main. By reading, the =0 path differs from main only by a None guard, so off really is as before.

Suite and checks (measured)

main merge
cargo test -p leonida-gpu --features diagnostics --lib 784 passed, 0 failed, 59 ignored 784 passed, 0 failed, 59 ignored
cargo clippy -p leonida-gpu --features diagnostics --all-targets 10 warnings same 10, none in library.rs
tools/d3d12_switches.py --check exit 0
scripts/check_no_game_data.py exit 0

The PR adds no tests, so there was nothing new to run red on main.

What the gate costs, on the card (measured)

I added a throwaway test (not pushed) that sets a pipeline cache folder, makes the host device, and builds compute pipelines through library::pipeline with names the library doesn't have, so every call takes the create() path under the gate. Each pipeline has its own nonce so the driver's disk cache can't help, and the bytecode is compiled before the clock starts. One mode per process, because one_at_a_time() is a OnceLock. I checked in the log that the library was open and the gate state matched the env var each time. Other builds were running on the machine at the same time, so treat these as rough.

16 pipelines of about 0.6 s each, split over N threads, in ms:

threads gate off gate on
1 8907 9007
4 4843, 4189 10669, 12067
8 2777, 3065 13413, 9741

So with the gate on, the pool runs at one thread's speed or a bit worse. That's the intent, but it's also what every cold start and every warm child will pay on a healthy driver. This is the number MoonEyes' point 2 asked for.

Priority inversion (measured, simulated)

This doesn't use #3132's code. It's a stand-in for its setup: one thread at THREAD_PRIORITY_LOWEST (what general workers run at) is inside create() for a heavy pipeline, holding the gate. A normal-priority thread then asks for a light pipeline (about 50 ms alone). In some runs, one spinner per logical processor at normal priority stands in for the title's own threads. Spinners stop after 8 s, which caps the loaded numbers. Waiter latency in ms:

load gate off gate on
idle 79 611 (waits out the whole heavy compile)
all cores busy 111, 104, 139 7463, 3682, 3347

Under load the lowest-priority holder barely runs, and the normal-priority waiter sits behind it for seconds. From reading #3132's completion.rs: donation boosts only the worker building the pipeline someone is waiting for, so a boosted worker that blocks on COMPILE_GATE leaves the holder at LOWEST. The boost does nothing for it, and this table is roughly what it gets. #3200 sends more work to the same workers, so the same applies there.

Read, not measured

  • Deadlock: I don't see one. Every create closure that reaches the gate is a bare Create*PipelineState call. graphics_depth_bounds_pipeline goes through stream_pipeline → library::pipeline, not from inside a create. The gate is dropped at the end of its block, before one_call() and saving.read(). Nothing is taken while it's held.
  • Panic: handled. I measured this with the same throwaway test: a create that panics poisons the mutex, the next call recovers through into_inner and builds fine (48 ms). In production, make_with already catches panics around the build.
  • Not "one compile at a time" on the card it's for: the gate only covers named pipelines with a library. On NVIDIA, a pipeline with static samplers whose places aren't known yet gets Use::Skip → no name → the early return create(), which never takes the gate. The same is true for any process without a library, the places.rs checks, and the many direct CreateComputePipelineState calls elsewhere in the crate (hwrt.rs, indirect.rs, host.rs, ...). If the removals come from concurrent compiles, those can still overlap.
  • A sync caller with no bound: make::now() builds on the caller's thread. It's used by builder_runs() while holding BUILDER, and with the gate that call can now wait behind any background compile with no budget. Frame waits through until_made do have a budget, but they will time out more often, which means more skipped draws while the pool is serialised.
  • Switch kind: using crate::toggled!("LEONIDA_LIBRARY_COMPILE_GATE") instead of the hand-rolled OnceLock would give the same default, let LEONIDA_AB flip it during one run (the A/B on the reporting card that the thread is asking for), and let the switch table show the default instead of "see the code".

Merge with other open PRs touching library.rs (git merge-tree against main + this PR)

PR result
#3132 clean
#3200 clean
#3150 clean
#2654 clean
#2789 conflict in switches.md only: the count line (683 vs 682) and the neighbouring new row. Mechanical.

#2789 (driver stamp, self-healing refused entries) goes after the same refused-load case from the other side, so it may be worth seeing whether it alone stops the recompiles before this becomes the default.

Not checked: the title itself or a real library that the driver refuses, the combined #3132 + #3185 tree, release builds, other vendors, WARP.

GPUs tested: one NVIDIA desktop card.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7358121401 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7358121401). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T20:40:17Z. --- Ran natively on Windows 11, head `1f6275849` merged into current `main` (`b41763227`, clean merge). One thing first, since the title says "behind" a switch: the gate is **on by default** (`is_none_or(|v| v != "0")`), and `LEONIDA_LIBRARY_COMPILE_GATE=0` is the path that matches main. By reading, the `=0` path differs from main only by a `None` guard, so off really is as before. **Suite and checks (measured)** | | main | merge | |---|---|---| | `cargo test -p leonida-gpu --features diagnostics --lib` | 784 passed, 0 failed, 59 ignored | 784 passed, 0 failed, 59 ignored | | `cargo clippy -p leonida-gpu --features diagnostics --all-targets` | 10 warnings | same 10, none in `library.rs` | | `tools/d3d12_switches.py --check` | | exit 0 | | `scripts/check_no_game_data.py` | | exit 0 | The PR adds no tests, so there was nothing new to run red on main. **What the gate costs, on the card (measured)** I added a throwaway test (not pushed) that sets a pipeline cache folder, makes the host device, and builds compute pipelines through `library::pipeline` with names the library doesn't have, so every call takes the `create()` path under the gate. Each pipeline has its own nonce so the driver's disk cache can't help, and the bytecode is compiled before the clock starts. One mode per process, because `one_at_a_time()` is a `OnceLock`. I checked in the log that the library was open and the gate state matched the env var each time. Other builds were running on the machine at the same time, so treat these as rough. 16 pipelines of about 0.6 s each, split over N threads, in ms: | threads | gate off | gate on | |---|---|---| | 1 | 8907 | 9007 | | 4 | 4843, 4189 | 10669, 12067 | | 8 | 2777, 3065 | 13413, 9741 | So with the gate on, the pool runs at one thread's speed or a bit worse. That's the intent, but it's also what every cold start and every `warm` child will pay on a healthy driver. This is the number MoonEyes' point 2 asked for. **Priority inversion (measured, simulated)** This doesn't use #3132's code. It's a stand-in for its setup: one thread at `THREAD_PRIORITY_LOWEST` (what general workers run at) is inside `create()` for a heavy pipeline, holding the gate. A normal-priority thread then asks for a light pipeline (about 50 ms alone). In some runs, one spinner per logical processor at normal priority stands in for the title's own threads. Spinners stop after 8 s, which caps the loaded numbers. Waiter latency in ms: | load | gate off | gate on | |---|---|---| | idle | 79 | 611 (waits out the whole heavy compile) | | all cores busy | 111, 104, 139 | 7463, 3682, 3347 | Under load the lowest-priority holder barely runs, and the normal-priority waiter sits behind it for seconds. From reading #3132's `completion.rs`: donation boosts only the worker building the pipeline someone is waiting for, so a boosted worker that blocks on `COMPILE_GATE` leaves the holder at LOWEST. The boost does nothing for it, and this table is roughly what it gets. #3200 sends more work to the same workers, so the same applies there. **Read, not measured** - **Deadlock:** I don't see one. Every `create` closure that reaches the gate is a bare `Create*PipelineState` call. `graphics_depth_bounds_pipeline` goes through `stream_pipeline` → `library::pipeline`, not from inside a `create`. The gate is dropped at the end of its block, before `one_call()` and `saving.read()`. Nothing is taken while it's held. - **Panic:** handled. I measured this with the same throwaway test: a `create` that panics poisons the mutex, the next call recovers through `into_inner` and builds fine (48 ms). In production, `make_with` already catches panics around the build. - **Not "one compile at a time" on the card it's for:** the gate only covers named pipelines with a library. On NVIDIA, a pipeline with static samplers whose places aren't known yet gets `Use::Skip` → no name → the early `return create()`, which never takes the gate. The same is true for any process without a library, the `places.rs` checks, and the many direct `CreateComputePipelineState` calls elsewhere in the crate (`hwrt.rs`, `indirect.rs`, `host.rs`, ...). If the removals come from concurrent compiles, those can still overlap. - **A sync caller with no bound:** `make::now()` builds on the caller's thread. It's used by `builder_runs()` while holding `BUILDER`, and with the gate that call can now wait behind any background compile with no budget. Frame waits through `until_made` do have a budget, but they will time out more often, which means more skipped draws while the pool is serialised. - **Switch kind:** using `crate::toggled!("LEONIDA_LIBRARY_COMPILE_GATE")` instead of the hand-rolled `OnceLock` would give the same default, let `LEONIDA_AB` flip it during one run (the A/B on the reporting card that the thread is asking for), and let the switch table show the default instead of "see the code". **Merge with other open PRs touching `library.rs`** (`git merge-tree` against main + this PR) | PR | result | |---|---| | #3132 | clean | | #3200 | clean | | #3150 | clean | | #2654 | clean | | #2789 | conflict in `switches.md` only: the count line (683 vs 682) and the neighbouring new row. Mechanical. | #2789 (driver stamp, self-healing refused entries) goes after the same refused-load case from the other side, so it may be worth seeing whether it alone stops the recompiles before this becomes the default. Not checked: the title itself or a real library that the driver refuses, the combined #3132 + #3185 tree, release builds, other vendors, WARP. GPUs tested: one NVIDIA desktop card. AI-assisted: yes (Claude Code).
merzleckeier commented 2026-12-02 20:50:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T20:50:23Z.

Review: COMMENTED


Integration finding for 1f627584 with #3222 d59a9d6e on current main 1bb49101: the merge is textually clean, but the two default-on paths can stop all subsequent library fallback compiles. This PR holds COMPILE_GATE across create() in pipeline/library.rs:630–635. If #3222 parks a worker while that call is in progress, the Rust guard is never dropped. Releasing the per-pipeline claim and spawning a replacement does not release the library gate, so the replacement and other workers block at the next fallback. Please coordinate the default-on behavior and ensure a guarded worker cannot be left holding the shared compile gate. Source and merge review only; I did not induce a driver fault. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6158769705 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#pullrequestreview-6158769705). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T20:50:23Z. **Review:** COMMENTED --- Integration finding for `1f627584` with #3222 `d59a9d6e` on current `main` `1bb49101`: the merge is textually clean, but the two default-on paths can stop all subsequent library fallback compiles. This PR holds `COMPILE_GATE` across `create()` in `pipeline/library.rs:630–635`. If #3222 parks a worker while that call is in progress, the Rust guard is never dropped. Releasing the per-pipeline claim and spawning a replacement does not release the library gate, so the replacement and other workers block at the next fallback. Please coordinate the default-on behavior and ensure a guarded worker cannot be left holding the shared compile gate. Source and merge review only; I did not induce a driver fault. AI-assisted.
Noirdex commented 2026-12-03 00:17:38 +00:00 (Migrated from github.com)

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


Thank you all four for running what we could not. The head is revised (d70c7ccc9, rebased on current main, diff back to the three files; the crate's library tests pass on it, 8 passed / 0 failed / 1 ignored): the gate is now opt-in (LEONIDA_LIBRARY_COMPILE_GATE=1, off by default), and the answers to each point:

MoonEyes

  1. Agreed. Default-on was ahead of the evidence; the review's own measurements (below) made it plain. The switch is now =1-to-turn-on, and "whether it holds the device is not yet measured" moved from findings.md into the code comment itself. We will run the A/B on the reporting card (our machine) next session and post the number here — that is the number the switch waits for.
  2. Agreed, and thank Kal0s-design for putting numbers on it. The cost is now in findings.md verbatim (one thread's speed for the pool; 611 ms idle and 3.3-7.5 s loaded for a light pipeline's waiter behind a lowest-priority compile). The adaptive form ("on after N refused loads in a row") would tax only the refusing driver; we kept the plain switch to keep this small, and will take the adaptive form up in a follow-up if you would rather have that.
  3. Fixed. The gate is taken before call("make") now, so the trail's made ... in N ms and the removal report's "calls running" describe compiles, not waits.
  4. Noted on the test: the constraint is that one_at_a_time() reads a OnceLock once a process, so an in-suite test can only exercise the mode its process starts with — the same thing Kal0s-design's harness worked around with one mode per process. If you want a committed test, we will model it on that harness: device-gated (skips without one, like the crate's other device tests), two threads and a max-concurrency counter, red on main on a GPU machine, green with the switch set. Say the word and it comes in this PR.

fiestorra

  • Rebase: done (twice now — upstream moved 57 commits under us today); the diff is the three files again, +63/-2.
  • The lock-order read in your VERIFY comment matches our reviewer's; thank you for confirming it independently.
  • Question 1 (no library, no gate): acknowledged, and it is the honest limit of our evidence — both removals happened with a library open and every load from it refused, so the named path is the one we could see and bound. Whether the unnamed path (no library at all) carries the same risk our logs cannot say; the PR body states it.
  • Question 2 (what it costs a first start): Kal0s-design's table answers it for a healthy driver. For the refusing card we will add the warm-time number with the switch on, from the same session as the A/B above.

merzleckeier

  • Agreed: if a guarded worker is parked inside create() while holding COMPILE_GATE, the replacement and every later fallback blocks on a gate nobody will release — that is a stall, and your integration note is the sharpest finding of the review. With the gate now off by default the two default-on paths no longer overlap; if maintainers want both usable together, the parking path has to drop the gate before the worker parks (or the replacement must bypass it), and #3222 is the right place to coordinate that — we will follow whatever is decided there.

lixonik, Kal0s-design — verified as noted above; nothing to add except thanks, and that Kal0s-design's two tables are now quoted in findings.md with their numbers.

AI-assisted: yes (GLM-5.3, in OpenCode; the change and this reply), with a separate read-only reviewer session before every push.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363022806 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7363022806). Originally posted by [Noirdex](https://github.com/Noirdex) on 2026-12-03T00:17:38Z. --- Thank you all four for running what we could not. The head is revised (`d70c7ccc9`, rebased on current `main`, diff back to the three files; the crate's library tests pass on it, 8 passed / 0 failed / 1 ignored): **the gate is now opt-in** (`LEONIDA_LIBRARY_COMPILE_GATE=1`, off by default), and the answers to each point: **MoonEyes** 1. *Agreed.* Default-on was ahead of the evidence; the review's own measurements (below) made it plain. The switch is now `=1`-to-turn-on, and "whether it holds the device is not yet measured" moved from findings.md into the code comment itself. We will run the A/B on the reporting card (our machine) next session and post the number here — that is the number the switch waits for. 2. *Agreed, and thank Kal0s-design for putting numbers on it.* The cost is now in findings.md verbatim (one thread's speed for the pool; 611 ms idle and 3.3-7.5 s loaded for a light pipeline's waiter behind a lowest-priority compile). The adaptive form ("on after N refused loads in a row") would tax only the refusing driver; we kept the plain switch to keep this small, and will take the adaptive form up in a follow-up if you would rather have that. 3. *Fixed.* The gate is taken before `call("make")` now, so the trail's `made ... in N ms` and the removal report's "calls running" describe compiles, not waits. 4. Noted on the test: the constraint is that `one_at_a_time()` reads a `OnceLock` once a process, so an in-suite test can only exercise the mode its process starts with — the same thing Kal0s-design's harness worked around with one mode per process. If you want a committed test, we will model it on that harness: device-gated (skips without one, like the crate's other device tests), two threads and a max-concurrency counter, red on `main` on a GPU machine, green with the switch set. Say the word and it comes in this PR. **fiestorra** - Rebase: done (twice now — upstream moved 57 commits under us today); the diff is the three files again, `+63/-2`. - The lock-order read in your VERIFY comment matches our reviewer's; thank you for confirming it independently. - Question 1 (no library, no gate): acknowledged, and it is the honest limit of our evidence — both removals happened with a library open and every load from it refused, so the named path is the one we could see and bound. Whether the unnamed path (no library at all) carries the same risk our logs cannot say; the PR body states it. - Question 2 (what it costs a first start): Kal0s-design's table answers it for a healthy driver. For the refusing card we will add the warm-time number with the switch on, from the same session as the A/B above. **merzleckeier** - Agreed: if a guarded worker is parked inside `create()` while holding `COMPILE_GATE`, the replacement and every later fallback blocks on a gate nobody will release — that is a stall, and your integration note is the sharpest finding of the review. With the gate now off by default the two default-on paths no longer overlap; if maintainers want both usable together, the parking path has to drop the gate before the worker parks (or the replacement must bypass it), and #3222 is the right place to coordinate that — we will follow whatever is decided there. **lixonik, Kal0s-design** — verified as noted above; nothing to add except thanks, and that Kal0s-design's two tables are now quoted in findings.md with their numbers. AI-assisted: yes (GLM-5.3, in OpenCode; the change and this reply), with a separate read-only reviewer session before every push.
Noirdex commented 2026-12-03 01:12:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Noirdex on 2026-12-03T01:12:27Z.


The A/B on the reporting card is in, and the number is negative: the gate does not hold the device. Reporting it as it is.

Same route both runs (house to Mandy's house and back), same build (this PR's opt-in exe; with the switch unset the behaviour is main's), current main d5b30be1c with the full-pipeline precompile on by default (#3172):

switch played made (all 0x80070057) end
session 1 off 7m07s 3 (0.3 ms, 1331 ms, 9.2 ms) 0x887A0005, the GPU suspended, mid-play
session 2 on 29m33s 23 (7 to 31 ms each, serialised across six-plus threads; 2 loaded) 0x887A0005, the GPU suspended, mid-play

The morning's entry storm is gone from current main. The two runs of the findings section (58 and 24 refusals, nine and twelve threads compiling, removals as the world came up) do not happen any more: with the precompile now covering every pipeline, seven minutes of play made three pipelines and twenty-nine minutes made twenty-three, none over 1.4 s. The library still refuses loads from the file (every made line carries 0x80070057) — but almost nothing asks it in play.

What the removals on this card now are: mid-play, minutes in, with a quiet trail — valenciana-nc's family (#2570: same driver 621.47, losses within 3.7 to 8.5 minutes, held by LEONIDA_D3D12_BACKGROUND=0), not a storm. Session 2 ran the gate on — twenty-three compiles serialised exactly as designed — and the device was still removed. One session an arm says little, and we will not read the 29 minutes against the 7 as the gate's doing: nothing in either trail points at the compiles.

The honest position after today: the bound this PR adds is real (the serialisation held and the timings show it), but on current main nothing shows it prevents a removal — the failure it was for no longer reproduces, and the failure that remains is not a compile problem. Whether an opt-in bound is worth carrying for the cases that still make a storm (a cold cache, a refusing driver without the precompile's cover — the case #2789's library work is for) is the maintainers' call; if the answer is no, closing this is a fair decision and we will not argue it on today's numbers. The branch's code comment and findings section are updated with the same words in the head this comment replies to.

(fiestorra's warm-time question: with three and twenty-three makes in play the run-time cost is nothing measurable; the warm children's own compiles are where a gate would count, and with the switch opt-in that cost is only ever paid by choice.)

AI-assisted: yes (GLM-5.3, in OpenCode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7364077855 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7364077855). Originally posted by [Noirdex](https://github.com/Noirdex) on 2026-12-03T01:12:27Z. --- **The A/B on the reporting card is in, and the number is negative: the gate does not hold the device. Reporting it as it is.** Same route both runs (house to Mandy's house and back), same build (this PR's opt-in exe; with the switch unset the behaviour is main's), current main `d5b30be1c` with the full-pipeline precompile on by default (#3172): | | switch | played | made (all 0x80070057) | end | |---|---|---|---|---| | session 1 | off | 7m07s | 3 (0.3 ms, 1331 ms, 9.2 ms) | 0x887A0005, the GPU suspended, mid-play | | session 2 | on | 29m33s | 23 (7 to 31 ms each, serialised across six-plus threads; 2 loaded) | 0x887A0005, the GPU suspended, mid-play | **The morning's entry storm is gone from current main.** The two runs of the findings section (58 and 24 refusals, nine and twelve threads compiling, removals as the world came up) do not happen any more: with the precompile now covering every pipeline, seven minutes of play made **three** pipelines and twenty-nine minutes made **twenty-three**, none over 1.4 s. The library still refuses loads from the file (every made line carries 0x80070057) — but almost nothing asks it in play. **What the removals on this card now are:** mid-play, minutes in, with a quiet trail — valenciana-nc's family (#2570: same driver 621.47, losses within 3.7 to 8.5 minutes, held by `LEONIDA_D3D12_BACKGROUND=0`), not a storm. Session 2 ran the gate on — twenty-three compiles serialised exactly as designed — and the device was still removed. One session an arm says little, and we will not read the 29 minutes against the 7 as the gate's doing: nothing in either trail points at the compiles. **The honest position after today:** the bound this PR adds is real (the serialisation held and the timings show it), but on current main nothing shows it prevents a removal — the failure it was for no longer reproduces, and the failure that remains is not a compile problem. Whether an opt-in bound is worth carrying for the cases that still make a storm (a cold cache, a refusing driver without the precompile's cover — the case #2789's library work is for) is the maintainers' call; if the answer is no, closing this is a fair decision and we will not argue it on today's numbers. The branch's code comment and findings section are updated with the same words in the head this comment replies to. (fiestorra's warm-time question: with three and twenty-three makes in play the run-time cost is nothing measurable; the warm children's own compiles are where a gate would count, and with the switch opt-in that cost is only ever paid by choice.) AI-assisted: yes (GLM-5.3, in OpenCode).
MoonEyes commented 2026-12-03 01:45:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T01:45:12Z.


RUN (in game, one pull request), its head merged with git merge --no-ff onto main d15e048a7: #3185 bf907c629. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 17.0, mean 16.8
Rendered fps, last 120 s median 17.0
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. The change is behind a switch that is off by default, and it was left off: this run covers the default path only, not the one-compile-at-a-time mode.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7364694605 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7364694605). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T01:45:12Z. --- RUN (in game, one pull request), its head merged with `git merge --no-ff` onto main `d15e048a7`: #3185 `bf907c629`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 17.0, mean 16.8 | | Rendered fps, last 120 s | median 17.0 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. The change is behind a switch that is off by default, and it was left off: this run covers the default path only, not the one-compile-at-a-time mode. AI-assisted (Claude Code).
ninjalegxd commented 2026-12-03 15:35:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ninjalegxd on 2026-12-03T15:35:20Z.


Tested #3185 on RTX 3090 (driver 621.47), Win11, main + this PR, -SeriesS -NoFrameGen,
LEONIDA_LIBRARY_COMPILE_GATE=1 and LEONIDA_SAMPLE_MASK=0 (confirmed on the settings line).
PR head tested: bf907c6294

  • device removed (0x887A0005) after ~7.7 min in the world, "device-removed data; none"
  • at the removal: 10 submissions in flight, preparing 29 lists
  • median 33.7 fps (world)

Unlike my earlier runs (rem
oval 19-660 ms after a new pipeline), here the last pipeline
was made ~4.6 s before the removal, so with the gate on the loss no longer follows a
compile directly. Details of earlier runs: #3068.

AI-assisted: Claude Opus 5.5 (Anthropic) helped analyze the logs and draft this comment.

play-1203-172134.log

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7383397869 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3185#issuecomment-7383397869). Originally posted by [ninjalegxd](https://github.com/ninjalegxd) on 2026-12-03T15:35:20Z. --- Tested #3185 on RTX 3090 (driver 621.47), Win11, main + this PR, -SeriesS -NoFrameGen, LEONIDA_LIBRARY_COMPILE_GATE=1 and LEONIDA_SAMPLE_MASK=0 (confirmed on the settings line). PR head tested: bf907c6294 - device removed (0x887A0005) after ~7.7 min in the world, "device-removed data; none" - at the removal: 10 submissions in flight, preparing 29 lists - median 33.7 fps (world) Unlike my earlier runs (rem oval 19-660 ms after a new pipeline), here the last pipeline was made ~4.6 s before the removal, so with the gate on the loss no longer follows a compile directly. Details of earlier runs: #3068. AI-assisted: Claude Opus 5.5 (Anthropic) helped analyze the logs and draft this comment. [play-1203-172134.log](https://github.com/user-attachments/files/35821293/play-1203-172134.log)
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/3185:upstream-pr/3185'
git switch 'upstream-pr/3185'

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