Build previously drawn pipelines once during D3D12 warmup (D3D12-WARM-BUILD-ONCE) #3150

Open
AronnoM wants to merge 2 commits from upstream-pr/3150 into main
AronnoM commented 2026-12-02 14:17:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by AronnoM on 2026-12-02T14:17:27Z.


Claimed in the coordination issue as: D3D12-WARM-BUILD-ONCE

Depends on: #3071, #3143 (textual conflicts in the warmup worker code if either lands first).

What and why

The default warmup previously built pipelines in driver-cache workers and then requested them again for the persistent library. With this change, leonida warm --used builds previously drawn pipelines directly in the persistent library. Once the isolated store process confirms the write, the launcher records the entries it saved and skips their driver-cache pass. Entries that still need warming go through the existing driver-cache workers. Explicit --limit, --again, and full-archive runs retain their scheduling order.

Review follow-up

Commit 968b05d40 passes the resolved --jobs value to the library worker on both the default and limited warmup paths. The store starts at most one thread per matching pipeline record. On Windows with 20 logical processors, we observed --jobs 23 reaching the child as 20 before this change and 23 afterward on both paths. The worker-count regression also covers an empty queue, a single entry with a large override, and a request smaller than the available work. Original review

Tested

  • The new synthetic test that checks library-first ordering failed on the base build and passed with the patch. A second synthetic test exercised an unavailable diagnostics file. On the latest checked base, 50 app tests, 777 GPU library tests and GPU frame replay passed on Windows. The clean-room scan and 35 Python game-gate tests also passed. The documented depth-bounds exclusion was applied.
  • On a matched subset of 160 previously drawn pipelines, two baseline warmups took 70.56 s and 42.30 s. The two patched warmups took 8.41 s and 6.26 s. Each run started with an empty isolated host library and saved all 160. The NVIDIA driver disk cache was shared across the four runs.
  • The normal Series S launcher processed 2,102 recorded pipelines in 69 s. The library held 2,101 entries and the driver-only fallback completed the other. The launcher reached the world. The gate later stopped at its private-memory limit.
  • Forcing a binary library write failure on the RTX 3070 reached the driver fallback without marking the entry as persisted or recording a library crash. A follow-up warmup skipped all 160 already-persisted entries from the matched sample.

GPUs tested: NVIDIA GeForce RTX 3070 8 GiB, driver 610.60, Windows 11 build 26300.

AI-assisted: Yes. OpenAI Codex (GPT-6) implementation and GPT-6.2 Sol independent read-only review.

Checklist

  • One topic and a separate branch
  • Patch applies to the clean 69cd4106c base
  • No game content in the patch or this report
  • Red/green regression and independent review
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5608264546 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150). Originally posted by [AronnoM](https://github.com/AronnoM) on 2026-12-02T14:17:27Z. --- Claimed in the coordination issue as: [D3D12-WARM-BUILD-ONCE](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7346207739) Depends on: #3071, #3143 (textual conflicts in the warmup worker code if either lands first). ### What and why The default warmup previously built pipelines in driver-cache workers and then requested them again for the persistent library. With this change, `leonida warm --used` builds previously drawn pipelines directly in the persistent library. Once the isolated store process confirms the write, the launcher records the entries it saved and skips their driver-cache pass. Entries that still need warming go through the existing driver-cache workers. Explicit `--limit`, `--again`, and full-archive runs retain their scheduling order. ### Review follow-up Commit `968b05d40` passes the resolved `--jobs` value to the library worker on both the default and limited warmup paths. The store starts at most one thread per matching pipeline record. On Windows with 20 logical processors, we observed `--jobs 23` reaching the child as `20` before this change and `23` afterward on both paths. The worker-count regression also covers an empty queue, a single entry with a large override, and a request smaller than the available work. [Original review](https://github.com/ProjectLeonida/mandy/pull/3150#pullrequestreview-6152692395) ### Tested - The new synthetic test that checks library-first ordering failed on the base build and passed with the patch. A second synthetic test exercised an unavailable diagnostics file. On the latest checked base, 50 app tests, 777 GPU library tests and GPU frame replay passed on Windows. The clean-room scan and 35 Python game-gate tests also passed. The documented depth-bounds exclusion was applied. - On a matched subset of 160 previously drawn pipelines, two baseline warmups took 70.56 s and 42.30 s. The two patched warmups took 8.41 s and 6.26 s. Each run started with an empty isolated host library and saved all 160. The NVIDIA driver disk cache was shared across the four runs. - The normal Series S launcher processed 2,102 recorded pipelines in 69 s. The library held 2,101 entries and the driver-only fallback completed the other. The launcher reached the world. The gate later stopped at its private-memory limit. - Forcing a binary library write failure on the RTX 3070 reached the driver fallback without marking the entry as persisted or recording a library crash. A follow-up warmup skipped all 160 already-persisted entries from the matched sample. GPUs tested: NVIDIA GeForce RTX 3070 8 GiB, driver 610.60, Windows 11 build 26300. AI-assisted: Yes. OpenAI Codex (GPT-6) implementation and GPT-6.2 Sol independent read-only review. ### Checklist - [x] One topic and a separate branch - [x] Patch applies to the clean `69cd4106c` base - [x] No game content in the patch or this report - [x] Red/green regression and independent review
merzleckeier commented 2026-12-02 14:24:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:24:49Z.

Review: COMMENTED


Reviewed 6a5e5bcd on main at 69cd4106. Both Windows-target leonida warm integration tests passed under Wine with synthetic pipeline records. They exercise library-first fallback after a refusal and the driver worker continuing when slow-pipelines.txt cannot be opened. Successful persistence of a host PSO on a native Windows driver remains unverified in this run.

I also combined #3071, #3143, and this PR locally. The warm.rs conflicts were resolved with library-first scheduling, the independent stdout/stderr watchdog, and the typed save failure. The combination passed 60 CLI unit tests, both warm integration tests, and all 20 switch-documentation tests. A synthetic exit-code test also confirmed that status 3 is treated as a save failure only for the store worker.

For the merge, pass the resolved jobs value at both store_in_library call sites. Keeping jobs.min(cores) there would silently clamp an explicit --jobs value for library work, while #3071 preserves explicit overrides and caps the automatic default. The tested combination forwards jobs at both sites.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6152692395 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#pullrequestreview-6152692395). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:24:49Z. **Review:** COMMENTED --- Reviewed `6a5e5bcd` on `main` at `69cd4106`. Both Windows-target `leonida` warm integration tests passed under Wine with synthetic pipeline records. They exercise library-first fallback after a refusal and the driver worker continuing when `slow-pipelines.txt` cannot be opened. Successful persistence of a host PSO on a native Windows driver remains unverified in this run. I also combined #3071, #3143, and this PR locally. The `warm.rs` conflicts were resolved with library-first scheduling, the independent stdout/stderr watchdog, and the typed save failure. The combination passed 60 CLI unit tests, both warm integration tests, and all 20 switch-documentation tests. A synthetic exit-code test also confirmed that status `3` is treated as a save failure only for the store worker. For the merge, pass the resolved `jobs` value at both `store_in_library` call sites. Keeping `jobs.min(cores)` there would silently clamp an explicit `--jobs` value for library work, while #3071 preserves explicit overrides and caps the automatic default. The tested combination forwards `jobs` at both sites.
lixonik commented 2026-12-02 14:59:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T14:59:04Z.


Verified PR #3150 (6a5e5bcd4) merged cleanly onto main (acc350745) on native Windows 10 x64 (Rust 1.98.1):

  • Clean-room check: python -I scripts/check_no_game_data.py PASS.
  • Native Windows tests:
    • cargo test -p leonida --locked:
      • leonida unit tests (src/main.rs): 43 passed, 0 failed
      • tests/warm.rs (new integration tests): 2 passed, 0 failed (4.13 s)
      • tests/agility.rs, tests/census.rs, tests/settings_line.rs: 5 passed, 0 failed
    • cargo test -p leonida-gpu --lib --locked pipeline::known::: 3 passed, 0 failed (including store_workers_follow_the_request_up_to_the_available_work)
    • cargo test -p leonida-gpu --lib --locked pipeline::library::: 6 passed, 0 failed
  • Note for maintainers: d3d12/apps/leonida/src/warm.rs also overlaps with #3071 (RAM-capped worker count); whichever merges second will need a small merge in warm.rs.

Verdict: PASS (native Windows unit + integration tests; no game launch).

AI-assisted: yes (Antigravity).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7349490136 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#issuecomment-7349490136). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T14:59:04Z. --- Verified PR #3150 (`6a5e5bcd4`) merged cleanly onto `main` (`acc350745`) on native Windows 10 x64 (Rust 1.98.1): - **Clean-room check:** `python -I scripts/check_no_game_data.py` PASS. - **Native Windows tests:** - `cargo test -p leonida --locked`: - `leonida` unit tests (`src/main.rs`): **43 passed, 0 failed** - `tests/warm.rs` (new integration tests): **2 passed, 0 failed** (4.13 s) - `tests/agility.rs`, `tests/census.rs`, `tests/settings_line.rs`: **5 passed, 0 failed** - `cargo test -p leonida-gpu --lib --locked pipeline::known::`: **3 passed, 0 failed** (including `store_workers_follow_the_request_up_to_the_available_work`) - `cargo test -p leonida-gpu --lib --locked pipeline::library::`: **6 passed, 0 failed** - **Note for maintainers:** `d3d12/apps/leonida/src/warm.rs` also overlaps with #3071 (RAM-capped worker count); whichever merges second will need a small merge in `warm.rs`. Verdict: **PASS** (native Windows unit + integration tests; no game launch). AI-assisted: yes (Antigravity).
Kal0s-design commented 2026-12-02 15:56:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T15:56:52Z.


Ran natively on Windows 11, head 968b05d40 merged into current main (3c106eb2f, clean merge). The earlier reports in this thread were on 6a5e5bcd4, so these are the first results on the current head.

Suites (measured)

Suite Result
cargo test -p leonida --locked 43 unit + 2 agility + 2 census + 1 settings_line + 2 tests/warm.rs = 50 passed, 0 failed
cargo test -p leonida-gpu --lib --locked 697 passed, 0 failed, 59 ignored
cargo test -p leonida-gpu --lib --locked pipeline:: 60 passed, 0 failed, 8 ignored
cargo clippy -p leonida -p leonida-gpu --all-targets --locked only the existing unused_mut in leonida-gpu/src/host.rs; nothing new

Synthetic warm books (measured)

Each scenario ran leonida warm --used with the PR test's isolation: LEONIDA_CACHE_DIR and LEONIDA_DATA_DIR set to a fresh temporary directory, LEONIDA_CONFIG unset, LEONIDA_WARM_LIBRARY=1, LEONIDA_WARM_DONE_ALL=0. Each ran 1 to 3 times in the same directory, on main and on the merge, with the hardware adapter. All records are hand-made, so none can produce a host pipeline.

Book main PR Exit / files after each run
Same key twice (plus one never-drawn) 2 to make, 2 have no pipeline 2 through the library (0 kept), then 2 to the driver workers 0 on both; warm-done, warm-bad, library-done stay empty
Last record torn (length says 18, 10 bytes present) torn one dropped, 1 known same 0 on both
First record's length is 0xFFFFFFFF 0 known: every record after it is lost same 0 on both (existing walk_pipelines behaviour, not this PR)
Record shorter than 16 bytes (empty key) counted, matched by an empty line in early-pipelines.txt same 0 on both
Early list names a key not in the book ignored ignored 0 on both
One stage whose container is missing from known-shaders.bin 1 have no pipeline library attempt, then driver 0 on both
One compute stage with 64 bytes of garbage as its container driver worker: no pipeline in 233–263 ms, no crash library store, then driver worker: 213–272 ms for the driver worker 0 on both; never written to warm-bad.txt, so it is retried on every launch on both sides

For the garbage entry I also ran the store step alone (warm --these 0 --store --jobs 1, same isolation). Both binaries log shader does not translate … not a DXBC container and print made 0 <ms> 0: 326 ms on the PR, 347 ms on main. On main the store then prints saving with nothing kept; the PR skips the save (any_kept false).

Cost when nothing can be kept (measured, wall time per launch, debug-profile binaries, hardware adapter)

Records (all used, none buildable) Build attempts per launch main PR
1–2 (scenarios above; the very first launch of each binary excluded) main N (driver); PR N (library) + N (driver); 0 kept on both 979–1,064 ms 1,523–1,719 ms
200 (3 runs each, alternating) same 1,066–1,131 ms 1,563–1,606 ms
2,000 (3 runs each, alternating) same 2,617–2,625 ms 3,094–3,111 ms

The PR adds a fixed ~0.5 s per launch when no entry is kept, whatever the count. By reading, that is the extra --store child process that runs before the driver workers. I did not time its parts. Every entry still reaches the driver workers afterwards. When nothing is kept, the store exits 0 without writing, and library-failed.txt is not touched. The ~0.5 s is small next to the 160-pipeline savings in the PR body, but it is paid on every launch where no used entry can be kept.

Reading only

  • After two store crashes for a fingerprint, store_in_library returns early. Because of if library_first { return Ok(()) }, the old library pass is then skipped too, so that fingerprint never gets a library. main behaves the same, since its library pass checks the same count.
  • On a Worker failure, every entry the store reported as kept before the crash is dropped (HashMap::new()), so all of them go back to the driver workers. That is correct, because the library was never saved.
  • #3143 still conflicts with this head: git merge-tree reports 3 hunks in apps/leonida/src/warm.rs (imports, child signature, the wait loop). #3071 is still open.

Not checked: a real pipeline kept in and reloaded from the library (no container fixture without game data), a forced store crash or save failure (exit 3) on this head, WARP, the debug layer, any game run.

GPUs tested: one NVIDIA desktop card.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351194334 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#issuecomment-7351194334). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T15:56:52Z. --- Ran natively on Windows 11, head `968b05d40` merged into current `main` (`3c106eb2f`, clean merge). The earlier reports in this thread were on `6a5e5bcd4`, so these are the first results on the current head. **Suites (measured)** | Suite | Result | |---|---| | `cargo test -p leonida --locked` | 43 unit + 2 agility + 2 census + 1 settings_line + 2 `tests/warm.rs` = 50 passed, 0 failed | | `cargo test -p leonida-gpu --lib --locked` | 697 passed, 0 failed, 59 ignored | | `cargo test -p leonida-gpu --lib --locked pipeline::` | 60 passed, 0 failed, 8 ignored | | `cargo clippy -p leonida -p leonida-gpu --all-targets --locked` | only the existing `unused_mut` in `leonida-gpu/src/host.rs`; nothing new | **Synthetic warm books (measured)** Each scenario ran `leonida warm --used` with the PR test's isolation: `LEONIDA_CACHE_DIR` and `LEONIDA_DATA_DIR` set to a fresh temporary directory, `LEONIDA_CONFIG` unset, `LEONIDA_WARM_LIBRARY=1`, `LEONIDA_WARM_DONE_ALL=0`. Each ran 1 to 3 times in the same directory, on `main` and on the merge, with the hardware adapter. All records are hand-made, so none can produce a host pipeline. | Book | `main` | PR | Exit / files after each run | |---|---|---|---| | Same key twice (plus one never-drawn) | 2 to make, 2 have no pipeline | 2 through the library (0 kept), then 2 to the driver workers | 0 on both; `warm-done`, `warm-bad`, `library-done` stay empty | | Last record torn (length says 18, 10 bytes present) | torn one dropped, 1 known | same | 0 on both | | First record's length is `0xFFFFFFFF` | 0 known: every record after it is lost | same | 0 on both (existing `walk_pipelines` behaviour, not this PR) | | Record shorter than 16 bytes (empty key) | counted, matched by an empty line in `early-pipelines.txt` | same | 0 on both | | Early list names a key not in the book | ignored | ignored | 0 on both | | One stage whose container is missing from `known-shaders.bin` | 1 have no pipeline | library attempt, then driver | 0 on both | | One compute stage with 64 bytes of garbage as its container | driver worker: no pipeline in 233–263 ms, no crash | library store, then driver worker: 213–272 ms for the driver worker | 0 on both; never written to `warm-bad.txt`, so it is retried on every launch on both sides | For the garbage entry I also ran the store step alone (`warm --these 0 --store --jobs 1`, same isolation). Both binaries log `shader does not translate … not a DXBC container` and print `made 0 <ms> 0`: 326 ms on the PR, 347 ms on `main`. On `main` the store then prints `saving` with nothing kept; the PR skips the save (`any_kept` false). **Cost when nothing can be kept (measured, wall time per launch, debug-profile binaries, hardware adapter)** | Records (all used, none buildable) | Build attempts per launch | `main` | PR | |---|---|---|---| | 1–2 (scenarios above; the very first launch of each binary excluded) | `main` N (driver); PR N (library) + N (driver); 0 kept on both | 979–1,064 ms | 1,523–1,719 ms | | 200 (3 runs each, alternating) | same | 1,066–1,131 ms | 1,563–1,606 ms | | 2,000 (3 runs each, alternating) | same | 2,617–2,625 ms | 3,094–3,111 ms | The PR adds a fixed ~0.5 s per launch when no entry is kept, whatever the count. By reading, that is the extra `--store` child process that runs before the driver workers. I did not time its parts. Every entry still reaches the driver workers afterwards. When nothing is kept, the store exits 0 without writing, and `library-failed.txt` is not touched. The ~0.5 s is small next to the 160-pipeline savings in the PR body, but it is paid on every launch where no used entry can be kept. **Reading only** - After two store crashes for a fingerprint, `store_in_library` returns early. Because of `if library_first { return Ok(()) }`, the old library pass is then skipped too, so that fingerprint never gets a library. `main` behaves the same, since its library pass checks the same count. - On a `Worker` failure, every entry the store reported as kept before the crash is dropped (`HashMap::new()`), so all of them go back to the driver workers. That is correct, because the library was never saved. - #3143 still conflicts with this head: `git merge-tree` reports 3 hunks in `apps/leonida/src/warm.rs` (imports, `child` signature, the wait loop). #3071 is still open. Not checked: a real pipeline kept in and reloaded from the library (no container fixture without game data), a forced store crash or save failure (exit 3) on this head, WARP, the debug layer, any game run. GPUs tested: one NVIDIA desktop card. AI-assisted: yes (Claude Code).
fiestorra commented 2026-12-02 16:00:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T16:00:59Z.


Checked here: the pull request's tests pass, and a real warm run with its build works end to end. The checker's green fails is this machine, not your change.

python -I scripts/red_green.py 3150                  1.1 min

base origin/main 3c106eb2f, head 3150 968b05d40, merge base ...
ran: cargo -p leonida, cargo -p leonida-gpu
red does not build: error[E0425]: cannot find function `store_workers` in this scope
verdict: green fails

Both lines are true and neither is about this branch being broken:

  • red does not build - the new tests call store_workers, which the change introduces, so there is no red side to compare. Same shape as any PR whose tests need the new code.
  • green fails - the -p leonida-gpu half runs on this machine's integrated Radeon, and descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in fails there because the device tests still make their device with D3D12CreateDevice(None, ..) (#2995 fixes that). cargo test -p leonida-gpu --lib on main here is 695 passed, 1 failed, and that is the one.

Isolated, the green side is green (cargo test -p leonida --tests warm, head 968b05d40):

warm::tests::only_pipelines_drawn_with_go_into_the_library ... ok
warm_used_tries_the_library_before_falling_back_to_workers ... ok

And a real run, leonida warm with this build on this machine's own book (83,563 pipelines known, a copy of a real cache):

--limit 40  --jobs 8     40 made in 1 s   (13 have no host pipeline, 0 ended their process)
                         median 3.0 ms, p90 45.1, p99 212
--limit 200 --jobs 8    200 made in 65 s  (71 have no host pipeline, 0 ended their process)
                         median 30.5 ms, p90 2423.8
                         then 27 made before on the next start, and 129 through the pipeline library

0 ended their process in both, and the library collects what was made - which is what "build once, then request from the library" has to look like from outside.

What I am not claiming: a speed-up. I ran 40 and 200 with this build and 40 with #3143's build on a different day of the same cache, and different limits choose different pipelines: 3.0 ms against 7.4 ms median is not a controlled comparison, and p90 is dominated by whichever heavy pipeline the limit happened to include.

Not covered: the in-game effect of building once, and the conflict with #3143 that the body already names.

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

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351309656 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#issuecomment-7351309656). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T16:00:59Z. --- **Checked here: the pull request's tests pass, and a real `warm` run with its build works end to end. The checker's `green fails` is this machine, not your change.** ``` python -I scripts/red_green.py 3150 1.1 min base origin/main 3c106eb2f, head 3150 968b05d40, merge base ... ran: cargo -p leonida, cargo -p leonida-gpu red does not build: error[E0425]: cannot find function `store_workers` in this scope verdict: green fails ``` **Both lines are true and neither is about this branch being broken**: - **`red does not build`** - the new tests call `store_workers`, which the change introduces, so there is no red side to compare. **Same shape as any PR whose tests need the new code.** - **`green fails`** - **the `-p leonida-gpu` half runs on this machine's integrated Radeon**, and `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` fails there because the device tests still make their device with `D3D12CreateDevice(None, ..)` (#2995 fixes that). **`cargo test -p leonida-gpu --lib` on `main` here is 695 passed, 1 failed, and that is the one.** **Isolated, the green side is green** (`cargo test -p leonida --tests warm`, head `968b05d40`): ``` warm::tests::only_pipelines_drawn_with_go_into_the_library ... ok warm_used_tries_the_library_before_falling_back_to_workers ... ok ``` **And a real run**, `leonida warm` with this build on this machine's own book (83,563 pipelines known, a copy of a real cache): ``` --limit 40 --jobs 8 40 made in 1 s (13 have no host pipeline, 0 ended their process) median 3.0 ms, p90 45.1, p99 212 --limit 200 --jobs 8 200 made in 65 s (71 have no host pipeline, 0 ended their process) median 30.5 ms, p90 2423.8 then 27 made before on the next start, and 129 through the pipeline library ``` **`0 ended their process` in both, and the library collects what was made** - which is what "build once, then request from the library" has to look like from outside. **What I am not claiming**: **a speed-up.** I ran 40 and 200 with this build and 40 with #3143's build on a different day of the same cache, and **different limits choose different pipelines**: 3.0 ms against 7.4 ms median is not a controlled comparison, and p90 is dominated by whichever heavy pipeline the limit happened to include. **Not covered**: the in-game effect of building once, and the conflict with #3143 that the body already names. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
MoonEyes commented 2026-12-02 18:11:45 +00:00 (Migrated from github.com)

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


Reviewed #3150 (code review only, not built here: leonida warm is Windows-only). The change does what it says, and three Windows runs on or just before this head agree. One nit, and an overlap with #3143 to settle first.

Head 968b05d40c
Merge with main 45dc41f95c clean (git merge-tree); merge base 69cd4106ce, 38 commits behind
Switches registry on the merge python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: exit 0
Windows evidence Kal0s-design (this head, merged onto 3c106eb2f), fiestorra (this head: tests plus a real warm of 40 and 200 pipelines, 0 ended their process), lixonik (6a5e5bcd4, the parent)

Review

  • run (d3d12/apps/leonida/src/warm.rs:83-111 on the head): for the launcher's case (used && !again && limit.is_none() and the library store on), the previously drawn pipelines go into the library first, and only what the library did not keep goes to the isolated driver workers. A refusal, crash or save failure falls back to the old path instead of losing pipelines. That matches the cause in the description (the driver's own cache can drop work between processes; the game loads from the library).
  • store_these saves only when something was kept and exits with SAVE_FAILED (3) when known::save_library() fails. store_in_library treats that as ChildFailure::Save and does not write it to the "failed twice" file, so an I/O failure does not disable the library for that translation. Good distinction.
  • The default worker count is unchanged: run resolves jobs.unwrap_or(cores * 2 / 3).max(1) (:75) and passes it to the child as --jobs, and store_these falls back to the same * 2 / 3.
  • Nit: store_these does not clamp jobs (:367), so a manual leonida warm --these ... --store --jobs 0 would ask known::store for 0 threads. The launcher path always passes at least 1. .max(1) there would match run.
  • Red side: scripts/red_green.py reports "red does not build" because the new tests call the new store_workers. That is expected for this kind of change; the real warm runs above are the behavioural evidence.

Overlap. The description and fiestorra both name a conflict with #3143 (warm: distinguish compiler diagnostics from inactivity timeouts, open, same file). Whichever lands second needs a rebase and a rerun of cargo test -p leonida --tests warm.

Verdict: ready (nit optional). Not a render-path change, so no in-game gate was requested.

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

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354098478 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#issuecomment-7354098478). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:11:45Z. --- **Reviewed #3150 (code review only, not built here: `leonida warm` is Windows-only). The change does what it says, and three Windows runs on or just before this head agree. One nit, and an overlap with #3143 to settle first.** | | | |---|---| | Head | `968b05d40c` | | Merge with `main` `45dc41f95c` | clean (`git merge-tree`); merge base `69cd4106ce`, 38 commits behind | | Switches registry on the merge | `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md`: exit 0 | | Windows evidence | Kal0s-design (this head, merged onto `3c106eb2f`), fiestorra (this head: tests plus a real `warm` of 40 and 200 pipelines, `0 ended their process`), lixonik (`6a5e5bcd4`, the parent) | **Review** - `run` (`d3d12/apps/leonida/src/warm.rs:83-111` on the head): for the launcher's case (`used && !again && limit.is_none()` and the library store on), the previously drawn pipelines go into the library first, and only what the library did not keep goes to the isolated driver workers. A refusal, crash or save failure falls back to the old path instead of losing pipelines. That matches the cause in the description (the driver's own cache can drop work between processes; the game loads from the library). - `store_these` saves only when something was kept and exits with `SAVE_FAILED` (3) when `known::save_library()` fails. `store_in_library` treats that as `ChildFailure::Save` and does **not** write it to the "failed twice" file, so an I/O failure does not disable the library for that translation. Good distinction. - The default worker count is unchanged: `run` resolves `jobs.unwrap_or(cores * 2 / 3).max(1)` (`:75`) and passes it to the child as `--jobs`, and `store_these` falls back to the same `* 2 / 3`. - Nit: `store_these` does not clamp `jobs` (`:367`), so a manual `leonida warm --these ... --store --jobs 0` would ask `known::store` for 0 threads. The launcher path always passes at least 1. `.max(1)` there would match `run`. - Red side: `scripts/red_green.py` reports "red does not build" because the new tests call the new `store_workers`. That is expected for this kind of change; the real `warm` runs above are the behavioural evidence. **Overlap.** The description and fiestorra both name a conflict with #3143 (`warm: distinguish compiler diagnostics from inactivity timeouts`, open, same file). Whichever lands second needs a rebase and a rerun of `cargo test -p leonida --tests warm`. **Verdict: ready** (nit optional). Not a render-path change, so no in-game gate was requested. AI-assisted: Claude Opus 5.5 (Claude Code), review only. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
fiestorra commented 2026-12-03 00:16:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:16:11Z.


VERIFY-3150 — Windows nativo: red then green en el número de workers del store

Own commit 968b05d40 — warm.rs (4 lines), pipeline/known.rs (+14)

Ran at the head

cargo test -p leonida-gpu --lib known     13 passed; 0 failed
  pipeline::known::tests::store_workers_follow_the_request_up_to_the_available_work ... ok

Negative control (synthetic): I dropped the upper bound (requested.max(1).min(entries) → requested.max(1)), rebuilt and ran:

FAILED: store_workers_follow_the_request_up_to_the_available_work
assertion `left == right` failed

It bites.

What the change is: three things at once, and the first is the point of the title — an explicit worker count is honoured on both library paths (jobs.min(cores) removed: a user who says -j 32 on a 8-core machine gets 32, because the default is what caps by cores, not the request), and the store threads are the request bounded by the work there is (store_workers(requested, entries) = requested.max(1).min(entries)).

The two bounds are different bounds and that is the whole design: a request is capped by the work (never more threads than entries) but not by the CPU — because the cap by CPU belongs to default_jobs, which is what someone gets when they do not say.

And keeping max(1) inside the same function is the part that saves the zero case: -j 0 or an empty work list must not spawn nothing and hang.

What I could not test

  • A warm store with an explicit -j above the core count: it needs the title's toolchain; the tests drive the function.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362994335 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#issuecomment-7362994335). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T00:16:11Z. --- ## VERIFY-3150 — Windows nativo: `red then green` en el número de workers del store | | | |---|---| | Own commit | `968b05d40` — `warm.rs` (4 lines), `pipeline/known.rs` (+14) | **Ran at the head** ``` cargo test -p leonida-gpu --lib known 13 passed; 0 failed pipeline::known::tests::store_workers_follow_the_request_up_to_the_available_work ... ok ``` **Negative control (synthetic)**: I dropped the upper bound (`requested.max(1).min(entries)` → `requested.max(1)`), rebuilt and ran: ``` FAILED: store_workers_follow_the_request_up_to_the_available_work assertion `left == right` failed ``` **It bites.** **What the change is**: three things at once, and the first is the point of the title — **an explicit worker count is honoured on both library paths** (`jobs.min(cores)` removed: **a user who says `-j 32` on a 8-core machine gets 32, because the default is what caps by cores, not the request**), **and the store threads are the request bounded by the work there is** (`store_workers(requested, entries) = requested.max(1).min(entries)`). **The two bounds are different bounds and that is the whole design**: **a request is capped by the work (never more threads than entries) but not by the CPU** — **because the cap by CPU belongs to `default_jobs`, which is what someone gets when they do not say.** **And keeping `max(1)` inside the same function is the part that saves the zero case**: `-j 0` or an empty work list must not spawn nothing and hang. ## What I could not test - **A warm store with an explicit `-j` above the core count**: it needs the title's toolchain; the tests drive the function. Written with an AI assistant.
merzleckeier commented 2026-12-03 00:21:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T00:21:43Z.

Review: COMMENTED


Tested the merge-order overlap with #3143 on current main (d5b30be1), using #3150 at 968b05d4 and #3143 at b6023d1d. The conflict is confined to apps/leonida/src/warm.rs. In a scratch merge I kept #3150’s library-first ordering and typed ChildFailure::Save, and carried the store-worker flag into #3143’s process/pipe watcher.

That distinction matters for fallback. In a synthetic child test the same exit code 3 reports Save for a library store worker and an ordinary worker error for a driver worker. A save failure can therefore fall back without adding the fingerprint to the library failure list. The stack-overflow, final stderr, quiet timeout, inherited stderr, and successful-exit controls still pass.

I cross-built the Windows MSVC test targets and ran them under Wine. All 11 warm unit tests passed, including the exit-code distinction, and both of #3150’s integration tests passed. Those exercise library-first fallback and the diagnostic-file failure with hand-made pipeline records. The switches registry also passes. This was a local integration check with synthetic data. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6161482915 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#pullrequestreview-6161482915). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T00:21:43Z. **Review:** COMMENTED --- Tested the merge-order overlap with #3143 on current `main` (`d5b30be1`), using #3150 at `968b05d4` and #3143 at `b6023d1d`. The conflict is confined to `apps/leonida/src/warm.rs`. In a scratch merge I kept #3150’s library-first ordering and typed `ChildFailure::Save`, and carried the store-worker flag into #3143’s process/pipe watcher. That distinction matters for fallback. In a synthetic child test the same exit code 3 reports `Save` for a library store worker and an ordinary worker error for a driver worker. A save failure can therefore fall back without adding the fingerprint to the library failure list. The stack-overflow, final stderr, quiet timeout, inherited stderr, and successful-exit controls still pass. I cross-built the Windows MSVC test targets and ran them under Wine. All 11 warm unit tests passed, including the exit-code distinction, and both of #3150’s integration tests passed. Those exercise library-first fallback and the diagnostic-file failure with hand-made pipeline records. The switches registry also passes. This was a local integration check with synthetic data. AI-assisted.
AronnoM commented 2026-12-03 13:43:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by AronnoM on 2026-12-03T13:43:35Z.


Here's another data point for this PR, in the case it matters most: the warm-up right after an update.

After a translator or driver update the fingerprint changes, so library-done.txt and warm-done.txt have nothing for it, and everything earlier runs drew with gets warmed again. To recreate that, I took a copy of a real cache (88,654 known pipelines, 3,870 drawn with, 363 MB library), emptied those two files, restored the library, and ran leonida warm --used with 13 workers and the play script's environment.

Wall time
main b053a1813, the two passes as today 940 s (~15.7 min)
this PR, 968b05d40 208 s (~3.5 min)

With this PR all 3,870 went through the library step in 206 s, and every one ended up in the library. Nothing was refused and nothing crashed.

I was half expecting the single store process to choke on the misses by compiling them one at a time. It didn't: per-pipeline times added up to 2,625 s in 207 s of wall time, so about 13 were going at once.

A few things to keep in mind:

  • This PR ran under a fresh exe name, so the driver cache was cold, its worst case. The main run had a warm one, which helps main.
  • The main run also had some unrelated local changes of mine on top. Plain main would probably be the same or slower.
  • This branch is on an older base (69cd4106c), so a few shaders may translate differently. I didn't count how many of the 3,870 were loaded from the library and how many were compiled, so compare the wall times, not the pipeline-by-pipeline split.

RTX 3070 8 GB, driver 610.60, i7-12700F, 16 GB, Windows 11 26300. Measured with AI help (Claude Code); the numbers are straight from the runs' output.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380280327 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3150#issuecomment-7380280327). Originally posted by [AronnoM](https://github.com/AronnoM) on 2026-12-03T13:43:35Z. --- Here's another data point for this PR, in the case it matters most: the warm-up right after an update. After a translator or driver update the fingerprint changes, so `library-done.txt` and `warm-done.txt` have nothing for it, and everything earlier runs drew with gets warmed again. To recreate that, I took a copy of a real cache (88,654 known pipelines, 3,870 drawn with, 363 MB library), emptied those two files, restored the library, and ran `leonida warm --used` with 13 workers and the play script's environment. | | Wall time | |---|---| | main `b053a1813`, the two passes as today | **940 s** (~15.7 min) | | **this PR, `968b05d40`** | **208 s** (~3.5 min) | With this PR all 3,870 went through the library step in 206 s, and every one ended up in the library. Nothing was refused and nothing crashed. I was half expecting the single store process to choke on the misses by compiling them one at a time. It didn't: per-pipeline times added up to 2,625 s in 207 s of wall time, so about 13 were going at once. A few things to keep in mind: - This PR ran under a fresh exe name, so the driver cache was cold, its worst case. The main run had a warm one, which helps main. - The main run also had some unrelated local changes of mine on top. Plain main would probably be the same or slower. - This branch is on an older base (`69cd4106c`), so a few shaders may translate differently. I didn't count how many of the 3,870 were loaded from the library and how many were compiled, so compare the wall times, not the pipeline-by-pipeline split. RTX 3070 8 GB, driver 610.60, i7-12700F, 16 GB, Windows 11 26300. Measured with AI help (Claude Code); the numbers are straight from the runs' output.
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/3150:upstream-pr/3150'
git switch 'upstream-pr/3150'

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