d3d12 pipeline: one compile at a time, opt-in behind LEONIDA_LIBRARY_COMPILE_GATE=1 (D3D12-PIPELINE-ONE-COMPILE-AT-A-TIME) #3185
Open
Noirdex wants to merge 1 commit from
upstream-pr/3185 into main
pull from: upstream-pr/3185
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!3185
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3185"
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 Noirdex on 2026-12-02T17:20:32Z.
Claimed in the coordination issue as: D3D12-PIPELINE-ONE-COMPILE-AT-A-TIME (a second claim that corrects the first, whose numbers were misread)
Depends on: none
Fixes: none
What and why
With
LEONIDA_LIBRARY_COMPILE_GATE=1, one pipeline compiles at a time through the library's path (COMPILE_GATEind3d12/crates/leonida-gpu/src/pipeline/library.rs), however many threads ask for one. Off by default. The review measured what a serialised pool costs a card whose driver loads the library — the workers run at one thread's speed, and a light pipeline's waiter sat 611 ms idle, 3.3 to 7.5 s under load, behind one slow compile of a lowest-priority worker — and whether one at a time holds the device on the reporting card is not yet measured. The A/B that shows it is the number the switch waits for. The switch carries theLEONIDA_LIBRARY_*family of its file becauseLEONIDA_COMPILE_GATEis already the C++ runtime's compile-gate policy (runtime/src/compile_gate_policy.h,docs/d3d12_vulkan.md); the claims linked above still name the shorter one, written before the collision was found.Revised after the review: the gate is opt-in (the first push had it on by default), and it is now taken before the
makecall is listed, so a wait for it is not counted in the compile's diagnostic time (MoonEyes' point 3).On an RTX 3080 Ti (driver 621.47, by nvidia-smi; Windows 11 build 26300) the driver takes the pipeline library file but refuses every load from it with
E_INVALIDARG(0x80070057): 58 pipelines refused in the first of two runs and 24 in the second, all 0x80070057; the nine the second run loaded were stores of that same run, so far as the trail shows, none from the file. So each refused pipeline compiles again at every world entry, whatever the precompile put in the library. Both runs had the device removed as the world came up (0x887A0005, the GPU instance suspended): the trail holds nine threads' compiles in the 26 s before the first removal and twelve in the 29 s before the second, one compile of the first run 2.6 s, the rest at most 33.2 ms there and 373.5 ms in the second, and each removal report says "no call running", the 2.6 s compile having ended 12 ms before it. The refusals are the driver's; the many compiles running at once are ours, and that is what the switch bounds, for the driver that refuses loads. The full note, with the machine and the review's measured costs, is in the branch's d3d12/docs/findings.md ("A driver that refuses every library load, and the device it removed");LEONIDA_LIBRARY_COMPILE_GATEis in the regeneratedd3d12/docs/switches.md.Lines from the layer's own log (no game content in them). From
play-1202-101830.log:its last line:
and the last line of
play-1202-104737.log:Related, not claimed fixed: #2789 (a pipeline-library rework — libraries stamped with the driver and discarded across driver updates, refused entries self-healed — works the refusals from the library's own side; this bound is what the title's threads do while they last), #3068 (a device removed right after a masked-twin pipeline was made, RTX 4070 SUPER), #2821 (removals after 5 to 46 minutes, RTX 4070 SUPER), and the 3090 whose run report on #2789 held 35 of these refusals beside a removal. A different one is the walking-loop loss on the same driver that
LEONIDA_D3D12_BACKGROUND=0holds (valenciana-nc, #2570).Tested
cargo test -p leonida-gpu --lib --locked libraryon the revised head: 8 passed, 0 failed, 1 ignored (the reviewers' runs of the first head all passed).python -I scripts/check_no_game_data.pyon the three changed files.OnceLock), so a test can only exercise the mode its process starts with — the constraint Kal0s-design's harness noted ("one mode per process"); a device-gated test on its model is possible and we will add one if wanted. The crate's device tests skip themselves where there is no device.GPUs tested: NVIDIA GeForce RTX 3080 Ti (12 GB), driver 621.47, Windows 11 Pro build 26300; Ryzen 7 5800X, 32 GB RAM. No other GPU. (The reviewers ran Windows 10 and 11 with other cards — see their comments.)
AI-assisted: yes — GLM-5.3 (Z.ai), in the OpenCode coding agent, wrote the change, its comments and the findings.md section from our two crash logs; a separate read-only agent session of the same model audited the diff before this pull request was opened (call sites and re-entry, lock scope, poisoning, clean-room, comment accuracy against the logs, and the
LEONIDA_COMPILE_GATEname collision), and audited it again after every edit. The models CONTRIBUTING.md lists for review were not available in this environment, so we name the one that reviewed it.Checklist
mainand merges cleanly (one commit, rebased per fiestorra's note so the diff is the three files only).Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T17:55:34Z.
Verified here: it applies, the library tests pass, and the switch table matches - but nothing tests the gate itself, which is the whole change.
So nothing is broken, and the documentation check is happy. What is missing is evidence that the gate does what it says.
COMPILE_GATEis a serialisation, and a serialisation is the kind of thing a test can hold: two threads ask the library for a pipeline at once and the test asserts that one compile ran at a time - or, more usefully, that the second waits rather than getting a second compile. As it stands, the only thing exercising it is a real run of the title, and the body says the A/B numbers come from such runs - but the mechanism itself has no unit test, which means a future refactor oflibrary.rscan remove the gate silently.For the merge: the branch carries drift - 12 files applied for a
+53/-2change - so a rebase before a reviewer looks at it would make the diff readable. AndBLOCKEDwith no test to justify the change is the thing I would expect a reviewer to ask about first.What I could not test: the contention it is for. Two concurrent pipeline compiles need the title and a library being filled, which this machine cannot do - the same limit as every other compile-path pull request I have checked today.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T17:59:47Z.
Code review of head
1f6275849against currentmain45dc41f95(it is based on it; merge-tree clean). Not built:leonida-gpuis Windows-only. No CI runs exist on this head yet.What it does: a process-wide
COMPILE_GATE: Mutex<()>taken aroundcreate()inlibrary::pipeline(library.rs:~631), on by default, off withLEONIDA_LIBRARY_COMPILE_GATE=0.Defects
A default-on change justified by an unmeasured hypothesis. The findings section itself says "whether it holds the device on this card is not yet measured" (
findings.md, new section, last sentence of its second paragraph). Two removals on one RTX 3080 Ti whose driver refused every library load are the only evidence, and the gate is not shown to change them. AGENTS.md asks for the root cause and a measurement before a default changes; as written this should be opt-in (LEONIDA_LIBRARY_COMPILE_GATE=1) until an A/B on that card shows the removals go away.It serialises every compile on every machine, not only on the driver that refuses loads.
create()runs wheneverloadfails, and a load fails for every pipeline that is simply not in the library yet: a cold cache, any new variant, everyleonida warm --thesechild. The in-process pool is 2 to 16 workers (pipeline/make.rs:1036-1041) plusSCREEN_WORKERS = 2(make.rs:1017); with the gate they become one compile at a time. Two consequences:apps/leonida/src/warm.rs:350-360) is serialised internally too, so the full warm thatmainnow runs by default (#3172, "can take an hour or more") gets slower in proportion to the workers per child.No measurement of either is given. If the driver-refusal case is the target, gating could at least be limited to it (for example, on after N refused loads in a row), rather than taxing healthy drivers.
The diagnostic timing now includes the queueing.
let _call = call("make", name);is taken before_gate(library.rs, thelet pso = { ... }block), soCALLSrecords the wait for the gate as part of "make", and the removal report's "calls running" and the trail'smade ... in N ms(frombegan) will show long "compiles" that were waits. Take the gate first, thencall("make"), or record the wait separately.No test. Nothing checks that the switch reads as documented (
0off, anything else or unset on) or that the gate is released on thecreate()?error path (it is, by drop order, but a unit test with two threads and a counter would pin it).Docs:
switches.mdcount 682 -> 683 and the new row are consistent with the code comment. The findings text is careful to call the link to the removals a hypothesis, which is right; the code default does not follow it.Verdict: defects (make it opt-in or measure it on the reporting card and on a healthy driver's cold start before it becomes the default).
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T20:10:05Z.
Verified PR #3185 (
1f6275849) merged cleanly ontomain(f1a559851) on native Windows 10 x64 (Rust 1.98.1):python -I scripts/check_no_game_data.pyPASS.python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdPASS.cargo test -p leonida-gpu --features diagnostics --lib --locked pipeline::library::-- 6 passed, 0 failed (0.24 s).Verdict: PASS (Windows unit tests only; no game launch).
AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T20:31:05Z.
VERIFY-3185 — suite en Windows nativo, y revisión del candado (no hay test:
red not constructible)1f627584945dc41f95mainb41763227—merge-treeclean,git merge --no-ffclean (auto-mergedfindings.mdandswitches.md)Ran
The one failure is this machine's, not this PR's:
descriptor::host::tests::views_are_made_beside_the_heap_and_copied_infails identically on cleanmainb41763227(0 passed; 1 failed) and on the merged head — it is the iGPU artefact ofD3D12CreateDevice(None, ..)that #2995 addresses, and it has failed on this machine all day.No test in the PR, so there is no red side to construct: by this repository's own vocabulary this is
red not constructible: the pull request changes no test, and the evidence for the change is a measured in-game run (the two RTX 3080 Ti logs), not a test. That is the right kind of evidence for a scheduling policy; I say it plainly rather than pretend otherwise.What I read carefully, since a mutex held across a compile is where this kind of change goes wrong
one_call,same_name), and released beforeMADE,trail,one_callandsaving.read();saving.write()in the save path never waits for it. No nesting in either direction.library::pipelinecall sites (host.rs:862,:1055,:1154) pass closures that only callCreateComputePipelineState/CreateGraphicsPipelineState/CreatePipelineState; none calls back intopipeline(), so the non-reentrantMutexcannot deadlock itself.unwrap_or_else(|e| e.into_inner())— one panicking compile does not wedge every later compile.switches.md(LEONIDA_LIBRARY_COMPILE_GATE=0), andfindings.mdis honest that holding the device "is not yet measured".Two things I would want the author to answer
pipeline()returnscreate()early whennameor the library isNone(library.rs:600-602), so withLEONIDA_PIPELINE_LIBRARY=0(or a library that failed to open) compiles still run concurrently. If the common factor in those two removals is "several threads compiling at once" and not "recompiles after refused loads", that path keeps it.-PrecompileAllthe default (#3172), a gate that admits one compile at a time can stretch warm-up; the findings quantify the two removed runs but not the time this adds. A number from the same card would settle whether the gate belongs on by default.What I could not test: the behaviour itself — a compile storm needs the RTX 3080 Ti and the title; this machine's 4090 loads the library (no refusals), so the gate changes nothing measurable here.
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T20:40:17Z.
Ran natively on Windows 11, head
1f6275849merged into currentmain(b41763227, clean merge).One thing first, since the title says "behind" a switch: the gate is on by default (
is_none_or(|v| v != "0")), andLEONIDA_LIBRARY_COMPILE_GATE=0is the path that matches main. By reading, the=0path differs from main only by aNoneguard, so off really is as before.Suite and checks (measured)
cargo test -p leonida-gpu --features diagnostics --libcargo clippy -p leonida-gpu --features diagnostics --all-targetslibrary.rstools/d3d12_switches.py --checkscripts/check_no_game_data.pyThe PR adds no tests, so there was nothing new to run red on main.
What the gate costs, on the card (measured)
I added a throwaway test (not pushed) that sets a pipeline cache folder, makes the host device, and builds compute pipelines through
library::pipelinewith names the library doesn't have, so every call takes thecreate()path under the gate. Each pipeline has its own nonce so the driver's disk cache can't help, and the bytecode is compiled before the clock starts. One mode per process, becauseone_at_a_time()is aOnceLock. I checked in the log that the library was open and the gate state matched the env var each time. Other builds were running on the machine at the same time, so treat these as rough.16 pipelines of about 0.6 s each, split over N threads, in ms:
So with the gate on, the pool runs at one thread's speed or a bit worse. That's the intent, but it's also what every cold start and every
warmchild will pay on a healthy driver. This is the number MoonEyes' point 2 asked for.Priority inversion (measured, simulated)
This doesn't use #3132's code. It's a stand-in for its setup: one thread at
THREAD_PRIORITY_LOWEST(what general workers run at) is insidecreate()for a heavy pipeline, holding the gate. A normal-priority thread then asks for a light pipeline (about 50 ms alone). In some runs, one spinner per logical processor at normal priority stands in for the title's own threads. Spinners stop after 8 s, which caps the loaded numbers. Waiter latency in ms:Under load the lowest-priority holder barely runs, and the normal-priority waiter sits behind it for seconds. From reading #3132's
completion.rs: donation boosts only the worker building the pipeline someone is waiting for, so a boosted worker that blocks onCOMPILE_GATEleaves the holder at LOWEST. The boost does nothing for it, and this table is roughly what it gets. #3200 sends more work to the same workers, so the same applies there.Read, not measured
createclosure that reaches the gate is a bareCreate*PipelineStatecall.graphics_depth_bounds_pipelinegoes throughstream_pipeline→library::pipeline, not from inside acreate. The gate is dropped at the end of its block, beforeone_call()andsaving.read(). Nothing is taken while it's held.createthat panics poisons the mutex, the next call recovers throughinto_innerand builds fine (48 ms). In production,make_withalready catches panics around the build.Use::Skip→ no name → the earlyreturn create(), which never takes the gate. The same is true for any process without a library, theplaces.rschecks, and the many directCreateComputePipelineStatecalls elsewhere in the crate (hwrt.rs,indirect.rs,host.rs, ...). If the removals come from concurrent compiles, those can still overlap.make::now()builds on the caller's thread. It's used bybuilder_runs()while holdingBUILDER, and with the gate that call can now wait behind any background compile with no budget. Frame waits throughuntil_madedo have a budget, but they will time out more often, which means more skipped draws while the pool is serialised.crate::toggled!("LEONIDA_LIBRARY_COMPILE_GATE")instead of the hand-rolledOnceLockwould give the same default, letLEONIDA_ABflip it during one run (the A/B on the reporting card that the thread is asking for), and let the switch table show the default instead of "see the code".Merge with other open PRs touching
library.rs(git merge-treeagainst main + this PR)switches.mdonly: the count line (683 vs 682) and the neighbouring new row. Mechanical.#2789 (driver stamp, self-healing refused entries) goes after the same refused-load case from the other side, so it may be worth seeing whether it alone stops the recompiles before this becomes the default.
Not checked: the title itself or a real library that the driver refuses, the combined #3132 + #3185 tree, release builds, other vendors, WARP.
GPUs tested: one NVIDIA desktop card.
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T20:50:23Z.
Review: COMMENTED
Integration finding for
1f627584with #3222d59a9d6eon currentmain1bb49101: the merge is textually clean, but the two default-on paths can stop all subsequent library fallback compiles. This PR holdsCOMPILE_GATEacrosscreate()inpipeline/library.rs:630–635. If #3222 parks a worker while that call is in progress, the Rust guard is never dropped. Releasing the per-pipeline claim and spawning a replacement does not release the library gate, so the replacement and other workers block at the next fallback. Please coordinate the default-on behavior and ensure a guarded worker cannot be left holding the shared compile gate. Source and merge review only; I did not induce a driver fault. AI-assisted.Imported from ubiquitarianism/leonida. Originally posted by Noirdex on 2026-12-03T00:17:38Z.
Thank you all four for running what we could not. The head is revised (
d70c7ccc9, rebased on currentmain, diff back to the three files; the crate's library tests pass on it, 8 passed / 0 failed / 1 ignored): the gate is now opt-in (LEONIDA_LIBRARY_COMPILE_GATE=1, off by default), and the answers to each point:MoonEyes
=1-to-turn-on, and "whether it holds the device is not yet measured" moved from findings.md into the code comment itself. We will run the A/B on the reporting card (our machine) next session and post the number here — that is the number the switch waits for.call("make")now, so the trail'smade ... in N msand the removal report's "calls running" describe compiles, not waits.one_at_a_time()reads aOnceLockonce a process, so an in-suite test can only exercise the mode its process starts with — the same thing Kal0s-design's harness worked around with one mode per process. If you want a committed test, we will model it on that harness: device-gated (skips without one, like the crate's other device tests), two threads and a max-concurrency counter, red onmainon a GPU machine, green with the switch set. Say the word and it comes in this PR.fiestorra
+63/-2.merzleckeier
create()while holdingCOMPILE_GATE, the replacement and every later fallback blocks on a gate nobody will release — that is a stall, and your integration note is the sharpest finding of the review. With the gate now off by default the two default-on paths no longer overlap; if maintainers want both usable together, the parking path has to drop the gate before the worker parks (or the replacement must bypass it), and #3222 is the right place to coordinate that — we will follow whatever is decided there.lixonik, Kal0s-design — verified as noted above; nothing to add except thanks, and that Kal0s-design's two tables are now quoted in findings.md with their numbers.
AI-assisted: yes (GLM-5.3, in OpenCode; the change and this reply), with a separate read-only reviewer session before every push.
Imported from ubiquitarianism/leonida. Originally posted by Noirdex on 2026-12-03T01:12:27Z.
The A/B on the reporting card is in, and the number is negative: the gate does not hold the device. Reporting it as it is.
Same route both runs (house to Mandy's house and back), same build (this PR's opt-in exe; with the switch unset the behaviour is main's), current main
d5b30be1cwith the full-pipeline precompile on by default (#3172):The morning's entry storm is gone from current main. The two runs of the findings section (58 and 24 refusals, nine and twelve threads compiling, removals as the world came up) do not happen any more: with the precompile now covering every pipeline, seven minutes of play made three pipelines and twenty-nine minutes made twenty-three, none over 1.4 s. The library still refuses loads from the file (every made line carries 0x80070057) — but almost nothing asks it in play.
What the removals on this card now are: mid-play, minutes in, with a quiet trail — valenciana-nc's family (#2570: same driver 621.47, losses within 3.7 to 8.5 minutes, held by
LEONIDA_D3D12_BACKGROUND=0), not a storm. Session 2 ran the gate on — twenty-three compiles serialised exactly as designed — and the device was still removed. One session an arm says little, and we will not read the 29 minutes against the 7 as the gate's doing: nothing in either trail points at the compiles.The honest position after today: the bound this PR adds is real (the serialisation held and the timings show it), but on current main nothing shows it prevents a removal — the failure it was for no longer reproduces, and the failure that remains is not a compile problem. Whether an opt-in bound is worth carrying for the cases that still make a storm (a cold cache, a refusing driver without the precompile's cover — the case #2789's library work is for) is the maintainers' call; if the answer is no, closing this is a fair decision and we will not argue it on today's numbers. The branch's code comment and findings section are updated with the same words in the head this comment replies to.
(fiestorra's warm-time question: with three and twenty-three makes in play the run-time cost is nothing measurable; the warm children's own compiles are where a gate would count, and with the switch opt-in that cost is only ever paid by choice.)
AI-assisted: yes (GLM-5.3, in OpenCode).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T01:45:12Z.
RUN (in game, one pull request), its head merged with
git merge --no-ffonto maind15e048a7: #3185bf907c629. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this pull request, on the head above. If it changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures;
-PrecompileUsedwas used, so the default start (every known pipeline precompiled) was not exercised. The change is behind a switch that is off by default, and it was left off: this run covers the default path only, not the one-compile-at-a-time mode.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by ninjalegxd on 2026-12-03T15:35:20Z.
Tested #3185 on RTX 3090 (driver 621.47), Win11, main + this PR, -SeriesS -NoFrameGen,
LEONIDA_LIBRARY_COMPILE_GATE=1 and LEONIDA_SAMPLE_MASK=0 (confirmed on the settings line).
PR head tested:
bf907c6294Unlike my earlier runs (rem
oval 19-660 ms after a new pipeline), here the last pipeline
was made ~4.6 s before the removal, so with the gate on the loss no longer follows a
compile directly. Details of earlier runs: #3068.
AI-assisted: Claude Opus 5.5 (Anthropic) helped analyze the logs and draft this comment.
play-1203-172134.log
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.