d3d12: opt-in precompile of every known pipeline (-PrecompileAll); never-drawn pipelines stay out of the library #2986
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2986"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by TheStonedGamer on 2026-12-01T22:31:23Z.
Claimed in the coordination issue as: D3D12-PRECOMPILE-ALL-PIPELINES (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7327963652)
What and why
The precompile before a start (
leonida warm --used) makes only the pipelines earlier runs drew with. A place or effect not drawn in before then compiles its pipelines while the game waits.-PrecompileAll(Launcher.bat: "Precompile every pipeline", off by default) runsleonida warmwithout--used: every pipeline the title has created in any run (known-pipelines.bin, 88,586 here against about 4,000 drawn with) is compiled into the driver's cache. Plumbed throughtools/leonida_launcher.py,scripts/play-d3d12.ps1andd3d12/scripts/play-nvidia.ps1(kept across the F1 menu's restart). It prints that the first run takes an hour or more and that NVIDIA's Shader Cache Size should be Unlimited. Documented inREADME.md,docs/launcher.mdandd3d12/README.md.warm.rs: only pipelines earlier runs drew with go into the pipeline library (into_library()); the rest stay in the driver's cache alone. The driver checks an entry of its own cache against the pipeline asked for and compiles again where they differ, while a library entry is taken as stored. With every known pipeline in the library (1.5 GB, 91,525 entries), the device was removed twice during a burst of first loads in a new place: no hang (no TDR in the event log), no page fault in DRED, the library file whole (0 of 366,955 pages read as zeros). With them kept out, the same settings stayed up. The cause inside the driver is not known. With--used(the default) nothing changes: those keys are already only ones drawn with.Tested
cargo test --locked -p leonida --bin leonida warm::— the newonly_pipelines_drawn_with_go_into_the_libraryfails with theearlycondition removed (the old rule without--used) and passes with it (reverted by hand; MEASURED).python -m unittest tests.test_leonida_launcher tests.test_win_launchers: OK, including the newtest_precompile_all_only_with_the_precompileand-PrecompileAllin the switch check againstplay-d3d12.ps1.python -m unittest discover -s tests -p "test_docs_*.py": OK.python -I scripts/check_no_game_data.pyon the changed files: clean.warm.rschange, two device removals as above.GPUs tested: NVIDIA GeForce RTX 3060 12 GB, driver 621.40, Windows 11 Pro (26300)
AI-assisted: yes (implementation: Claude Opus 5.5 via Claude Code; separate read-only reviewer agents: Claude Opus)
Checklist
mainand merges cleanly.docs/design.md(n/a: no translator change).🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T22:33:19Z.
Integration check with #2956. Both public Windows launchers default to the same sequence but implement the opt-in full precompile differently. I ran the unchanged scripts on each head with a synthetic recording executable.
git merge-tree on
afe0b798fand558b7980ereports content conflicts in README.md and both scripts (scripts/play-d3d12.ps1 and d3d12/scripts/play-nvidia.ps1). The functional distinction matters when resolving those conflicts: this PR chooses library eligibility inside warm, while #2956 enforces it by splitting the passes. Combining both launcher implementations literally risks repeating a full warm. This check measured routing only, with no title, shader data or driver-cache workload. Codex-assisted for #2570.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T22:41:15Z.
The full-precompile choice survives the actual saved F1 arguments.
I tested
afe0b798f453e7c707f5177275be1b72f862a3a5on main1abef08dusing the unmodified PowerShell wrapper and inner launcher, a synthetic recording executable, and Linux PowerShell 7.4.21. Each successful cell replayed the actualLEONIDA_MENU_ARGScaptured at process start.-PrecompileAll:$falsewarm --usedwarm --used-PrecompileAllwarmwarm-PrecompileAll -NoPrecompile-PrecompileAllwith a missing noted cache filewarm --againwarmafter the stub recreated the fileThe combination with #2761 also launched the dynamic preset with
-MotionBlur:$false -PrecompileAll. Both starts kept 2560×1440, minimum scale 0.75, and four MotionBlur skip entries, and both issued barewarm. Stock Python launcher tests passed 15/15 on main and 16/16 in each PR tree. These runs cover command selection and replay with synthetic inputs. AI-assisted, independently verified against the raw results.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T04:57:16Z.
Smoke test of
-PrecompileAll(oreofr-agent, AI-assisted): head merged into current main8422def759cda12c89f918438eeb8d53dd5972a6, RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H. Short run only: I stopped it after 90 s, so this does not measure in-game stutter.known-pipelines.binandknown-shaders.bin; the exe in a new folder, so the driver cache started cold.88568 pipelines known, 0 made before, 0 bad; 88568 to make, 14 processes. That is the whole list, without--used.-PrecompileAllis set.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T05:13:12Z.
Merging (oreofr-agent, with OreoFR's written OK as maintainer): head
afe0b798f453e7c707f5177275be1b72f862a3a5merged into current main8422def759cda12c89f918438eeb8d53dd5972a6with no conflicts. CI green on the head.Safe to merge into main?
-PrecompileAllis off unless asked for. With the default precompile (--used), the library filter inwarm.rskeeps the same set as before:!used || earlyreduces toearly. The new unit test covers this.tests/test_leonida_launcher.pypasses 16/16 locally. The smoke test above shows the switch reacheswarmwith the whole list.warm.rsand docs.Not done: no full 300 s game run. The default path's library set is unchanged, and timing the full precompile (about 40 min here) was skipped at the maintainer's request.
Going into the merge queue with #2756.