mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2260] runtime: prewarm graphics pipelines in recorded order on the compile pool (RT-PIPELINE-PREWARM-ORDER phase 2) #2265
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2265
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2260
Author: @Tyrannys
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:claude/pipeline-prewarm-order📝 Commits (10+)
40e94ebruntime: pipeline order recorder and replay request hook (RT-PIPELINE-PREWARM-ORDER, phase 1)7a4d1f7runtime: record the order of first pipeline requests behind LEONIDA_PIPELINE_ORDER_LOG=1cdbbb39Merge remote-tracking branch 'origin/main' into feat/pipeline-order-recorderdcdcaderuntime: address review of the pipeline order recorder0babd17Merge remote-tracking branch 'origin/main' into feat/pipeline-order-recordera83f385d3d12: a pool of compile workers for the pipeline compiler (RT-ASYNC-COMPILE-POOL)2d56b68d3d12: the checkpoint's second look also sees a running demanded build6e9c33eMerge remote-tracking branch 'upstream/pr2220' into claude/pipeline-prewarm-orderd864cabruntime: prewarm graphics pipelines in the order an earlier run asked for them (RT-PIPELINE-PREWARM-ORDER phase 2)6f2b52ed3d12: prewarm console streams kept for their first bind (on-demand)📊 Changes
14 files changed (+3005 additions, -50 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+54 -0)📝
runtime/CMakeLists.txt(+33 -0)📝
runtime/README.md(+7 -1)📝
runtime/shims/d3d12_pipeline_compile.h(+174 -40)📝
runtime/shims/d3d12_vulkan_device.cpp(+203 -5)➕
runtime/src/pipeline_order.h(+595 -0)➕
runtime/src/pipeline_prewarm.h(+171 -0)📝
runtime/src/vulkan_replay.h(+9 -0)➕
runtime/test/d3d12_compile_pool_test.cpp(+499 -0)📝
runtime/test/d3d12_pipeline_workers_test.cpp(+127 -4)➕
runtime/test/pipeline_order_test.cpp(+606 -0)➕
runtime/test/pipeline_prewarm_test.cpp(+305 -0)➕
runtime/test/replay_pipeline_order_hook_test.cpp(+213 -0)📝
tests/test_docs_env_vars.py(+9 -0)📄 Description
Claimed 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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.