Repository navigation
D3D12.X: a pipeline build that panics fails like a driver error instead of hanging its waiters - #3028
tiagonleal wants to merge 2 commits into
Conversation
…waiters A build closure that panicked on a pipeline worker unwound out of `build` before `complete` ran: `done` stayed false, so a submit-time or bind wait without a budget (`resolve_wait_for`) waited forever, and the worker thread died with it, leaving one worker fewer for the rest of the run. A panicking piece in `build_pieces` also left its parent waiting for a result that never came. Every build now goes through `run`, which turns a panic into the failed result (0), so the existing failed-build path applies (the stand-in) and the worker goes on. Builds that do not panic are unchanged. The idea is adapted from victory-fork (xcl-dev#1353, GPL-3.0-or-later); see THIRD_PARTY.md.
The warning for a pipeline build that panicked now follows the file's pattern (the first 16, then powers of two) and says that later builds may fail too when the panic happened holding a lock. The one such lock a build holds across translation and the driver call, a dispatch chain's `build_whole`, guards no data (`whole` is a `OnceLock`), so it now takes the lock back after a panic instead of failing every later build of that chain. The test now checks that a worker takes both the panicking build and the next one, without the test's thread building them, and takes WORKER_SATURATION_LOCK like the other worker tests. The provenance notes name the victory-fork commit (46da5ee) instead of its PR number.
|
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 Ran each filter in a separate process with
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 ( |
|
RTX 3060 12 GB, retail title, 300 s: no regression. This PR's head Both exit 0x0 with no device removals or crashes. Frames: 2 198 against 2 234 on 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. |
|
merge-check claim |
1 similar comment
|
merge-check claim |
|
merge-check Focused test-only diffdiff --git a/crates/xcl/src/hle/d3d12x/pso_async.rs b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@
let _ = (released(bad), released(good));
}
+ #[test]
+ fn a_panicking_piece_does_not_hold_the_parent_wait() {
+ let (tx, rx) = std::sync::mpsc::channel();
+ std::thread::spawn(move || {
+ let result = build_pieces(vec![
+ Box::new(|| -> usize { panic!("synthetic piece build panic") }) as Job,
+ Box::new(|| 0x5C5Cusize) as Job,
+ ]);
+ let _ = tx.send(result);
+ });
+ let result = rx.recv_timeout(std::time::Duration::from_secs(5))
+ .expect("a panicking piece held the parent wait");
+ assert_eq!(result, vec![0, 0x5C5C]);
+ } |
|
merge-check |
|
Closing this because @thehollowedone the piece regression you asked for exists on 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 |
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 [OFFICIAL] Swarm: ports from other GPL-3.0 projects into XCL #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.