d3d12 pipeline: one compile at a time, opt-in behind LEONIDA_LIBRARY_COMPILE_GATE=1 (D3D12-PIPELINE-ONE-COMPILE-AT-A-TIME) #3185
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/3185:github-pr/3185" git switch "github-pr/3185"
Open
leonida/mandy
Noirdex wants to merge 2 commits from
github-pr/3185 into main
pull from: github-pr/3185
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
3 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!3185
Loading…
Reference in a new issue
No description provided.
Delete branch "github-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?
This branch is out-of-date with the base branch
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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).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.
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
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).
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.
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).
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.
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).
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).
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: bf907c6294
Unlike 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
Gate run on an RTX 3090 (NVIDIA 621.40, Windows 11 Pro build 26300), executable of this pull request's head
4e62c33ee(diag profile,diagnostics,dlss,mimalloc, msvc target), Series X output 2560x1440, DLSS quality, no frame generation, 300 s standing at the save, againstmain6ced7a6c5built the same way.main(mean of two runs, 32.5 and 33.5). Within the gate's ±1.5.Verdict: PASS.
GPUs tested: NVIDIA GeForce RTX 3090, driver 621.40.
AI-assisted: run and report by Claude Code (Claude Opus 5.5).
Not merging this one for now. An independent review found two problems: the PR's own notes say a serialised compile is not the fix for the issue it targets (
library.rs:265-288andfindings.md), and the project only merges from contributors who already have a merged PR. The in-game run on an RTX 3090 passed (no device loss), so nothing is broken; it just does not fix the problem it is meant to. Thanks for the work.🤖 Generated with Claude Code