Default to full D3D12 shader and pipeline precompilation #3172

Merged
ubiquitarianism merged 2 commits from upstream-pr/3172 into main 2026-12-02 17:24:25 +00:00
ubiquitarianism commented 2026-12-02 16:17:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-12-02T16:17:29Z.


Claimed as D3D12-FULL-PRECOMPILE-DEFAULT.

What and why

Windows Play translates every shader and warms every recorded pipeline by default. This uses the existing full warm-up and its driver cache. A fresh pipeline book contains no entries. The first substantial full warm-up happens on a later launch, after the game records pipelines. A large book can take an hour or more to warm, and parallel compiler processes can use several GB of system RAM.

  • -PrecompileUsed keeps shader translation and warms only pipelines used to draw in previous runs. -NoPrecompile skips both stages.
  • Keep the legacy -PrecompileAll switch and its explicit PowerShell false form. Preserve the used-only choice on in-game restart.
  • Fresh desktop and web launcher settings enable full warm-up. Saved values still determine the warm-up mode. Use the launcher setting or a PowerShell switch to opt out.

Tested

  • Ran both new regression cases against the old implementation with only the tests edited. Windows Play used warm --used, and the fresh desktop profile reported full warm-up off.
  • On the changed branch, a synthetic executable verified shader, warm and title launch order for default, used-only, skip and both legacy switch values. A dry run verified the restart arguments.
  • Ran the launcher test discovery suite (49 tests, 7 skipped), the menu-choice and D3D12 switch suites, the text-writer newline check, and Node checks of web launcher switches and the Windows and Linux summaries.
  • Passed the changed-file clean-room scan and git diff --check.

GPUs tested: n/a. Windows launcher tests used a synthetic executable.

AI-assisted: yes, OpenAI Codex GPT-6.2 Sol. Independently reviewed by separate read-only GPT-6.2 Sol reviewer runs.

Checklist

  • Based on current main.
  • One topic.
  • Clean-room scan passed for all changed files.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5610411403 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3172). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-12-02T16:17:29Z. --- Claimed as [D3D12-FULL-PRECOMPILE-DEFAULT](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7351617067). ### What and why Windows Play translates every shader and warms every recorded pipeline by default. This uses the existing full warm-up and its driver cache. A fresh pipeline book contains no entries. The first substantial full warm-up happens on a later launch, after the game records pipelines. A large book can take an hour or more to warm, and parallel compiler processes can use several GB of system RAM. - `-PrecompileUsed` keeps shader translation and warms only pipelines used to draw in previous runs. `-NoPrecompile` skips both stages. - Keep the legacy `-PrecompileAll` switch and its explicit PowerShell false form. Preserve the used-only choice on in-game restart. - Fresh desktop and web launcher settings enable full warm-up. Saved values still determine the warm-up mode. Use the launcher setting or a PowerShell switch to opt out. ### Tested - Ran both new regression cases against the old implementation with only the tests edited. Windows Play used `warm --used`, and the fresh desktop profile reported full warm-up off. - On the changed branch, a synthetic executable verified shader, warm and title launch order for default, used-only, skip and both legacy switch values. A dry run verified the restart arguments. - Ran the launcher test discovery suite (49 tests, 7 skipped), the menu-choice and D3D12 switch suites, the text-writer newline check, and Node checks of web launcher switches and the Windows and Linux summaries. - Passed the changed-file clean-room scan and `git diff --check`. GPUs tested: n/a. Windows launcher tests used a synthetic executable. AI-assisted: yes, OpenAI Codex GPT-6.2 Sol. Independently reviewed by separate read-only GPT-6.2 Sol reviewer runs. ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] Clean-room scan passed for all changed files.
fiestorra commented 2026-12-02 16:30:34 +00:00 (Migrated from github.com)

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


Verified: it applies on the current main, and its tests pass - 26 in test_leonida_launcher.py (3 new) and 6 in test_win_launchers.py (1 new), all OK.

And one measured concern about the new default, from this machine.

What the change does, in its own words: the default becomes -PrecompileAll - "translate all shaders and warm every pipeline recorded in earlier runs" - and the help text says "an hour or more and use gigabytes of driver cache".

The number it does not have is the memory one, and I measured it yesterday for #3041 on this machine (RTX 4090, 64 GB) with leonida warm on a real book:

pipelines made --jobs peak RSS (parent + compiler children)
140 4 1,514 MB
540 16 4,578 MB

About 8-11 MB for each pipeline at peak, and the peak follows the count, not the concurrency. known.rs and a real book both say the title creates about 84,000 pipelines (I have a warm run that printed 83563 pipelines known). The drawn-with subset is some 2,000 - but "every recorded" is the whole book.

So the default this sets is a warm-up whose memory grows past what an 8 GB card's machine has before it finishes, on exactly the machines that already arrive in this repository with "out of memory" reports (#3041, the 8 GB threads). -PrecompileUsed - the drawn-with subset - is the shape that fits there, and it is this same pull request that gives it a name.

What I would suggest: keep PrecompileAll available but not default for every card, or gate it on free memory (the warm memory figure above is enough to size the gate: free memory minus 2 GB, divided by 10 MB), or at least say the RAM in the help text next to the hour and the gigabytes.

What I did not measure: a full warm-up of the whole book - the peaks above are at 140 and 540 pipelines, and extrapolating to 84,000 is arithmetic, not a measurement. I am not claiming 84,000 was run.

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

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352046511 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3172#issuecomment-7352046511). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T16:30:34Z. --- **Verified: it applies on the current `main`, and its tests pass - 26 in `test_leonida_launcher.py` (3 new) and 6 in `test_win_launchers.py` (1 new), all OK.** **And one measured concern about the new default, from this machine.** **What the change does**, in its own words: the default becomes **`-PrecompileAll`** - *"translate all shaders and warm every pipeline recorded in earlier runs"* - and the help text says *"an hour or more and use gigabytes of driver cache"*. **The number it does not have is the memory one, and I measured it yesterday for #3041** on this machine (RTX 4090, 64 GB) with `leonida warm` on a real book: | pipelines made | `--jobs` | peak RSS (parent + compiler children) | | --- | --- | --- | | 140 | 4 | 1,514 MB | | 540 | 16 | 4,578 MB | **About 8-11 MB for each pipeline at peak, and the peak follows the count, not the concurrency.** **`known.rs` and a real book both say the title creates about 84,000 pipelines** (I have a `warm` run that printed `83563 pipelines known`). **The drawn-with subset is some 2,000** - but "every recorded" is the whole book. **So the default this sets is a warm-up whose memory grows past what an 8 GB card's machine has before it finishes**, on exactly the machines that already arrive in this repository with "out of memory" reports (#3041, the 8 GB threads). **`-PrecompileUsed` - the drawn-with subset - is the shape that fits there**, and it is this same pull request that gives it a name. **What I would suggest**: **keep `PrecompileAll` available but not default for every card**, or **gate it on free memory** (the `warm` memory figure above is enough to size the gate: free memory minus 2 GB, divided by 10 MB), or at least **say the RAM in the help text** next to the hour and the gigabytes. **What I did not measure**: **a full warm-up of the whole book** - the peaks above are at 140 and 540 pipelines, and extrapolating to 84,000 is arithmetic, not a measurement. **I am not claiming 84,000 was run.** **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
ubiquitarianism commented 2026-12-02 16:32:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-12-02T16:32:05Z.


Thanks for testing this and recording the host RAM peaks. I added a system RAM note to the startup output and D3D12 guide in 0413012fa. The startup output points to -PrecompileUsed for warming a smaller set. All 32 Windows and desktop launcher tests passed after the edit.

The two measurements change both the number of pipelines and the number of workers. warm.rs replaces compiler children after batches of at most 40, and known.rs reads the whole book in each child while copying just that batch’s entries. The samples show several GB of RAM use, but they do not establish a per-pipeline memory requirement that we could use to size a gate. The change keeps the requested full default. Worker limits are being handled separately in #3071.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352085292 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3172#issuecomment-7352085292). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-12-02T16:32:05Z. --- Thanks for testing this and recording the host RAM peaks. I added a system RAM note to the startup output and D3D12 guide in `0413012fa`. The startup output points to `-PrecompileUsed` for warming a smaller set. All 32 Windows and desktop launcher tests passed after the edit. The two measurements change both the number of pipelines and the number of workers. `warm.rs` replaces compiler children after batches of at most 40, and `known.rs` reads the whole book in each child while copying just that batch’s entries. The samples show several GB of RAM use, but they do not establish a per-pipeline memory requirement that we could use to size a gate. The change keeps the requested full default. Worker limits are being handled separately in #3071.
KelboLive commented 2026-12-02 16:53:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-02T16:53:50Z.

Review: COMMENTED


Checked out 0413012fa: the launcher (26), Windows launcher (6), switch (20) and menu-choice (16) tests pass; the default is full warm, -PrecompileUsed and -NoPrecompile behave, the legacy -PrecompileAll:$false maps to used-only, and the used-only choice survives an in-game restart. Merge-tree with current main is clean. Both guards are mutation-covered (forcing used-only fails test_d3d12_precompile_modes; flipping the launcher default fails three tests).

The concern is operational, not plumbing: this turns a ~2,000-pipeline warm into ~84,000, and the failure path is unguarded.

  • play-nvidia.ps1:888/933 never checks $LASTEXITCODE, and warm.rs returns Ok(()) even when children die — they go to warm-bad.txt and are never retried, even after memory recovers. On an 8 GB machine that is a realistic OOM, not an edge case.
  • #3071 (worker cap) and #3027 (failure warning) are the mitigations, but #3027 conflicts in this exact warm block; please rebase/land them together, or add a RAM preflight before making this the default.
  • Minor: toggling “Prepare shaders” off and on in either launcher leaves precompile_all=false, silently downgrading the new default to used-only. And the top-level README omits the RAM/time note that d3d12/README.md:71-74 has.

Also worth stating in the body: the expensive full warm is normally the second start (fresh install has an empty book and warms 0), and there is no environment-level opt-out — only the two scripts/settings.

Verified with a synthetic runtime only; the 84k-pipeline timing, peak RAM, 4 GB driver-cache behavior and in-game restart still need a real pipeline book and GPU.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6155296314 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3172#pullrequestreview-6155296314). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-02T16:53:50Z. **Review:** COMMENTED --- Checked out `0413012fa`: the launcher (26), Windows launcher (6), switch (20) and menu-choice (16) tests pass; the default is full warm, `-PrecompileUsed` and `-NoPrecompile` behave, the legacy `-PrecompileAll:$false` maps to used-only, and the used-only choice survives an in-game restart. Merge-tree with current main is clean. Both guards are mutation-covered (forcing used-only fails `test_d3d12_precompile_modes`; flipping the launcher default fails three tests). The concern is operational, not plumbing: this turns a ~2,000-pipeline warm into ~84,000, and the failure path is unguarded. - `play-nvidia.ps1:888/933` never checks `$LASTEXITCODE`, and `warm.rs` returns `Ok(())` even when children die — they go to `warm-bad.txt` and are **never retried**, even after memory recovers. On an 8 GB machine that is a realistic OOM, not an edge case. - **#3071** (worker cap) and **#3027** (failure warning) are the mitigations, but #3027 conflicts in this exact warm block; please rebase/land them together, or add a RAM preflight before making this the default. - Minor: toggling “Prepare shaders” off and on in either launcher leaves `precompile_all=false`, silently downgrading the new default to used-only. And the top-level README omits the RAM/time note that `d3d12/README.md:71-74` has. Also worth stating in the body: the expensive full warm is normally the **second** start (fresh install has an empty book and warms 0), and there is no environment-level opt-out — only the two scripts/settings. Verified with a synthetic runtime only; the 84k-pipeline timing, peak RAM, 4 GB driver-cache behavior and in-game restart still need a real pipeline book and GPU.
ubiquitarianism commented 2026-12-02 16:57:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-12-02T16:57:04Z.


Thanks for verifying the launcher paths and the merge tree. I updated the PR description to say that a fresh pipeline book starts empty, to call out host RAM, and to point to the launcher settings and PowerShell switches.

#3071 and #3027 cover separate mitigations. The worker cap reduces peak concurrency. The exit-code warning can report a failed top-level process, while the supervisor can currently record a failed child and still return success. A fixed free-memory cutoff would need measurements with the same book and worker count on lower-memory hosts.

I reproduced the pause/resume issue, made both launchers retain the selected warm-up mode, and verified it with the launcher tests and a Node smoke test. GitHub rejected the push because #3172 is already in the merge queue. I left it queued so the requested default can land.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352688519 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3172#issuecomment-7352688519). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-12-02T16:57:04Z. --- Thanks for verifying the launcher paths and the merge tree. I updated the PR description to say that a fresh pipeline book starts empty, to call out host RAM, and to point to the launcher settings and PowerShell switches. #3071 and #3027 cover separate mitigations. The worker cap reduces peak concurrency. The exit-code warning can report a failed top-level process, while the supervisor can currently record a failed child and still return success. A fixed free-memory cutoff would need measurements with the same book and worker count on lower-memory hosts. I reproduced the pause/resume issue, made both launchers retain the selected warm-up mode, and verified it with the launcher tests and a Node smoke test. GitHub rejected the push because #3172 is already in the merge queue. I left it queued so the requested default can land.
merzleckeier commented 2026-12-02 17:06:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T17:06:16Z.

Review: COMMENTED


I checked 0413012fa merged with main 5b1fff821. All 44 runnable launcher tests passed on Linux, with 5 platform/tool skips. I also round-tripped fresh settings and existing saved full, used-only, and skip selections through the Python launcher. Windows command construction selected the default, -PrecompileUsed, or -NoPrecompile as expected, and the Linux command omitted all three Windows choices. The web preview produced the same Windows arguments in a Node smoke test. This covers saved settings and command routing. I did not measure a full warm-up, GPU behavior, or native PowerShell execution.

AI-assisted: OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6155512986 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3172#pullrequestreview-6155512986). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T17:06:16Z. **Review:** COMMENTED --- I checked `0413012fa` merged with `main` `5b1fff821`. All 44 runnable launcher tests passed on Linux, with 5 platform/tool skips. I also round-tripped fresh settings and existing saved full, used-only, and skip selections through the Python launcher. Windows command construction selected the default, `-PrecompileUsed`, or `-NoPrecompile` as expected, and the Linux command omitted all three Windows choices. The web preview produced the same Windows arguments in a Node smoke test. This covers saved settings and command routing. I did not measure a full warm-up, GPU behavior, or native PowerShell execution. AI-assisted: OpenAI Codex.
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!3172
No description provided.