Repository navigation
D3D12-PIPELINE-CREATE-LOCK-AMD: serialize driver PSO creation on AMD - #2694
bobcatchris wants to merge 5 commits into
Conversation
|
Independent native Windows NVIDIA check of I added a local probe that sends eight concurrent requests through
Each 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). |
|
Independent Wine PSO check.
The 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 Synthetic PSO creation only. AI-assisted with OpenAI Codex. |
05c327b to
e201dcd
Compare
|
Native Windows cache persistence check on 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 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). |
|
AMD Wine cache round-trip for #2694 + #2654. I tested 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.
Each combined cold run saved a 3,176-byte |
…IPELINE-CREATE-LOCK-AMD)
On AMD RDNA 3 (RX 7900 XTX, amdxc64.dll 32.0.32029.2010), calling
ID3D12Device::Create{Graphics,Compute}PipelineState / CreatePipelineState
concurrently across the default 10 pipeline worker threads triggers an
access violation in amdxc64.dll (0xc0000005) or DXGI_ERROR_DRIVER_INTERNAL_ERROR
(0x887A0020) even when LEONIDA_LIBRARY_LOCK=1 or LEONIDA_PIPELINE_LIBRARY=0.
Serialize only the final driver Create*PipelineState call under an AMD-only
mutex (VendorId == 0x1002, overridable via LEONIDA_PIPELINE_CREATE_LOCK=0|1)
while keeping all worker threads translating DXIL shaders in parallel.
Other GPU vendors (NVIDIA, Intel, WARP) remain unlocked by default.
AI-assisted: Antigravity (Gemini 4 Neon)
AI-assisted: Antigravity (Gemini 4 Neon)
AI-assisted: Antigravity (Gemini 4 Neon) # Conflicts: # d3d12/crates/leonida-gpu/src/pipeline/make.rs
e201dcd to
1e0e249
Compare
|
Offscreen driver-call check of the pipeline creation gate at AI-assisted with OpenAI Codex. |
KelboLive
left a comment
There was a problem hiding this comment.
Reviewed at 1e0e249f, and also merged onto today's main (the branch is 402 commits behind): merge-tree is clean, the merged tree passes cargo 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 other Create*PipelineState calls are device-init/offline, not worker-concurrent.
Mutations: the vendor guard and the !slow_blocked deferral are both caught. Replacing create_busy() with false in next() (make.rs:775) survives all 40 tests — the deferral wiring is untested, because the unit tests never have a host, so create_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:
- A create held by a draw thread never notifies.
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. - Regenerate the switches page:
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.
|
@KelboLive Addressed in
AI-assisted: Gemini 4 Neon (including an independent read-only reviewer pass). |
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)