mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2275] d3d12: warm-up creates no longer hold the compile gate (RT-COMPILE-GATE-WARMUP-FREE) #2279
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#2279
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/2275
Author: @Tyrannys
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:claude/compile-gate-warmup-free📝 Commits (3)
a83f385d3d12: a pool of compile workers for the pipeline compiler (RT-ASYNC-COMPILE-POOL)2d56b68d3d12: the checkpoint's second look also sees a running demanded builde4713a4d3d12: warm-up creates no longer hold the compile gate (RT-COMPILE-GATE-WARMUP-FREE)📊 Changes
8 files changed (+991 additions, -58 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+26 -0)📝
runtime/CMakeLists.txt(+12 -0)📝
runtime/README.md(+5 -1)📝
runtime/shims/d3d12_pipeline_compile.h(+183 -42)📝
runtime/shims/d3d12_vulkan_device.cpp(+7 -3)📝
runtime/src/vulkan_device_fault.h(+60 -9)➕
runtime/test/d3d12_compile_pool_test.cpp(+536 -0)📝
runtime/test/submit_mutex_test.cpp(+162 -3)📄 Description
Claimed in the coordination issue as: RT-COMPILE-GATE-WARMUP-FREE (claim)
Depends on: #2233
This branch is #2233's branch plus one commit (
e4713a440). Until #2233 lands, the diff againstmainshows its changes too.What and why
The compile gate (
SubmitMutex::CompileTurn,runtime/src/vulkan_device_fault.h) keeps a queue submission out of the driver while any pipeline create is in it. That covers warm-ups too, which nobody is waiting for. HasiKe's cold boots on an RTX 2070 SUPER (#2233) show the cost:LEONIDA_COMPILE_GATE=0it ran at about 100 frames a second.MoonEyes measured the same in #1608 (07:32): 142 s of submission waits behind warm-ups, and game state 3 reached with the gate off. The gate must stay for demanded creates (the device losses it was added for), so this narrows it to them:
compile_job_speculativefor the length of such a job, andDriverTurnpasses it toCompileTurn.enter_submitwaits only for the demanded creates in the driver. A warm-up's pipeline is simply not ready yet: a draw or dispatch that needs it builds it or waits for it, as before.LEONIDA_COMPILE_GATE_WARMUP_MAXwarm-ups (default 1) are in the driver at once.LEONIDA_COMPILE_GATE_WARMUPS=1makes warm-ups hold the gate again, the behaviour before.LEONIDA_COMPILE_GATE=0still turns the whole gate off, unchanged.Risk, and why it is opt-out rather than opt-in: a submission can now be in the driver while one warm-up create runs. That is the case the gate was first added for (NVIDIA 630.20, a submission behind a long warm-up create lost the device). HasiKe has since corrected their own report: their TDR with the gate off at 249.7 s matches fiestorra's world-load GPU hang, which happens with no pipeline build at all, and says nothing about parallel creates. So no current measurement shows a create beside a submission losing the device. This pull request keeps that overlap to one warm-up at a time. HasiKe offered to run it on their card; the result decides whether the default stays.
Tested
submit_mutex_test(CPU), new casewarmups_do_not_hold_the_gate:max1 and 2, four warm-ups never have more thanmaxin the driver at once, and a demanded create does not wait for them;LEONIDA_COMPILE_GATE_WARMUPS=1), a submission waits for a warm-up as before;The earlier gate cases (a submission waits for a create, a create waits behind a waiting submission, creates share the gate) still pass.
d3d12_compile_pool_test, new case: a warm-up's and the checkpoint's jobs run withcompile_job_speculativeset, a demanded job without, also on a worker that ran a warm-up before (one worker and three).Each gate rule was broken by hand in turn (4 mutants: warm-ups hold submissions, the policy ignored, no cap, a warm-up entering during a submission), and
submit_mutex_testfailed for every one.With the change, these pass (15 of 15):
submit_mutex,d3d12_compile_pool,d3d12_compile_teardown(pool and one worker),big_compile_gate,d3d12_big_compute(all 7 settings),d3d12_m4_compute,d3d12_pipeline_workersandd3d12_pipeline_workers_eager. A boot was running on this machine, so the full suite was not run.python -I tests/test_docs_env_vars.py,tests/test_docs_repo_paths.py,scripts/check_no_game_data.pyon the changed files: pass.Not tested here: a real boot. A cold boot on HasiKe's card, and ours, with the gate on is the measurement that matters (submissions a second while warm-ups run, and whether the device stays).
GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly. (Stacked on #2233;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.