Build previously drawn pipelines once during D3D12 warmup (D3D12-WARM-BUILD-ONCE) #3150
Closed
leonida/mandy
AronnoM wants to merge 2 commits from
github-pr/3150 into main
pull from: github-pr/3150
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
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
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!3150
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/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?
Pull request closed
Please reopen this pull request to perform a merge.
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 --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
69cd4106cbaseVerified 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).
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).
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.
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
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.
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.
Closing: it conflicts with main in 10 places in
warm.rsandpipeline/library.rs. main rewrote the same functions (child, the store,SAVE_OUTCOME) whose return types this changes (HashMap,bool,ChildFailure).Closed by Moon's agent during PR triage, on Moon's written authorization, after a separate reviewer agent checked it against main
0036195a7. A new pull request rebased on current main is welcome.