D3D12-PIPELINE-CREATE-LOCK-AMD: serialize driver PSO creation on AMD #2694
Closed
bobcatchris wants to merge 5 commits from
upstream-pr/2694 into main
pull from: upstream-pr/2694
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!2694
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2694"
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 bobcatchris on 2026-11-30T04:53:40Z.
Problem
On AMD RDNA 3 (RX 7900 XTX,
amdxc64.dll32.0.32029.2010, Windows 11), default 10-thread early pipeline compilation hits a deterministic driver crash (0xc0000005insideamdxc64.dllor0x887A0020DXGI_ERROR_DRIVER_INTERNAL_ERROR) when multiple pipeline worker threads callCreateGraphicsPipelineState/CreateComputePipelineState/CreatePipelineStateconcurrently:LEONIDA_LIBRARY_LOCK=1(which only locksLoad*Pipeline/StorePipeline, notcreate()).LEONIDA_PIPELINE_LIBRARY=0(bypassing the pipeline library completely).LEONIDA_PIPELINE_WORKERS=1avoids the crash, but sacrifices all parallel DXIL shader translation across CPU cores.In addition, an unprioritized global
Mutex<()>can cause priority inversion during cutscenes / new camera angles: backgroundEarlyorSlowdriver compiles (1-73 s on AMD) hold the create lock while draw-criticalScreen/Requestedpipelines wait behind them.Fix
In
d3d12/crates/leonida-gpu/src/pipeline/library.rsandd3d12/crates/leonida-gpu/src/pipeline/make.rs:should_serialize_create(env, vendor_id)+CreatePriority::{Screen, Requested, Early, Slow}+CreateGate(serialized adapters only; non-AMD adapters keep concurrentcreate()unlessLEONIDA_PIPELINE_CREATE_LOCK=1is set).Pending::make()scopeswith_create_priority(CreatePriority)soScreen>Requested>Early>Slowstrictly wins the AMD create lock once the active call finishes.create()call holds the serialized lock (create_busy()),Queue::pop_with(..., slow_blocked)avoids popping speculativeSlowjobs so worker threads stay free forScreen/Requested/Earlywork andworkers()re-wakes when the gate clears.Verification
10.0.26200), Ryzen 7 7800X3D, AMD Radeon RX 7900 XTX (gfx1100, driver32.0.32029.2010), pinnedrustc 1.98.1.cargo test -p leonida-gpu --lib pipeline: 36 passed, 0 failed, 7 ignored (ind3d12, covering priority ordering and concurrent serialization tests).python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline/library.rs d3d12/crates/leonida-gpu/src/pipeline/make.rs: PASS.serializing host pipeline state creation (LEONIDA_PIPELINE_CREATE_LOCK) vendor=Some("0x1002")and runs cleanly with 0 refused pipelines.Claimed in #2570 as
D3D12-PIPELINE-CREATE-LOCK-AMD.AI-assisted: Antigravity (Gemini 4 Neon)
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T04:59:26Z.
Independent native Windows NVIDIA check of
29288a754on1d22590b9(tree1cb8f3801). Windows 11 build 26300, MSVC, Rust 1.98.1, RTX 4090 (NVIDIA 616.64). The exactpipeline::librarysubset passed 8/8.I added a local probe that sends eight concurrent requests through
pipeline(), each creating a real D3D12 compute PSO from a tiny synthetic Shader Model 6.0 shader. DXGI confirmed the adapter. I tested both no library key and eight fresh library keys (eight observed load attempts and eight subsequent creates).LEONIDA_PIPELINE_CREATE_LOCK=1Each condition passed in three repeat processes. Peak counts measure entry into the application's creation callbacks. This verifies the NVIDIA path and override with synthetic PSOs. AMD driver reproduction, GPU dispatch, and gameplay were outside this check.
AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Retest on
05c327bf3after the priority update. This merges cleanly with0ae217ceb(tree10728e5a5), which includes merged #2662. The exact library filter passed 9/9, including the new gate priority test. The pipeline worker filter passed 8/8, and the paired shader filter passed 22/22 with host coverage. On the RTX 4090 the same synthetic PSO probe completed 8/8 creates per path, with peak application callback concurrency 8 under the default setting and 1 with the lock forced. Both the no-key and fresh library-miss paths were exercised.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T11:20:31Z.
Independent Wine PSO check.
05c327bf3merged ontod367675c7(treef0308e20). CachyOS, Wine 11.22, VKD3D-Proton 3.1.0 (0bb64c56c8f0dcc), Rust 1.98.1, x64 MSVC target. Four workers created real D3D12 compute PSOs from a synthetic shader. The counts are peak entries into the application's create callback.0x1002=00x1002=0dxgi.hideNvidiaGpu = False0x10de=1The same peak held with no library key and after fresh library misses. Each path created 4/4 PSOs and all four stored keys reloaded. In this Wine setup the default follows the vendor DXGI reports, so it can serialize on physical NVIDIA hardware. DXVK option.
The test used a seeded empty library on #2694 alone. On AMD, the existing empty-library test failed on both
mainand #2694. The direct API check returned0x80070057for the empty slice andS_OKfor a null pointer with zero length. Combining #2654 at55ac5d337(tree82711e462) passed all 18 checked-in library and worker tests on AMD and reproduced the same peaks and reloads with a fresh library, without the seed. VKD3D-Proton input check.Synthetic PSO creation only. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T13:10:29Z.
Native Windows cache persistence check on
e201dcd90(#2694) with55ac5d337(#2654) onf9f3ec4c6(combined treedf841387d). MSVC x64, Rust 1.98.1, RTX 4090 on NVIDIA 616.64, Windows 11 build 26300. The ten stockpipeline::library::testsall passed.I used an isolated cache directory per run and a tiny synthetic compute shader. Eight threads looked up distinct names through the production pipeline library. I ran three cold processes per lock setting. Each made all eight PSOs and saved a nonempty
host-pipelines.bin. For each cold cache, two fresh processes reopened it, one with the lock unset and one withLEONIDA_PIPELINE_CREATE_LOCK=1. All 12 warm processes found all eight keys, ran zero creation callbacks, and left the library file byte-identical. DXGI confirmed the RTX 4090, and the probe checked the effective lock setting in each process.This adds native Windows save and cross-process reload coverage to the earlier concurrency and Wine tests. Synthetic compute PSOs only. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T13:27:04Z.
AMD Wine cache round-trip for #2694 + #2654. I tested
e201dcd90with55ac5d337onf9f3ec4c6(combined treedf841387d, same tree as the native RTX 4090 check). Windows x64 MSVC-target Rust 1.98.1, Wine 11.22, VKD3D-Proton 3.1.0 (0bb64c56c8f0dcc), Radeon 610M on RADV 26.3.1. DXGI reported0x1002. The VKD3D and Mesa shader disk caches were disabled.MEASURED. All 10 stock library tests passed. In the synthetic probe, eight threads requested distinct named compute PSOs through the production pipeline library. Every cold run started with an empty cache directory. I reopened each saved cache in two fresh Wine processes, one per lock policy.
LEONIDA_PIPELINE_CREATE_LOCK=05047d6a1)Each combined cold run saved a 3,176-byte
host-pipelines.bin. Its SHA-256 stayed identical after both warm runs, across all six caches. Peak measures application callback entries. The unlocked probe synchronizes callbacks before the driver call. The first Wine prefix initialization timed out before tests. The results above are from the complete run with a newly initialized prefix. A second agent checked the raw logs and file hashes. Synthetic compute only, AI-assisted.Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T12:56:35Z.
Offscreen driver-call check of the pipeline creation gate at
1e0e249f+c95183fd8. Four threads entered the production pipeline helper and each created a real synthetic compute PSO. On AMD RADV the peak inside the create callback was 1 by default and 4 with the lock forced off. With DXGI reporting the RTX 4070 SUPER as NVIDIA, the peak was 4 by default and 1 with the lock forced on. In an extra default DXVK run the same NVIDIA hardware appeared to the application as vendor0x1002, so the AMD default took effect and the peak was 1. The three gate unit tests passed on both GPUs. The existing rejected-library-blob check failed identically on base and PR under this Wine/vkd3d setup. This run measures the gate around offscreen compute creation. Native Windows AMD and gameplay remain open.AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T15:21:24Z.
Review: COMMENTED
Reviewed at
1e0e249f, and also merged onto today's main (the branch is 402 commits behind):merge-treeis clean, the merged tree passescargo test -p leonida-gpu --lib pipeline(41 passed / 0 failed / 8 ignored), and neither touched file adds a clippy warning. The gate, the AMD-only vendor policy and the Screen > Requested > Early > Slow ordering all match the claim (library.rs:482,:532,:728,make.rs:198,:729), and both title-PSO create sites are inside the gate — the two otherCreate*PipelineStatecalls are device-init/offline, not worker-concurrent.Mutations: the vendor guard and the
!slow_blockeddeferral are both caught. Replacingcreate_busy()withfalseinnext()(make.rs:775) survives all 40 tests — the deferral wiring is untested, because the unit tests never have a host, socreate_is_serialized()is always false. A stub-gate test (or a seam that lets the test pretend a create is in flight) would cover it; the same applies to the re-wake branch at:830.Two more things:
now()/masked_forcan runp.make()synchronously on the draw thread, but onlymake.rs:765and:836callAVAILABLE.notify_all(), so workers parked on a slow-only queue can sleep until the next enqueue. Notifying on gate release would close that.python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdpasses on main alone but fails after merging this branch, missingLEONIDA_PIPELINE_CREATE_LOCK. The PR adds the switch and its row is absent from the merged tree.The AMD crash itself cannot be reproduced here (no AMD GPU and no title data), so that half rests on the reporters' hardware logs — the code-level evidence above is what this box can check.
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-12-01T18:25:50Z.
@KelboLive Addressed in
163660640(after mergingmain, no rebase/force-push):d3d12/docs/switches.mdviapython -I tools/d3d12_switches.py --out d3d12/docs/switches.md(--checkpasses;LEONIDA_PIPELINE_CREATE_LOCKis now documented).notify_create_idle()invoked fromCreateGuard::drop()wheneverCREATINGis released (after droppingCREATING.stateso lock order staysQUEUE->CREATING.state), waking parked workers even after synchronous draw-thread creates (now()/masked_for).create_busy()to checkCREATING.is_busy()directly (avoiding callinghost()while holdingQUEUE.lock()), removed the now-redundant worker-loop wakeup branch, and addednext_defers_slow_while_create_gate_held_and_wakes_on_releaseto pin both deferral and gate-release wakeup.cargo test --locked -p leonida-gpu --lib pipeline(42 passed, 0 failed, 8 ignored),tools/d3d12_switches.py --check, andpython -I scripts/check_no_game_data.py(clean).AI-assisted: Gemini 4 Neon (including an independent read-only reviewer pass).
Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T00:35:24Z.
VERIFY-2694 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game files
Verdict: PASS. The gate's logic is right, nothing that passed before fails now, and the new tests pass. Two properties of the design are worth the author's attention, though neither is a defect.
Head
16366064, base the currentmain85ec1d33, merge base27613ab6, 3 files, +288/−5:d3d12/crates/leonida-gpu/src/pipeline/library.rs,d3d12/crates/leonida-gpu/src/pipeline/make.rs,d3d12/docs/switches.md.1. What it changes
Concurrent
Create*PipelineStatecalls crash AMD's driver compiler (0xc0000005/0x887A0020insideamdxc64.dll), while the DXIL translation itself can stay parallel. The pull request puts the driver's calls behind a priority-ordered mutex, so an activeScreenorRequesteddraw does not sit in line behind queued backgroundEarlyorSlowprecompiles:A waiter goes in only when the gate is free and no waiter of a higher priority is queued; the priority itself is a thread-local with a reset guard (
with_create_priority), so the code that makes a pipeline says which kind it is. The gate is used only whenshould_serialize_createsays so — by default on AMD (VendorId == 0x1002), overridable withLEONIDA_PIPELINE_CREATE_LOCK=0|1.2. What I checked
CreateGuard'sDropsetsbusy = false, notifies all, and — when the guard is the globalCREATINGgate — callssuper::make::notify_create_idle(), so the "creation in progress" bookkeeping is cleared on the same path that frees the gate.state.waiting[..p]is the higher priorities (the enum ordersScreen = 0as most urgent), so aScreenwaiter ignores lower ones ✓ and aSlowwaiter yields to any queuedScreen/Requested/Early✓.should_serialize_createreadsLEONIDA_PIPELINE_CREATE_LOCKfirst ("0"→ off,"1"→ on), and otherwise serializes only on AMD's vendor id ✓.create_is_serialized()reads it once into aOnceLockand logs which adapter it saw ✓.create_busy()reads the gate directly rather than askingcrate::host::host(), because the callers holdQUEUE— the comment says so and the code does it ✓.3. Two properties worth stating in the pull request
Neither is a defect, and the author may well have them in mind:
Slowwaiter proceeds only when noScreen/Requested/Earlywaiter is queued, so a steady stream of screen-priority creations can keep the background precompiles waiting indefinitely. That is the point of the change ("active draws never sit in line behind queued background precompiles"), but the other side of it is that the background work may never finish while the game is busy. Whether that matters is a property of a run with the game.notify_allplus a priority-only test, so among waiters of the same priority the order is not FIFO — a late arrival can take the gate before an earlier one.4. What the tests do here
leonida-gpudoes not build on Linux (upstream: "The crates are Windows-only today … Linux follows #2577"), so I cross-compiled it forx86_64-pc-windows-gnuand ran the tests under Wine 11.21.The red side (the merge base with only this pull request's tests) does not compile — the new test uses
CreatePriority, which the change introduces — so the base and the head were compared:watchtests that need Microsoft'sVirtualAlloc/VirtualQuerybehaviour, which Wine does not have5. What I did not check
Create*PipelineStatefaults insideamdxc64.dllon AMD; that needs an AMD card, and the fault and its fix are not reproducible here.AI-assisted: MiniMax M3.1 Flash.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:18:35Z.
Closing: this pull request no longer applies to current
main(merge conflict ind3d12/docs/switches.md), and open pull requests that have fallen out of step withmainare being closed so the list stays workable. If you still want this change, rebase it on currentmainand reopen it (or open a new pull request); it will be looked at again.AI-assisted (Claude Code).
Pull request closed