runtime: prewarm graphics pipelines in recorded order on the compile pool (RT-PIPELINE-PREWARM-ORDER phase 2) #2260
Open
github-bot
wants to merge 10 commits from
github-bot/gh-2260 into main
AGit
pull from: github-bot/gh-2260
merge into: github:main
github:main
github:docs/animation-merge-remnants
github:docs/story-dedup-and-cli
github:docs/restofworld-merge-remnants
github:docs/gamedata-dedup-tables
github:docs/textures-bcpack-tables-and-cli
github:docs/exe-fail-fast-shims-sync
github:fix/address-guard-wraparound-parity
github:fix/cvt-f16-denorm-and-clamp
github:docs/pso-cache-scope-note
github:docs/viewer-readme
github:docs/textures-arrays-dds-preview
github:docs/conformance-readme-status
github:fix/docs-validators-fences-urls
github:claude/loop-total
github:claude/pops-collision-seed
github:claude/dstorage-hold-page-reads
github:claude/host-image-copy-switch
github:feat/gdk-lifecycle-window-hook
github:claude/d16s8-uav-nvidia-fallback
github:feat/mfplat-offline-shim
github:claude/gameinput-slow-reader
github:fix/rt-null-barrier-clear
github:claude/depth-resolve-sample-positions
github:integration/palmetto-parity
github:claude/valu-literal-sext
github:claude/slot74-pool-handle
github:claude/rgb9e5-uint-alias-view
github:claude/fssm-root-layout-tables
github:feat/gdk-speech-display-lifecycle
github:asset-audio-skip-current
github:qemmhd/old-9940-rectangle-quad-lists
github:feat/ws2-offline-shim
github:qemmhd/rt-d16-unorm-uav
github:feat/xs-device-stops-7-9
github:qemmhd/rt-depth-same-base-shapes
github:qemmhd/rt-lazy-attachment-variant
github:feat/acphal-xma2-decoder
github:asset-audio-skip
github:codex/coord-claim-check-20261124-7e48
github:feat/xs-frame-pacing-presentx
github:feat/xs-device-vm-options
github:old-pr/9844
github:old-pr/9978
github:old-pr/9815
github:old-pr/10057
github:old-pr/9874
github:old-pr/9965
github:old-pr/9863
github:old-pr/10068
github:old-pr/10066
github:old-pr/10067
github:old-pr/10007
github:old-pr/10061
github:old-pr/10065
github:old-pr/10059
github:old-pr/10063
github:old-pr/10055
github:old-pr/10062
github:old-pr/10042
github:old-pr/10041
github:old-pr/10049
github:old-pr/10047
github:old-pr/10046
github:old-pr/10045
github:old-pr/10056
github:old-pr/10043
github:old-pr/10036
github:old-pr/10034
github:old-pr/9984
github:old-pr/10052
github:old-pr/10038
github:old-pr/10033
github:old-pr/10028
github:old-pr/10050
github:old-pr/9891
github:old-pr/9889
github:old-pr/10051
github:old-pr/10019
github:old-pr/10027
github:old-pr/10029
github:old-pr/10031
github:old-pr/10026
github:old-pr/9941
github:old-pr/10030
github:old-pr/10040
github:old-pr/9990
github:old-pr/10021
github:old-pr/9962
github:old-pr/10022
github:old-pr/10020
github:old-pr/10015
github:old-pr/10025
github:old-pr/9886
github:old-pr/10048
github:old-pr/10014
github:old-pr/10011
github:old-pr/9861
github:old-pr/10010
github:old-pr/10008
github:old-pr/9860
github:old-pr/10006
github:old-pr/9920
github:old-pr/9995
github:old-pr/10000
github:old-pr/10016
github:old-pr/10004
github:old-pr/10023
github:old-pr/9982
github:old-pr/9981
github:old-pr/9983
github:old-pr/9970
github:old-pr/9969
github:old-pr/9968
github:old-pr/9971
github:old-pr/9972
github:old-pr/9942
github:old-pr/9963
github:old-pr/9960
github:old-pr/9964
github:old-pr/9985
github:old-pr/9973
github:old-pr/9862
github:old-pr/9953
github:old-pr/10017
github:old-pr/9952
github:old-pr/9955
github:old-pr/9946
github:old-pr/9954
github:old-pr/9938
github:old-pr/9956
github:old-pr/9856
github:old-pr/9947
github:old-pr/9924
github:old-pr/9961
github:old-pr/9927
github:old-pr/9979
github:old-pr/10032
github:old-pr/9926
github:old-pr/5237
github:old-pr/9951
github:old-pr/9931
github:old-pr/9902
github:old-pr/9921
github:old-pr/9994
github:old-pr/9775
github:old-pr/9768
github:old-pr/9905
github:old-pr/9936
github:old-pr/9901
github:old-pr/9904
github:old-pr/9906
github:old-pr/9988
github:old-pr/9908
github:old-pr/9909
github:old-pr/9911
github:old-pr/9912
github:old-pr/9913
github:old-pr/9887
github:old-pr/9916
github:old-pr/9919
github:old-pr/9925
github:old-pr/9933
github:old-pr/9935
github:old-pr/9918
github:old-pr/9879
github:old-pr/9880
github:old-pr/9881
github:old-pr/9996
github:old-pr/9876
github:old-pr/9892
github:old-pr/9899
github:old-pr/9915
github:old-pr/9914
github:old-pr/9872
github:old-pr/9869
github:old-pr/9866
github:old-pr/9819
github:old-pr/10012
github:old-pr/9857
github:old-pr/9893
github:old-pr/9897
github:old-pr/9928
github:old-pr/9868
github:old-pr/9917
github:old-pr/9940
github:old-pr/9873
github:old-pr/9816
github:old-pr/10009
github:old-pr/9900
github:old-pr/9966
github:old-pr/9859
github:old-pr/9843
github:old-pr/9991
github:old-pr/10058
github:old-pr/9883
github:old-pr/9838
github:old-pr/9835
github:old-pr/9959
github:old-pr/9895
github:old-pr/9837
github:old-pr/9858
github:old-pr/9865
github:old-pr/9864
github:old-pr/9840
github:old-pr/9820
github:old-pr/4669
github:old-pr/9848
github:old-pr/9850
github:old-pr/9810
github:old-pr/9799
github:old-pr/9853
github:old-pr/9875
github:old-pr/9831
github:old-pr/9796
github:old-pr/9801
github:old-pr/9813
github:old-pr/9794
github:old-pr/7417
github:old-pr/9781
github:old-pr/9806
github:old-pr/9958
github:old-pr/9809
github:old-pr/9791
github:old-pr/9792
github:old-pr/10053
github:old-pr/9784
github:old-pr/9789
github:old-pr/9849
github:old-pr/9846
github:old-pr/9773
github:old-pr/9785
github:old-pr/9803
github:old-pr/9826
github:old-pr/9839
github:old-pr/9922
github:old-pr/9948
github:old-pr/7189
github:old-pr/9957
github:old-pr/9823
github:old-pr/9807
github:old-pr/9851
github:old-pr/9774
github:old-pr/9830
github:old-pr/9836
github:old-pr/9822
github:old-pr/9783
github:old-pr/9833
github:old-pr/9890
github:old-pr/9770
github:old-pr/9769
github:old-pr/9772
github:old-pr/9787
github:old-pr/9852
github:old-pr/9834
github:old-pr/9845
github:old-pr/9871
github:old-pr/9771
github:old-pr/9776
github:old-pr/10005
github:old-pr/9949
github:old-pr/9923
github:old-pr/9805
github:old-pr/9829
github:old-pr/9790
github:old-pr/9827
github:old-pr/9929
github:old-pr/9855
github:old-pr/9934
github:old-pr/9907
github:old-pr/9910
github:old-pr/9779
github:old-pr/9780
github:old-pr/9885
github:old-pr/9882
github:old-pr/9877
github:old-pr/9998
github:old-pr/4251
github:old-pr/9987
github:old-pr/9989
github:old-pr/9950
github:old-pr/9777
github:old-pr/10044
github:old-pr/9884
github:old-pr/2906
github:old-pr/5076
github:old-pr/9937
github:old-pr/9986
github:old-pr/3014
github:old-pr/9943
github:old-pr/9939
github:old-pr/4682
github:old-pr/4765
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
bug
Something isn't working
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 rebase
Conflicts with the base branch: rebase it on main
question
Further information is requested
wontfix
This will not be worked on
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
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!2260
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2260"
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?
@Tyrannys on GitHub · 2026-11-26 11:00 UTC · original
Tyrannys:claude/pipeline-prewarm-order→main· +3005 −50 · 14 files · 10 commits · openClaimed in the coordination issue as: RT-PIPELINE-PREWARM-ORDER phase 2 (in-game) (claim); split agreed with MoonEyes on #2220
Depends on: #2233, #2220
This branch has both merged in. Until they land, the diff against
mainshows their changes too; this pull request's own changes ared864cab47and6f2b52e56.What and why
Our boots reach the first world frame, but the world then draws a frame or so a minute while graphics pipelines build at their first draw. #2220 records which pipelines the title asks for first (
LEONIDA_PIPELINE_ORDER_LOG=1). This reads that record at the next boot and builds those pipelines, mostly graphics, ahead of their first draw, in the order the earlier run asked for them, on #2233's compile workers.runtime/src/pipeline_prewarm.h(new, no device): the plan. It reads an order log with #2220's reader (pipeline_order::parse) and takes, from the runs recorded on this GPU (vendor and device id), the one with the most records (the newest on a tie). Graphics and mesh records are kept in recorded order, each (key, variant) once. Compute records are left to the compute warm-up and to MoonEyes'--order-fileforgta6rt --precompile-pipelines(the split on #2220).LEONIDA_PIPELINE_PREWARM_BUDGET_MS(default 300000; a record with no build time counts 1000 ms), and at mostLEONIDA_PIPELINE_PREWARM_MAX_ENTRIES(default 4096).queue_buildas a warm-up at priority1 + rank. With #2233's rules that is after every demanded build, one warm-up at a time, and none while a demanded build runs. That is MoonEyes' compile-gate finding in #1608 (07:32): a create in flight holds every submission at the gate, so a warm-up must not start while the title waits for a build. Prewarms go ahead of the compute warm-up's size order and before the cache checkpoint. A variant 0 already built at create is skipped.[rt] pipeline-prewarm:line. A damaged line is skipped (#2220's checksums), and so are line types a v1 reader does not know: theElines MoonEyes is adding for the precompiler are dropped before parsing, so they are not counted as damage. On success the line gives the counts (variants, pipelines, recorded build time, how many were over the budget, compute records left out).LEONIDA_PIPELINE_PREWARM_ORDER=<file>, or1forpipeline_order.logbeside the session cache. The plan is read when the device starts, before #2220's recorder opens the same file, so both variables can be on in the same run (it then records the prewarmed run as a new session).order_key, #2220) is now also computed when only the prewarm is on.LEONIDA_PIPELINE_COMPILE=on-demand) whose pipeline is in the plan has its parse queued as its first prewarm job, so it gets the same lead as other PSOs (ecox982745's review: 0 of 8 before the first bind otherwise). A bind that comes first waits for that parse, which it would have done itself.last_release), and the device's cancel waits for a running one.Limits:
LEONIDA_COMPILE_GATE=0removes the wait.Tested
New CPU test
pipeline_prewarm(no device). The plan cases are:Elines skipped without counting as damage.On the compile workers, with jobs that wait at gates:
It passed 9 runs of 9. Each plan rule was broken by hand in turn (8 mutants: prewarms at priority 0, no budget, no entry limit,
Elines kept, the first run instead of the largest, any GPU's run, compute records kept, repeats kept), and the test failed for every one.With #2233 and #2220 merged, these pass:
pipeline_prewarm,pipeline_order,replay_pipeline_order_hook,d3d12_compile_pool,d3d12_compile_teardown(pool and one worker),d3d12_big_compute(all 7 settings),d3d12_m4_compute,d3d12_pipeline_workersandd3d12_pipeline_workers_eager: 16 of 16. A boot was running on this machine, so the full suite was not run.Device test
prewarm_from_recorded_orderind3d12_pipeline_workers_test(RTX 4070 SUPER): a first device records the order, then console-stream PSOs (slot 86) with an eight-entry plan build those eight before any command is recorded, with the ordinary stream and with on-demand, and nothing without a plan; the image matches and each pipeline is built once. The on-demand case fails without the on-demand fix (0 of 8).python -I tests/test_docs_env_vars.py,tests/test_ctest_registration.py,scripts/check_no_game_data.pyon the changed files: pass.Not tested here: a real boot. Our boot session will measure it on the game (time to the first world frame and frames per minute after it, with and without the prewarm) and post the numbers.
GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly. (Stacked on #2233 and #2220, both merged in;mainmerges cleanly.)docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
@lixonik on GitHub · 2026-11-26 11:06 UTC · original · reviewed
Built the exact head with MSVC on Windows 11.
pipeline_prewarm,d3d12_compile_pool,pipeline_orderandreplay_pipeline_order_hookall passed, including recorded-rank ordering and a priority-0 build overtaking queued prewarms. Reviewed the new phase-2 commit separately from its dependencies. These are CPU checks. The first-frame effect in a title boot was outside this run.AI-assisted.
@ecox982745 on GitHub · 2026-11-26 11:20 UTC · original
On an RTX 4090, the recorded plan built the selected graphics variants before the first bind with the ordinary console stream. With
LEONIDA_PIPELINE_COMPILE=on-demand, the same plan loaded, but zero of eight built between PSO creation and the first bind. All eight built during command-list recording. This limits how much lead time the prewarm can gain when a title creates PSOs well before it uses them.I tested
d864cab47e3don Windows 11, NVIDIA 616.64, with Khronos validation. I adapted onlyd3d12_pipeline_workers_test, using its authored shaders and its counters around the real Vulkan driver. The fixture created the 48 graphics PSOs through console device slot 86 (16 have an unbound render target) and 16 compute PSOs through the regular device API. A recording run produced 64 entries. Both console modes recorded the same keys and variants in the same order.These two fresh processes used the same recorded file, an eight-entry cap, lazy graphics compilation, and synchronous demand. After creating the PSOs, the fixture waited up to eight seconds for the selected builds before recording any commands.
Both paths passed the pixel and compute-buffer readback checks. Neither prewarmed a compute pipeline. Without a plan, both had zero graphics builds through recording. In a separate control through
CreateGraphicsPipelineState, a 48-entry plan built all 48 before submission with no additional graphics builds needed by the draw.The timing matches the code. The pending console path stores the key and returns after
set_pending_stream. Its call toprewarm_queuecomes viacreate_graphicswhen the stream is first resolved. If prewarming at PSO creation is intended in this mode too, the pending-stream path needs explicit handling. Otherwise it would help to document that prewarming starts at first bind in this mode. This was a synthetic device test. In-game frame times remain open. Pending-stream creation · Graphics prewarm call@Tyrannys on GitHub · 2026-11-26 12:00 UTC · original
@ecox982745 thanks a lot for this, the table and the fixture made it straightforward. Fixed in
6f2b52e56.What changed: when a console stream kept for its first bind (
LEONIDA_PIPELINE_COMPILE=on-demand) has its pipeline in the plan,prepare_console_streamnow queues the stream's parse as its first prewarm job: on a compile worker, at the rank of its first recorded variant, below every demanded build like the other prewarms.create_graphicsthen queues the recorded variants with their ranks, as for any other PSO. A stream that is not in the plan stays pending until its first bind, as before. A bind that comes before the parse waits for it throughresolve_type'scall_once, which is the parse it would have done itself. Like any queued build it holds no reference, so a PSO released first drops it. Documented indocs/d3d12_vulkan.mdand the README row.Test: a new case in
d3d12_pipeline_workers_test,prewarm_from_recorded_order, built on your setup. The 48 graphics PSOs go through console device slot 86 (on a device proxy), the 16 compute ones through the regular API. A first device records the order withLEONIDA_PIPELINE_ORDER_LOG=1. Then three fresh devices run: the plan with an eight-entry cap and the ordinary stream, the plan with on-demand, and on-demand without a plan. Each creates the PSOs, waits up to 8 s, then checks the number of graphics creates before any command is recorded: 8, 8 and 0. Each then submits, checks the readback against the reference image, and checks that all 48 graphics pipelines were built once.Without the fix the on-demand case fails exactly as you measured (
prewarm (on-demand): 0 graphics builds before the first bind, 8 expected), while the ordinary stream gets 8. With it,d3d12_pipeline_workerspasses (3 of 3 repeats), as dod3d12_pipeline_workers_eager,pipeline_prewarm,d3d12_compile_pool,d3d12_compile_teardown*andd3d12_big_compute*(13 of 13). RTX 4070 SUPER, NVIDIA 621.01, Windows 11. As before, in-game frame times are still open.AI-assisted (Claude Code)
@ecox982745 on GitHub · 2026-11-26 12:17 UTC · original
Confirmed on an RTX 4090 (Windows 11, NVIDIA 616.64). At
6f2b52e56the on-demand console stream built all eight selected graphics variants before the first bind. Its parentd864cab47built zero before the first bind and all eight during command recording. Both used the same synthetic plan, probe and three compile workers.I replayed the order file recorded on the parent in six fresh processes on the new head. The counts below are completed Vulkan graphics pipeline creates before recording any commands.
Every run finished with exactly 48 graphics and 16 compute creates, correct pixel and buffer readbacks, and no Vulkan validation errors. The 48-entry case also covers all 16 variants with an unbound render target. The committed
pipeline_prewarm,d3d12_pipeline_workersandd3d12_pipeline_workers_eagertests passed separately on the unmodified head. This closes the timing gap from my earlier review for this fixture. In-game frame times still need a separate measurement.@OreoFR on GitHub · 2026-11-27 03:05 UTC · original
Test on profile M (RTX 4070 Laptop 8 GB, NVIDIA 621.40), with #2260 merged on
maind1dff7949, together with #2220 and #2233 through this branch, plus #2412. The merge needed two trivial resolutions:runtime/src/vulkan_replay.h: keep both the localtimedfield and therequestedcallback;runtime/CMakeLists.txt: keep both test targets.Three runs in a row, same recipe:
LEONIDA_PIPELINE_ORDER_LOG=1: 1,340 lines, 525 graphics pipelines, 237 s of recorded build time.LEONIDA_PIPELINE_PREWARM_ORDER=1:525 graphics variant(s) of 525 pipeline(s) to prewarm. The run got furthest of the three: the loading screen faded out at 363 s, it was still submitting at 586 s, and there was no device loss.Caveats:
MEASURED (n=1 each). The record and control runs also hit the write-back freeze that #2418 fixes, so the comparison is confounded. That said, nothing went wrong with the prewarm itself: no errors, the plan was read, and it ran on the compile workers. A later run with prewarm and #2418 reached the world phase (more than 63k indirect draws). AI-assisted (Claude Code, Claude Opus 5.5).@OreoFR on GitHub · 2026-11-27 03:59 UTC · original
@Tyrannys in case it saves you time with the
needs rebaselabel: #2260 merged onto currentmain(d1dff7949) is at OreoFR/leonida branchpr2260-on-main(176ec068f). The only conflict wasruntime/CMakeLists.txt, and the fix keeps both test targets (heavy_pipeline_cache_testfrom main,pipeline_order_testfrom #2220). The same tree, plus other open PRs, built and ran in my retail tests above. Feel free to take it or redo it your way. AI-assisted (Claude Code, Claude Opus 5.5).View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.