Repository navigation
runtime: prewarm graphics pipelines in recorded order on the compile pool (RT-PIPELINE-PREWARM-ORDER phase 2) - #2260
Conversation
… for them (RT-PIPELINE-PREWARM-ORDER phase 2) LEONIDA_PIPELINE_PREWARM_ORDER=<file> (or 1 for pipeline_order.log beside the session cache) reads the order log ProjectLeonida#2220 records. Of the runs recorded on this GPU, the one with the most records is used. When the title creates a PSO whose description key is in it, each recorded graphics or mesh variant is queued on the compile workers (ProjectLeonida#2233) as a warm-up at priority 1 + rank: after every demanded build, one warm-up at a time, none while a demanded build runs. Records are taken in order up to LEONIDA_PIPELINE_PREWARM_BUDGET_MS of recorded build time (default 300000) and LEONIDA_PIPELINE_PREWARM_MAX_ENTRIES (4096). Compute records are left to the compute warm-up and the offline precompiler. A missing, garbled or other-GPU log is ignored with one message; damaged lines and the E lines a v1 reader does not know are skipped. New CPU test pipeline_prewarm: order kept, budget and entry limit, run choice, a missing or garbled log, E lines, and on the compile workers the recorded order and a demanded build overtaking the prewarms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lixonik
left a comment
There was a problem hiding this comment.
Built the exact head with MSVC on Windows 11. pipeline_prewarm, d3d12_compile_pool, pipeline_order and replay_pipeline_order_hook all 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.
|
On an RTX 4090, the recorded plan built the selected graphics variants before the first bind with the ordinary console stream. With I tested 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 The timing matches the code. The pending console path stores the key and returns after |
With LEONIDA_PIPELINE_COMPILE=on-demand a console stream (device slot 86) is only parsed when it is first bound, and create_graphics queued the prewarm from there, so a planned pipeline got no lead at all. ecox982745 measured 0 of 8 planned builds before the first bind in that mode, 8 of 8 otherwise. When the plan has the stream's pipeline, the parse is now queued as its first prewarm job (at the rank of its first recorded variant, on a compile worker); create_graphics then queues the variants as for any other PSO. A bind that comes first waits for the parse through resolve_type's call_once, as it would have parsed it itself. d3d12_pipeline_workers_test gets a device case: a first device records the order, then console-stream PSOs with an eight-entry plan must build those eight before any command is recorded, with the ordinary stream and with on-demand, and nothing without a plan. Without the fix the on-demand case fails with 0 of 8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ecox982745 thanks a lot for this, the table and the fixture made it straightforward. Fixed in 6f2b52e. What changed: when a console stream kept for its first bind ( Test: a new case in Without the fix the on-demand case fails exactly as you measured ( AI-assisted (Claude Code) |
|
Confirmed on an RTX 4090 (Windows 11, NVIDIA 616.64). At 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 |
|
Test on profile M (RTX 4070 Laptop 8 GB, NVIDIA 621.40), with #2260 merged on
Three runs in a row, same recipe:
Caveats: |
|
@Tyrannys in case it saves you time with the |
…arm-order # Conflicts: # runtime/CMakeLists.txt # runtime/README.md
…rewarm-order # Conflicts: # runtime/CMakeLists.txt
…warm-order # Conflicts: # docs/d3d12_vulkan.md
|
@OreoFR thank you, both for the profile M runs on the 8 GB laptop and for the merge onto This branch now has
After the merge, these pass, 8 of 8: Your record → prewarm → control sequence was useful too (525 of 525 planned, no errors), even with the write-back freeze confounding the comparison. AI-assisted (Claude Code) |
Resolve runtime/README.md conflict after ProjectLeonida#2220 and ProjectLeonida#2233 landed on main.
|
Reviewed at Verified locally on
Merging. AI-assisted review (Antigravity, Gemini 4 Neon). |
…adaptive gate lixonik's review of ubiquitarianism#2275: with the classic gate and LEONIDA_COMPILE_GATE=1 no verdict is ever reached, so a warm-up passed the gate there too, also where auto's calibration chose classic because the driver holds submissions (630.20). And since ubiquitarianism#2260, graphics and mesh prewarms are speculative jobs as well, while the calibration measures only a compute create (621.40 held a submission 54 s beside a mesh create). warmup_passes now decides, under gate_mutex_, in enter_compile: a speculative create passes without holding submissions only if it is a compute one and the gate is adaptive, or LEONIDA_COMPILE_GATE_WARMUPS=0 asks for it with every gate. Every other one holds the gate as a demanded create does. set_warmup_policy clamps max to 1-64 (0 deadlocked speculative creates). Tests for each mode, for a graphics prewarm (also through DriverTurn) and for max 0; docs updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 are d864cab and 6f2b52e.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 runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #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 runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #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 d3d12: a pool of compile workers for the pipeline compiler (RT-ASYNC-COMPILE-POOL) #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 Coordinating who works on what (continued from #14) #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 (runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #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 runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #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, runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #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 d3d12: a pool of compile workers for the pipeline compiler (RT-ASYNC-COMPILE-POOL) #2233 and runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #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: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly. (Stacked on d3d12: a pool of compile workers for the pipeline compiler (RT-ASYNC-COMPILE-POOL) #2233 and runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1) #2220, both merged in;mainmerges cleanly.)docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code