Build previously drawn pipelines once during D3D12 warmup (D3D12-WARM-BUILD-ONCE) #3150
Open
github-bot
wants to merge 2 commits from
github-bot/gh-3150 into main
AGit
pull from: github-bot/gh-3150
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!3150
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3150"
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?
@AronnoM on GitHub · 2026-12-02 14:17 UTC · original
AronnoM:codex/d3d12-warm-build-once→main· +214 −45 · 4 files · 2 commits · openClaimed 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 --usedbuilds 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
968b05d40passes the resolved--jobsvalue 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 23reaching the child as20before this change and23afterward 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 reviewTested
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
69cd4106cbase@merzleckeier on GitHub · 2026-12-02 14:24 UTC · original · reviewed
Reviewed
6a5e5bcdonmainat69cd4106. Both Windows-targetleonidawarm integration tests passed under Wine with synthetic pipeline records. They exercise library-first fallback after a refusal and the driver worker continuing whenslow-pipelines.txtcannot 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.rsconflicts 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 status3is treated as a save failure only for the store worker.For the merge, pass the resolved
jobsvalue at bothstore_in_librarycall sites. Keepingjobs.min(cores)there would silently clamp an explicit--jobsvalue for library work, while #3071 preserves explicit overrides and caps the automatic default. The tested combination forwardsjobsat both sites.@lixonik on GitHub · 2026-12-02 14:59 UTC · original
Verified PR #3150 (
6a5e5bcd4) merged cleanly ontomain(acc350745) on native Windows 10 x64 (Rust 1.98.1):python -I scripts/check_no_game_data.pyPASS.cargo test -p leonida --locked:leonidaunit tests (src/main.rs): 43 passed, 0 failedtests/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 failedcargo test -p leonida-gpu --lib --locked pipeline::known::: 3 passed, 0 failed (includingstore_workers_follow_the_request_up_to_the_available_work)cargo test -p leonida-gpu --lib --locked pipeline::library::: 6 passed, 0 failedd3d12/apps/leonida/src/warm.rsalso overlaps with #3071 (RAM-capped worker count); whichever merges second will need a small merge inwarm.rs.Verdict: PASS (native Windows unit + integration tests; no game launch).
AI-assisted: yes (Antigravity).
@Kal0s-design on GitHub · 2026-12-02 15:56 UTC · original
Ran natively on Windows 11, head
968b05d40merged into currentmain(3c106eb2f, clean merge). The earlier reports in this thread were on6a5e5bcd4, so these are the first results on the current head.Suites (measured)
cargo test -p leonida --lockedtests/warm.rs= 50 passed, 0 failedcargo test -p leonida-gpu --lib --lockedcargo test -p leonida-gpu --lib --locked pipeline::cargo clippy -p leonida -p leonida-gpu --all-targets --lockedunused_mutinleonida-gpu/src/host.rs; nothing newSynthetic warm books (measured)
Each scenario ran
leonida warm --usedwith the PR test's isolation:LEONIDA_CACHE_DIRandLEONIDA_DATA_DIRset to a fresh temporary directory,LEONIDA_CONFIGunset,LEONIDA_WARM_LIBRARY=1,LEONIDA_WARM_DONE_ALL=0. Each ran 1 to 3 times in the same directory, onmainand on the merge, with the hardware adapter. All records are hand-made, so none can produce a host pipeline.mainwarm-done,warm-bad,library-donestay empty0xFFFFFFFFwalk_pipelinesbehaviour, not this PR)early-pipelines.txtknown-shaders.binwarm-bad.txt, so it is retried on every launch on both sidesFor the garbage entry I also ran the store step alone (
warm --these 0 --store --jobs 1, same isolation). Both binaries logshader does not translate … not a DXBC containerand printmade 0 <ms> 0: 326 ms on the PR, 347 ms onmain. Onmainthe store then printssavingwith nothing kept; the PR skips the save (any_keptfalse).Cost when nothing can be kept (measured, wall time per launch, debug-profile binaries, hardware adapter)
mainmainN (driver); PR N (library) + N (driver); 0 kept on bothThe PR adds a fixed ~0.5 s per launch when no entry is kept, whatever the count. By reading, that is the extra
--storechild 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, andlibrary-failed.txtis 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
store_in_libraryreturns early. Because ofif library_first { return Ok(()) }, the old library pass is then skipped too, so that fingerprint never gets a library.mainbehaves the same, since its library pass checks the same count.Workerfailure, 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.git merge-treereports 3 hunks inapps/leonida/src/warm.rs(imports,childsignature, 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 on GitHub · 2026-12-02 16:00 UTC · original
Checked here: the pull request's tests pass, and a real
warmrun with its build works end to end. The checker'sgreen failsis this machine, not your change.Both lines are true and neither is about this branch being broken:
red does not build- the new tests callstore_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-gpuhalf runs on this machine's integrated Radeon, anddescriptor::host::tests::views_are_made_beside_the_heap_and_copied_infails there because the device tests still make their device withD3D12CreateDevice(None, ..)(#2995 fixes that).cargo test -p leonida-gpu --libonmainhere is 695 passed, 1 failed, and that is the one.Isolated, the green side is green (
cargo test -p leonida --tests warm, head968b05d40):And a real run,
leonida warmwith this build on this machine's own book (83,563 pipelines known, a copy of a real cache):0 ended their processin 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 on GitHub · 2026-12-02 18:11 UTC · original
Reviewed #3150 (code review only, not built here:
leonida warmis 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.968b05d40cmain45dc41f95cgit merge-tree); merge base69cd4106ce, 38 commits behindpython -I tools/d3d12_switches.py --check d3d12/docs/switches.md: exit 03c106eb2f), fiestorra (this head: tests plus a realwarmof 40 and 200 pipelines,0 ended their process), lixonik (6a5e5bcd4, the parent)Review
run(d3d12/apps/leonida/src/warm.rs:83-111on 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_thesesaves only when something was kept and exits withSAVE_FAILED(3) whenknown::save_library()fails.store_in_librarytreats that asChildFailure::Saveand does not write it to the "failed twice" file, so an I/O failure does not disable the library for that translation. Good distinction.runresolvesjobs.unwrap_or(cores * 2 / 3).max(1)(:75) and passes it to the child as--jobs, andstore_thesefalls back to the same* 2 / 3.store_thesedoes not clampjobs(:367), so a manualleonida warm --these ... --store --jobs 0would askknown::storefor 0 threads. The launcher path always passes at least 1..max(1)there would matchrun.scripts/red_green.pyreports "red does not build" because the new tests call the newstore_workers. That is expected for this kind of change; the realwarmruns 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 ofcargo 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
@fiestorra on GitHub · 2026-12-03 00:16 UTC · original
VERIFY-3150 — Windows nativo:
red then greenen el número de workers del store968b05d40—warm.rs(4 lines),pipeline/known.rs(+14)Ran at the head
Negative control (synthetic): I dropped the upper bound (
requested.max(1).min(entries)→requested.max(1)), rebuilt and ran: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 32on 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 0or an empty work list must not spawn nothing and hang.What I could not test
-jabove the core count: it needs the title's toolchain; the tests drive the function.Written with an AI assistant.
@merzleckeier on GitHub · 2026-12-03 00:21 UTC · original · reviewed
Tested the merge-order overlap with #3143 on current
main(d5b30be1), using #3150 at968b05d4and #3143 atb6023d1d. The conflict is confined toapps/leonida/src/warm.rs. In a scratch merge I kept #3150’s library-first ordering and typedChildFailure::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
Savefor 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 on GitHub · 2026-12-03 13:43 UTC · original
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.txtandwarm-done.txthave 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 ranleonida warm --usedwith 13 workers and the play script's environment.b053a1813, the two passes as today968b05d40With 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:
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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.