d3d12: warm-up creates no longer hold the compile gate (RT-COMPILE-GATE-WARMUP-FREE) #2275
Closed
Tyrannys wants to merge 7 commits from
upstream-pr/2275 into main
pull from: upstream-pr/2275
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
ProjectLeonida/mandy!2275
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2275"
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?
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-26T12:06:30Z.
Claimed in the coordination issue as: RT-COMPILE-GATE-WARMUP-FREE (claim)
Depends on: nothing. #2233 has landed on
main, so this PR now depends on nothing else.mainis merged in (e1bf0b8ae), with #2233 and the adaptive compile gate (#2412, #2462). After lixonik's review, a speculative create (compute warm-up; graphics/mesh prewarm of #2260) passes the gate without holding submissions only if it is a compute create and the gate is adaptive (SubmitMutex::warmup_passes), and not where the adaptive verdict says the driver holds submissions. Withclassic(forced or chosen byauto), withLEONIDA_COMPILE_GATE=1, and for graphics/mesh prewarms, it holds the gate as a demanded create does;LEONIDA_COMPILE_GATE_WARMUPS=0opts compute warm-ups in with every gate,=1makes all hold.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: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-26T12:22:02Z.
One boot with this PR and the compile gate on: RTX 4070 SUPER (12 GB), NVIDIA 621.01, Windows 11, 64 GB. Counts only.
Tree:
maina73a57e13+ #1851 #1905 #1957 #1886 #1894 #1914 #1882 #2195 #2113 #1592 #2097 + #2233 #2179 #2228, #2260 at6f2b52e56, and this PR (all clean merges). Recipe: async pipelines, prewarm from the previous run's order log (846 graphics pipelines planned), a local skip list of the 1,009 ray-hit shading programs,LEONIDA_RT_AS=off,LEONIDA_DEVICE_FAULT=0, the watchdog kicked,LEONIDA_ARENA_MB=1536,LEONIDA_TITLE_WINDOWS_MB=1024, warm offline, heavy and journal caches.LEONIDA_COMPILE_GATEunset (on),LEONIDA_COMPILE_GATE_WARMUP_MAXdefault.vkQueueWaitIdle), then exit 0xC0000005 at 291 sLEONIDA_DEVICE_FAULTwas 0, so there is no fault report. With one run, I can't tell whether a submission running beside a warm-up create played a part. None of my gate-off runs lost the device. The next run here repeats F7 withLEONIDA_DEVICE_FAULT=1.LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES=131072).AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-26T12:32:06Z.
Second run with this PR, the same recipe and the gate on, with
LEONIDA_DEVICE_FAULT=1(F7b). It never reached the world.LEONIDA_COMPILE_GATE=0here.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by HasiKe on 2026-11-26T12:33:00Z.
@Tyrannys, here is the cold boot you asked for, with the gate on, on the RTX 2070 SUPER. AI-assisted (Claude Code).
Tree:
maina73a57e13+ #2195 + #2233 + this PR (e4713a440, a clean merge). There is also a local diagnostic patch of mine,LEONIDA_SKIP_GRAPHICS, which was not set in these runs.d3d12_compile_pool_testand the other compile/submit tests pass.Setup: NVIDIA 616.56, Windows 11 Pro 26300, my own 1.0.2.1 package. One binary for both runs, A/B via
LEONIDA_COMPILE_GATE_WARMUPS=1. Both boots were cold: no session or seed cache, an empty journal and their own empty__GL_SHADER_DISK_CACHE_PATH. Settings:LEONIDA_ASYNC_PIPELINES=1, gate on (LEONIDA_COMPILE_GATEunset),LEONIDA_DEVICE_FAULT=2, the watchdog kicked,LEONIDA_CONSOLE_FIX_US=0, 4096 MB title windows and arena, the keyboard pad, 300 s each.LEONIDA_COMPILE_GATE_WARMUPS=1(old)dispatch-workercreate at 28 s)So, on this card:
Neither boot reached the world. My input script only enters it at 314 s. So this says nothing about the world-load hang. That hang is a separate problem, a VS-as-mesh-shader draw that never finishes on the GPU (#1608, follow-up), and it also happens with the gate off.
The cold boot on this machine goes from unusable to normal speed, so this PR looks like a clear win to me.
Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-26T14:29:31Z.
I checked
e4713a440merged onto main73516a290(no conflicts) on Windows 10 / MSVC 14.44, GTX 1050 Ti host.d3d12_compile_pool_testandsubmit_mutex_testpass 2/2, plain and withLEONIDA_VK_VALIDATION=1, three repeats each.The production switch has no test. Only one line passes "this create is speculative" to the gate in the runtime:
d3d12_pipeline_compile.h:168,gate_.emplace(submits, compile_job_speculative);. I replaced it withgate_.emplace(submits);, which is exactly main's behaviour: every warm-up holds the gate again. Then I rebuiltgta6rt,d3d12_compile_pool_testandsubmit_mutex_test:submit_mutex_testdrivesSubmitMutex::CompileTurn(m, true)directly.d3d12_compile_pool_testchecks thatcompile_job_speculativeis set for a warm-up and for the checkpoint. Nothing constructs aDriverTurn(git grep DriverTurn runtime/test/finds only a comment atd3d12_compile_pool_test.cpp:356). So the one line that turns the feature on in the game is untested. A small test would close it:DriverTurnwith a pipeline, made whilecompile_job_speculativeis true;SubmitTurnon the same gate must then not wait;Docs that no longer match:
runtime/README.md:418(LEONIDA_COMPILE_GATE) still says unset means the workers compile while other queues submit, and1opts into holding the lock.compile_gate_enabled()(vulkan_device_fault.h:434-440) has the gate on unless the variable is0, which is what the next row says. Was this row already stale on main?docs/d3d12_vulkan.mdaround 2617-2619 and 2635-2636 still says, in the present tense, that a compute warm-up holds the gate for its whole create and every submission waits behind it. The new paragraph between them says the opposite by default.d3d12_pipeline_compile.h:145say a prewarm and the checkpoint also pass as speculative. No prewarm exists on main (that is #2260).save_session_pipeline_cachedoes no pipeline create and never entersDriverTurn. So only compute warm-ups are actually affected today.The risk is stated well. A submission can now be in the driver beside one warm-up create. That is the NVIDIA 630.20 case the gate was added for. It is capped at one at a time (
LEONIDA_COMPILE_GATE_WARMUP_MAX, andPipelineCompiler::next_lockedalready starts one warm-up at a time), andLEONIDA_COMPILE_GATE_WARMUPS=1restores the old behaviour. I have no world boot on this card yet, so I can't add a measurement.The code reading behind these points was done with a second agent and checked line by line before writing this.
AI-assisted (Claude Code, with Antigravity / Gemini 4 Neon).
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T10:55:10Z.
@qhukz13 thank you for checking this, and for finding the untested line. All three points are addressed; current
mainand #2233's fixes are merged in (a7a48f1ae).test_a_driver_turn_passes_the_speculative_flag_to_the_gateind3d12_compile_pool_testbuilds a realDriverTurnwith a pipeline. Withcompile_job_speculativetrue, aSubmitTurnon the same gate passes at once; with it false, the submission is still held after 150 ms and passes once the create leaves. With your mutant (gate_.emplace(submits);) it fails (submitted.load() == speculative). Restored, it passes.LEONIDA_COMPILE_GATErow was already stale on main. It now says the gate is on unless0, and that1additionally holds the submit lock for compute builds (compute_driver_turn).d3d12_pipeline_compile.hsays the same.LEONIDA_COMPILE_GATE_WARMUPS=1.After the merge:
submit_mutex,d3d12_compile_pool,d3d12_compile_teardown*,d3d12_big_compute*,d3d12_pipeline_workers*,d3d12_m4_computeandbig_compile_gate, 15 of 15. Profile M: RTX 4070 SUPER 12 GB desktop, NVIDIA 621.01.@HasiKe thanks again for the A/B on the RTX 2070 SUPER (74,012 against 745 submissions in 300 s, no device loss). That is the measurement this needed.
AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T14:39:34Z.
Merged main (
ec91d695c, with #2233 and the adaptive gate #2412/#2462; warm-up rule ported onto it) in atd61c90965; submit_mutex, d3d12_compile_pool, d3d12_compile_teardown, d3d12_compile_teardown_one_worker, d3d12_pipeline_workers, d3d12_pipeline_workers_eager and pipeline_workers pass. AI-assisted (Claude Code)Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T15:20:32Z.
Code review location:
runtime/src/vulkan_device_fault.h; line 968In
classicmode -- includingLEONIDA_COMPILE_GATE=autowhen startup calibration deliberately picksclassicbecause the driver holds submissions behind compute creates (e.g. NVIDIA 630.20) -- and inLEONIDA_COMPILE_GATE=1(GateMode::always),adaptive_isfalsesoprobe()returns early andverdict_[kind]staysGateVerdict::pendingpermanently.Because
policy_.freedefaults totrue,if (c.speculative) return false;still letsvkQueueSubmitenter the driver beside compute warm-ups inauto: classic/classic(and beside graphics prewarms under=1), defeating the calibration fallback meant to avoid device loss on holding drivers. Gating the speculative bypass onadaptive_(or disablingpolicy_.freewhencompile_gate_mode()isclassic/alwaysunless explicitly enabled) would preserve the non-adaptive modes' guarantee.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T15:20:32Z.
Code review location:
runtime/shims/d3d12_pipeline_compile.h; line 617With
#2260(LEONIDA_PIPELINE_PREWARM_ORDER) now onmain,PipelineState::prewarm_queuesubmits graphics and mesh prewarm jobs with non-zero priority (leonida::pipeline_prewarm::priority(entry.rank)), sospeculative(andcompile_job_speculative) istruefor graphics/mesh prewarms too, not just compute warm-ups (also making the(only compute warm-ups exist)note inruntime/README.mdstale).More importantly,
autocalibration only probes a compute pipeline. On drivers where compute does not hold submissions (auto-->adaptive) but mesh pipeline creates do hold submissions (e.g. NVIDIA 621.40),verdict_[graphics]startspending, so marking graphics/mesh prewarms speculative lets submissions enter the driver immediately beside a long mesh prewarm before a graphics verdict exists. Consider restricting the speculative bypass toCreateKind::compute(or requiringverdict_[graphics] == driver_does_not_holdfor graphics prewarms).Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T15:20:32Z.
Code review location:
runtime/src/vulkan_device_fault.h; line 731Minor:
set_warmup_policy()storespolicy.maxwithout clamping it to at least1(unlikewarmup_policy_from_environment()). Callingset_warmup_policy({true, 0})would makespeculative_ >= policy_.maxpermanently true and deadlock any speculative create. Also, applyingspeculative = speculative && policy_.freeinsideenter_compile()undergate_mutex_(instead of takinggate_mutex_separately inwarmups_free()) would make directenter_compile()callers honorpolicy_.freeatomically.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T15:20:32Z.
Review: COMMENTED
Reviewed and tested at
d61c90965(merged cleanly ontomainec91d695c).The warm-up-free compile gate mechanics and test coverage in
submit_mutex_test/d3d12_compile_pool_testare clear and well structured, and both suites pass. I found two behavioural edge cases on currentmain(plus one minor API guard) noted inline:classic/auto: classic/LEONIDA_COMPILE_GATE=1bypass: becauseverdict_[kind]stayspendingwhenadaptive_isfalse,if (c.speculative) return false;inis_blocking()still lets submissions enter beside compute warm-ups even whenautocalibration deliberately pickedclassicbecause the driver holds submissions (e.g. NVIDIA 630.20) or whenLEONIDA_COMPILE_GATE=1is requested.#2260graphics/mesh prewarm onmain:PipelineState::prewarm_queuesubmits graphics/mesh prewarms with non-zero priority (compile_job_speculative = true), whileautocalibration only probes a compute pipeline. On drivers where compute does not hold submissions (auto-->adaptive) but mesh creates do (e.g. 621.40),verdict_[graphics]startspendingand submissions enter immediately beside a mesh prewarm.set_warmup_policy()does not clamppolicy.max >= 1(passing0deadlocks a speculative create).Verified locally on Windows 11 (MSVC 19.44.35230.0, Ninja Release):
submit_mutex: passed (42.26 s, including the warm-up and holding-kind cases)d3d12_compile_pool: passed (2.10 s, includingcompile_job_speculativeandDriverTurnchecks)scripts/check_no_game_data.pyandgit diff --check: cleanAI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T16:18:55Z.
Code review location:
runtime/src/vulkan_device_fault.h; line 968Thanks, right: with
adaptive_false no verdict ever comes, so the bypass hit exactly the driversautofalls back to classic for. Fixed in3582924b6: whether a speculative create passes is now decided inenter_compileundergate_mutex_(warmup_passes): only a compute create with the adaptive gate. Withclassic(forced or chosen byauto) and withLEONIDA_COMPILE_GATE=1every speculative create holds submissions as a demanded one does, andCompileTurn::speculative()reports false.LEONIDA_COMPILE_GATE_WARMUPS=0is the explicit opt-in to let compute warm-ups pass with those gates too (documented with its cost on a holding driver);=1still makes every warm-up hold.submit_mutex_testchecks each mode: adaptive, classic,=1,=0under classic and=1, and=1under adaptive, each on a gate of its own. AI-assisted (Claude Code)Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T16:18:57Z.
Code review location:
runtime/shims/d3d12_pipeline_compile.h; line 617Agreed, and thanks for catching the #2260 interaction. Graphics and mesh prewarms stay speculative jobs (the pool still schedules them as such: lower priority, never ahead of demanded builds), but at the gate they now hold submissions as a demanded create does:
warmup_passesonly lets a compute create through, since the calibration measures only compute and 621.40 held a submission 54 s beside a mesh create. So a mesh prewarm is waited for whatever the compute verdict is. The(only compute warm-ups exist)note is gone; README anddocs/d3d12_vulkan.mdnow name the prewarms and say they hold the gate, and thecompile_job_speculativecomments say the gate decides. Tests: a speculative graphics create holds a submission with the adaptive gate and with=1(submit_mutex_test), and the same throughDriverTurnwithkind = graphics(d3d12_compile_pool_test). AI-assisted (Claude Code)Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T16:18:59Z.
Code review location:
runtime/src/vulkan_device_fault.h; line 731Done in
3582924b6:set_warmup_policyclampsmaxto 1-64 (the same range the environment accepts), andpolicy_.freeis read inenter_compileundergate_mutex_together with the mode and kind, so directenter_compilecallers follow it too; the separatewarmups_free()is gone.submit_mutex_testruns the cap case with max 0 (taken as 1, no deadlock), 1 and 2. AI-assisted (Claude Code)Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-27T16:19:01Z.
Thanks @lixonik for the careful review and for testing it. All three points are addressed in
3582924b6, and main (55bd6f4f1) is merged in ate1bf0b8ae: speculative creates now pass the gate without holding submissions only as compute creates with the adaptive gate (or withLEONIDA_COMPILE_GATE_WARMUPS=0as an explicit opt-in); graphics/mesh prewarms and all warm-ups under classic /=1hold it;maxis clamped. submit_mutex, d3d12_compile_pool, d3d12_compile_teardown, d3d12_compile_teardown_one_worker, d3d12_pipeline_workers, d3d12_pipeline_workers_eager and pipeline_workers pass. AI-assisted (Claude Code)Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T20:09:24Z.
Review: APPROVED
Re-reviewed
3582924b6/e1bf0b8aeand re-tested:warmup_passes(CreateKind)lets speculative creates pass without holding submissions only forCreateKind::computeunder the adaptive gate (unlessLEONIDA_COMPILE_GATE_WARMUPS=0explicitly opts intoeverywhere), keeping classic /LEONIDA_COMPILE_GATE=1warm-ups and graphics/mesh prewarms holding the gate as demanded creates do.set_warmup_policyclampsmaxto1..64(kMaxWarmups), preventing amax == 0deadlock.docs/d3d12_vulkan.md,runtime/README.md) and tests cover every gate mode, graphics prewarm throughDriverTurn, andmax == 0.submit_mutex: passed (43.70 s).d3d12_compile_pool: passed (2.28 s).Looks good to merge.
AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T09:19:34Z.
Verified clean merge onto
02f71ccfe(heade1bf0b8ae) on native Windows 11 + RTX 5080 (16 GB desktop, NVIDIA616.64, default 2 s Windows TDR) in a controlled 3+3 alternating cold A/B — full tables in https://github.com/ProjectLeonida/mandy/issues/2464#issuecomment-7237165210:#2412already inmain, B beat A in 3/3 cold runs: compute gate turned off in 3/3 B runs (0in A), compile-gate waits dropped from955 / 997 / 973(8,128–17,961 ms, longest up to9,616 ms) to2 / 4 / 7(95–287 ms, longest52–285 ms), meanExecuteCommandListsX/srose+22.9%(26.88–29.65→32.40–36.41/s), andVK_ERROR_DEVICE_LOSTstayed0.Prediction HELD (3+3, non-provisional). No game data attached. AI-assisted (second-agent count audit by Claude Opus 5.5 and Codex GPT-6.2-Sol).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T11:54:20Z.
Checked
e1bf0b8aeagainstmain8fb974878on Windows 11 10.0.26300: it does not merge (git merge-tree --write-tree), so I ran no tests.runtime/test/d3d12_compile_pool_test.cpp, the summary comment at the top.a3452751d(2026-11-27, "the graphics-only worker wakes the general one for a PSO's held-back job") rewrote the same bullet this PR rewrites.mainhas nocompile_job_speculative, and none of the 12 lines this PR adds toruntime/shims/d3d12_pipeline_compile.hare there. Keep both statements in that bullet.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T13:55:06Z.
AGENT-MSG | 2026-11-29 13:54 UTC | merzleckeier | AI-assisted: Codex
BASE:
51d343b86versus the same base +e1bf0b8ae. The local compile-pool test conflict was in the header comment only. I retained both test descriptions. Unmodifiedsubmit_mutexandd3d12_compile_poolpassed on both builds.MACHINE: RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M (RADV Mesa 26.3.1) | CachyOS, Wine 11.22.
EVIDENCE: MEASURED, three runs per policy per GPU. Synthetic GPU work.
The fixture holds a production compute warm-up at its
vkCreateComputePipelinesboundary for 450 ms after the unrelated D3D12 copy starts. The wrapper observes whether that copy reachesvkQueueSubmitduring the hold. Both the independent copy and the subsequent real compute dispatch gave their expected GPU readbacks in all 30 runs.LEONIDA_COMPILE_GATE_WARMUPS=1LEONIDA_COMPILE_GATE_WARMUPS=0Enqueue is the wall time of the copy's
ExecuteCommandLists. The artificial hold isolates Mandy's gate; the real driver compile follows it. This test covers CPU-side submission gating under Wine. All runs used synchronous submission, pipeline journaling and driver disk caches disabled and no gate timeout or early probe budget. Host Khronos validation reported the same device-creation VUID01387in both builds.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:43:36Z.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed