D3D12.X: handle a disconnected PSO worker queue #2816
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2826"
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 ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T15:18:38Z.
Part of #2787. The admission change follows bmjask’s
0eaef7e6. The review case showed that a bounded bind could otherwise keep getting the stand-in after the regular worker queue closed.What is in it
Tested
b610d29e92a1b65846fee5abebf6d085fce8c97bon8b957bec6f82495aec940944c6bf47faa02db590. Windows 11 25H2 build 26200.9974, Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, DXC 1.8.2502.11, debug.cargo test --offline --locked -p xcl --lib -j 2 a_disconnected_regular_queue_ -- --test-threads=1 --nocapturepassed 2/2, with no capability skips. Injected disconnects covered retrying the first job on one replacement, later reuse, no duplicate sends, no late flag during a concurrent bounded wait while admission is pending, and a later unlimited bind after replacement fails.cargo build --offline --locked -j 2 --workspacepassed.cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --show-outputreported 1,448 passed, 0 failed, 47 ignored across 38 harnesses. The pass count includes 29 explicit capability skips and 10 separate unset optional sample messages.Regression run
Matched retail smoke is pending for the rebased head. Anon64’s prior-head pair tested
ec140e852be1ee06ac10c9f0c2930a7335ae8087for 60 seconds and reported 99% of baseline frames, 96% of peak commit, and zero crashes or device removals.Not tested
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T15:32:46Z.
Review: COMMENTED
AI-assisted review (OpenAI GPT-6). I traced the disconnected-queue path in this diff; I did not run tests or the game.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-26T15:56:46Z.
Regression run of
ec140e8on a newer retail title: no device removal, no crash, frames and commit within the limits.Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of this PR's base
e120925and of its exact head, run back to back,scripts/smoke.ps1 -Game <title>for 60 s withXCL_NETWORK=0and A pressed every 4 s from 20 s.base:
this PR:
99 % of the base's frames, 96 % of its peak commit. One run each.
Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD.
AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-26T15:32:46Z.
Code review location:
crates/xcl/src/hle/d3d12x/pso_async.rs; line 1198If the regular worker channel is disconnected and
XCL_PSO_WAIT_MSis set, this returns the stand-in while leavingp.jobuntouched. Since this PR says the regular channel cannot reopen, subsequent bounded binds take the same branch, and this compute PSO can remain a no-op indefinitely unless some separate unlimited bind happens to take the job. Could this path run the retained job or hand it to a guaranteed fallback before returning the stand-in? AI-assisted review (OpenAI GPT-6); I checked the bounded and unbounded resolve paths in this diff and did not run tests or the game.Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T16:20:20Z.
Wine / RDNA4 check of the updated queue recovery, including a real replacement worker building native PSOs.
Tested
b610d29e92a1b65846fee5abebf6d085fce8c97bagainst main8b957bec6f82495aec940944c6bf47faa02db590.8293130ebe370b1+(local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, releasex86_64-pc-windows-gnu.cfg(test)fixtures and a typed, thread-local send-injection hook. With no injected sender, the hook delegates to each revision's regular send path. No original assertion or admission/completion condition was changed by the overlay. Removing it reconstructs the pinned source hashes.XCL_NETWORK=0,XCL_ASYNC_PSO=1, one DXC worker and private enabled caches. The native input is our own no-op HLSL shader, identical 2,044-byte DXIL in all nine native processes.Original tests
Both updated
a_disconnected_regular_queue_*tests plus five neighboring bind/wanted/budget tests, with one and four test threads:Native admission probe
Three fresh processes per revision, with healthy admission, a final injected send refusal, and an image-only resolve called while the send callback is still in progress:
lateafter refused admissionlateinside the in-progress send callbacklateafter the healthy queue's ordinary wait expiresEach case makes exactly one send attempt, performs no inline build during the bounded call, and later completes exactly one actual RX 9070 compute PSO through the admitted callback or an unlimited bind. The head probe passes 1/0/0 in each process. Main's final admission assertion fails 0/1/0 in each process, after all three native controls and object cleanup have completed.
Replacement worker, current head
A separate local test uses
RegularWorkersand the unchangedstart_regular_workerto recover a closed queue. Three fresh processes, 1/0/0 each:xcl-pso-workflow-replacementbuilds both the rejected first job and a later job. Both job bodies assert that thread name; neither compiles on the bounded bind thread. Exactly one replacement-start attempt and two native PSO builds.Across the paired admission probe and replacement tests, all 30 PSOs were constructed successfully on PCI 1002:7550 and exported a nonempty 112-byte driver blob. This checks construction/export, not acceptance of a supplied cache blob. All 13 top-level summaries, queue/job counters, thread names, DXIL/blob bytes, source inventories and executable hashes were independently checked. No runtime skips or ignored tests.
Build:
cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run. Original selectors underhle::d3d12x::pso_async::used_tests::, passed together with--exact --nocapture --test-threads=1/4:Local selectors under
hle::d3d12x::pso_async:::workflow_queue_admission_recovers_native_pipelinesandworkflow_replacement_worker_builds_native_pipelines, each exact/serial under GE-Proton Wine. InheritedXCL_*flags are cleared before the explicit settings.Not tested
Actual OS refusal to start a thread, work accepted before its receiver exits, preload/contending-waiter stress, scheduling delays under load, GPU dispatch or output, retail inputs,
scripts/smoke.ps1, full suite, native Windows, other GPUs, performance or FPS. The first probe injects the final send outcome; the separate replacement test exercises the actual replacement-start function.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed both revisions, reran after the material head update, added the local synthetic fixtures, verified the evidence and drafted this report. Publication authorized by the account owner.
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T16:36:34Z.
Code review location:
crates/xcl/src/hle/d3d12x/pso_async.rs; line 1198The follow-up at
b610d29e92a1b65846fee5abebf6d085fce8c97bgives a rejected send one replacement worker. Bounded binds keep their time budget and leave compilation on that worker. If the OS declines to start it, the job stays pending for an unlimited bind or an existing preload worker.An independent RX 9070/Wine check at this exact head exercised the real replacement-start function in three fresh synthetic processes. In each, one worker built the rejected first job and a later job. The simulated starter refusal preserved both jobs, which later built once each through unlimited binds. Across the admission and replacement probes the tester constructed 30 native PSOs and exported nonempty driver blobs. The focused probes had no capability skips. Independent results and limits
Imported from ivall/xcl. Originally posted by MatyEjsr on 2026-11-26T19:16:40Z.
Independent Windows/NVIDIA verification and concurrency review of PR #2826 at head
b610d29e92a1b65846fee5abebf6d085fce8c97b(cleanly rebased ontoorigin/main8b957bec6f82495aec940944c6bf47faa02db590,MERGEABLE, no duplicate PRs or superseding changes onmain/nvidia-dev; other open PRs touchingpso_async.rs(#628, #828, #889, #899, #1113) cover separate scheduling, preloading, or logging changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17, debug (test suite) and release (xclbuild)cargo build --release -p xcl -j 8: passed (40.58 s)cargo build --workspace -j 8: passed (7.68 s)cargo test -p xcl --lib -j 8 pso_async -- --test-threads=1 --nocapture: 16 passed, 0 failed, 0 ignored (1331 filtered out, 1.19 s, 0 capability skips), includinga_disconnected_regular_queue_reuses_one_replacement_workeranda_disconnected_regular_queue_keeps_the_job_for_an_unlimited_bindcargo test -p xcl --lib -j 8 pso_async -- --test-threads=8: 16 passed, 0 failed, 0 ignored (1331 filtered out, 0.61 s, 0 capability skips)cargo test --workspace -j 8 --no-fail-fast -- --test-threads=8 --show-output: 1448 passed, 0 failed, 47 ignored across 38 test harnesses (exit 0); the pass total includes 28SKIPPEDcapability checks (21no wave64, 3 wave32 per-lanef16/V_CVT_F16_F32refusals, 3 missing D3D12 debug layer /d3d12SDKLayers.dll, 1no heap windows) plus 10 unsetXCL_SAMPLE_*notices, none counted as passing coverage.Review notes (
crates/xcl/src/hle/d3d12x/pso_async.rs)RegularWorkers::sendretries a rejectedmpsc::Sender::sendonce on a fresh(sender, receiver)channel and reuses that replacement worker for later jobs;send_to_workerswraps the replacement receiver in a newArc<Mutex<mpsc::Receiver<Work>>>(avoiding a poisoned original mutex) and drops rejectedWorkclosures after releasingqueue().enqueue_onserializes first submission withcompare_exchange(Unsent -> Sending)and publishesRegularQueue::Disconnectedunderp.done.lock()beforep.cv.notify_all(), closing the lost-wakeup race inresolve_within.resolve_withinsubtracts elapsed admission time from the wait budget and gatesp.lateonRegularQueue::Sent;resolve_sparedalso checksRegularQueue::Sentbefore markingp.late.submit_as,resolve,resolve_within, andresolve_sparedroute throughenqueue, whilebuild_piecesandneed_by_submitroute throughsend_to_workersso they share the single-replacement worker path.Not tested
scripts/smoke.ps1pair (8b957becvsb610d29e): on merge-base8b957bec, startup shader preparation (prepare_for_launchwithp.max_dxil = 0on uncached compute pipelines) exceeded the default 180 ssmoke.ps1deadline (-Seconds 60, default-StartupTimeoutSeconds 120), so no paired retail smoke block was captured on this machine.AI use
Pull request closed