D3D12.X: a pipeline build that panics fails like a driver error instead of hanging its waiters #3028
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3028"
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 tiagonleal on 2026-11-27T14:20:56Z.
A pipeline build that panics on a worker thread left its entry "building" forever. Waits without a budget (the submit-time waits) then never returned, the worker thread died so the pool shrank for the rest of the run, and in
build_piecesthe parent'srecvblocked. This PR catches the panic at the three places a build job runs and records the result a failed driver build gives (0), so the existing failed-build path applies: binds get the stand-in pipeline and the run goes on.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:run(job)wraps the job incatch_unwind, logs a rate-limited warning (first 16, then powers of two) and returns 0. Used inbuild, in the bind-side build ofresolve_wait_forand inbuild_pieces. Builds that do not panic are unchanged.crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs: thebuild_wholelock is taken withinto_inneron poison. It guards()and the value is aOnceLock, so nothing can be half-updated; before, one panic made every later build of that chain fail.THIRD_PARTY.mdand the module header: provenance. The idea is adapted from victory-fork (https://github.com/fxceless/victory-fork, GPL-3.0-or-later), commit46da5ee,crates/victory-gpu/src/pipeline/make.rs,Pending::make_with. No code was copied; XCL's version is its own three call sites. Credit for the mechanism goes to Filip Michalski, the author of that commit. Port tracked in #3011.a_panicking_build_fails_and_the_workers_go_on: a panicking build releases its waiter with the stand-in; a second wait on the same pipeline returns at once; aftercompile_threads() + 1more panicking builds a good build still completes on a worker thread (the job reports its thread name); no mutex is left poisoned.Before this change the unwind crossed the title's call on the bind-side path. On a worker it was silent: the only trace was the panic hook's line, and the run looked like a GPU stall.
Tested
RTX 5070 Ti 16 GB (driver 617.42), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, on
main06f90c19.cargo test -j 4 -p xcl --lib pso_async: 15 passed, 0 failed.cargo test -j 4 -p xcl --lib dispatch_chain: 10 passed, 0 failed, 1SKIPPED(no wave64 on this card).runchanged to call the job directly, the new test fails on its 10 s wait and the log shows workerxcl-pso-0dying. Restored afterwards.cargo test -j 6 --workspace --no-fail-fast -- --test-threads=4: 1455 passed, 4 failed, 47 ignored, 25SKIPPEDlines. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState0x8007000E); they fail the same way onmainwithout this change.Regression run
Both runs used
XCL_PREPARE=0and a filledXCL_DXIL_CACHE: with the default cache empty, the startup preparation ofmaindoes not finish inside the 120 s the script allows.main06f90c19:This PR
571aea4c:Not tested
AI use
Claude Code with Claude Fable 5.2 and Anthropic subagents (Claude Opus 5.5, Claude Sonnet 5.5) helped developing with the supervision of @tiagonleal.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T14:57:22Z.
Tested
CPU-only rerun on Windows 11 x64 build 26200.9974, AMD Ryzen 7 3800X, and Rust 1.100.0 MSVC. The pinned libtest executable was built from an archive of
571aea4c08ba62f0e453bd90d110283ace151f49with a single 51-line#[cfg(test)]append topso_async.rs. I verified the original module bytes, fixture append, and executable hash and reused the existing build.Ran each filter in a separate process with
--exact <filter> --test-threads=1 --nocaptureandXCL_PSO_WAIT_MS=0:hle::d3d12x::pso_async::local_bind_panic_tests::a_panicking_lazy_compute_bind_completes_and_the_next_bind_succeeds: the synthetic closure panicked on the binding thread throughresolve_for_bind. The failed entry completed and subsequent binds of that entry returned the stand-in. The next lazy compute job on the same binding thread completed with its expected sentinel value. The fixture bounded completion with a five-second receive timeout.hle::d3d12x::pso_async::used_tests::a_bind_of_a_shared_stand_in_gets_its_driver_pipeline: the unmodified checked-in control passed in the same overlay executable.2 passed, 0 failed, 0 ignored, 0 skipped. Both processes exited 0.
Not tested
Real driver or translator panics, GPU execution, pre-fix behavior, full workspace suite, and retail smoke.
AI use
T3 Code / Codex (
gpt-6.2-sol) wrote the synthetic fixture, verified the pinned artifacts, independently reran both tests, and wrote this report.Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-27T23:39:46Z.
RTX 3060 12 GB, retail title, 300 s: no regression. This PR's head
571aea4cagainstmain2c717a04, one run each, release, warm caches,XCL_ACTIVITY=1 XCL_NETWORK=0, 8 preparation threads, A pressed every 4 s from 20 s.Both exit 0x0 with no device removals or crashes. Frames: 2 198 against 2 234 on
main. Peak commit: 38 494 MB against 38 242 MB. Peak local video memory: 18 979 MB against 18 893 MB. Neither run gets past world load on this card in 300 s, and I didn't check whether a pipeline build panicked in either run. This is a regression check only.Regression run
main:
this PR:
RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200.
AI use: Claude Code (Claude Opus 5.5) built both commits, ran the title and wrote this report.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T02:10:43Z.
merge-check claim
head:
571aea4c08Imported from ivall/xcl. Originally posted by throny on 2026-11-28T02:13:45Z.
merge-check claim
head:
571aea4c08Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T02:17:10Z.
merge-check
base: 753e8b1a (
main)head: 571aea4c
merge: Clean trial merge into current
main, no commit.build:
cargo build --workspace --lockedpassed.tests:
cargo test --workspace --locked --no-fail-fast -- --test-threads=4on the unmodified merge: 1,512 passed, 1 failed, 47 ignored; 25 GPU skip notices. The newa_panicking_build_fails_and_the_workers_go_ontest passed. The sole failure wasconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(DXIL not compiled yet), which also fails with the same message on untouched base753e8b1ain my filtered exact-base control (0 passed, 1 failed).review: The helper returns the existing failed-build sentinel
0after a panic. I checked its three current call sites: worker completion signals waiters, bind-side direct completion returns the stand-in, and split-piece construction receives one result per piece and releases successful pieces if any other piece fails.Chain::wholecan retry after a poisoned build lock because its protected result is aOnceLock. The new checked-in regression covers the worker path, but the PR also says a panicking piece used to strand its parent. A focused test against productionbuild_piecesverifies that distinct path: a panicking piece and a successful piece must return[0, 0x5C5C]within five seconds. On this PR's unmodified implementation plus that test-only addition it passed 1/0/0, no skip. Replacing onlyrun(job)with the oldjob()at the piece call site made the same test fail 0/1/0 (a panicking piece held the parent wait: Disconnected). The collapsed diff below is this test-only addition; it was not pushed. It preserves the existing worker regression.performance: No title build time or frame-rate comparison was run here. The normal build result is unchanged; the warning and failed-build sentinel occur only after an unwind.
verdict: not yet: include the direct
build_piecespanic regression, then rerun the required checks on that head. The implementation passed the focused test and I found no source-level blocker in the changed paths.hardware / tool and model: Windows 11 build 26300, RTX 3080 Ti 12 GiB / NVIDIA 621.35, rustc 1.99.1 MSVC, Windows SDK DXC 1.8.2502.11. OpenAI Codex (GPT-6.2 Sol) performed the merge, source review, native suite, focused positive and negative controls, and report.
Focused test-only diff
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T02:30:24Z.
merge-check
base:
753e8b1ahead:
571aea4c08merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1512 passed, 1 failed, 47 ignored; failing: gpu::recomp::dxc::cache_tests::concurrent_cache_misses_compile_once. That test is in the shader-compile cache, which this PR does not touch, and it failed once yesterday in an unrelated tree on nvidia-dev as well while passing in all others: I read it as a flaky test of the tree, not this PR's (26 SKIPPED lines); base alone: 1512 passed, 0 failed, 47 ignored
review: no blocking finding. Provenance: the commit named in the module header exists in another project and that project is GPL-3.0-or-later; the header note and the THIRD_PARTY.md row have the required form. catch_unwind is used soundly: a job is taken out of its slot before it runs and no XCL lock is held around it, so completion and the building flag are now always settled; before, a panic killed the worker and left waiters hanging, or unwound into the title's thread. Remaining risk, which the PR's own warning names: a mutex inside the job that a panic poisons turns every later build into a stand-in, and each such panic is logged without a rate limit. For whoever merges: #2547 makes the same change in build() (textual conflict and duplicate: one of the two), and #2424 and #1665 conflict textually in the same function.
performance: none unless a panic happens.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K (no SSE4a), Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-28T12:28:11Z.
Closing this because
mainalready has the fix.4755740b("D3D12.X: complete failed pipeline worker jobs", by bmjask, merged with the #2959 stack) addedrun_jobinpso_async.rs. It catches a panicking build, logs it and returns 0. Onmaine429936cthe worker build (run_build), the split pieces (build_pieces) and the rehydrate rebuild all go through it, and I found no production call site that still runs a job bare. TheChain::build_wholelock this PR also handled went away with the split-PSO rework.@thehollowedone the piece regression you asked for exists on
maintoo. Theused_testscase aroundpso_async.rs:8429callsbuild_pieceswith a panicking middle piece and expects[0x11, 0, 0x33]. Unlike your version it has no timeout.The two things this PR still had on top are a rate limit on the panic log and a test that the workers survive. I don't think they justify a PR of their own.
Thanks to throny, thehollowedone and Anon64 for the merge checks and the 3060 run.
AI use: Claude Code wrote this comment (Claude Fable 5.2). Claude Opus 5.5 compared the branch with
main, and the call sites were checked a second time againste429936cbefore closing.Pull request closed