D3D12.X: catch panics in async PSO builds so waiters and workers do not stall #2053
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2053
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2053"
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?
@RandomGithub12309 on GitHub · 2026-11-25 02:10 UTC · original
RandomGithub12309:d3d12x/pso-async-catch-panics→main· +192 −18 · 1 files · 1 commits · opendxc::pool()wraps HLSL compilation instd::panic::catch_unwindso a panicking compile cannot kill a DXC worker or hang its caller, butpso_asyncran each pipeline's full shader translation and D3D12 PSO build closure without panic recovery or RAII cleanup:xcl-pso-*orxcl-pso-pre-*worker killed the worker thread permanently and skippedcomplete(p, 0), leaving*p.done == falseforever so waitingresolve_waitcalls deadlocked onp.cv.wait(withHELDelevated indefinitely) andBUILDING/p.demand.preload_threadremained stale.resolve_wait_forskippedcomplete(&p, 0)(deadlocking concurrent waiters) and unwound toward theextern "system"SetPipelineState/ClearStateCOM vtable hooks.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:run_job()wrapping eachJobinstd::panic::catch_unwind(AssertUnwindSafe(job)), logging the panic payload viaxlog_error!and returning0socomplete()incrementsFAILED, marks*p.done = true, and wakes waiting binds with the stand-in pipeline.BuildGuardinbuild()that clearsp.demand.preload_thread, restoresTHREAD_PRIORITY_LOWESTwhen boosted, and clearsBUILDINGbeforecomplete()notifies waiters.build()) and inline bind builds (resolve_wait_for()) throughrun_job().pso_async::used_tests(all three fail before the fix and pass after):a_panicking_worker_build_wakes_waiters_and_keeps_workers_alivea_panicking_preload_build_restores_state_and_keeps_preloaders_alivea_panicking_inline_bind_build_does_not_unwind_or_hang_waitersTested
Hardware: Windows 11 (Build 26300), Intel Core Ultra 7 255HX, NVIDIA GeForce RTX 5050 Laptop GPU (wave32-only, driver 32.0.16.2114),
rustc 1.100.0 (0ef1bc386 2026-11-09)stable-x86_64-pc-windows-msvc, Windows SDK DXC1.8.2502.11.cargo test -p xcl --lib hle::d3d12x::pso_async::used_tests::a_panicking -- --test-threads=1→0 passed; 3 failed(worker threads died and waiters timed out; inline builder unwound).ea16145):cargo test -p xcl --lib hle::d3d12x::pso_async -- --test-threads=4and-- --test-threads=1→9 passed; 0 failed; 0 ignored.cargo build --workspace→ succeeded.cargo test --workspace -- --test-threads=4 --skip fuzz_validate_and_gpu:xcllib:1083 passed; 0 failed; 26 ignored; 4 filtered out(gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}, pre-existing RTX 500x8007000Efailure tracked by #1905);24 SKIPPEDlines printed inside passing tests (20 wave64 / no-wave64 sub-cases, 3 wave32 per-lane refused sub-cases, 1pso_measurement_compiles_an_exact_synthetic_recorddue to Developer Mode being off).49 passed; 0 failed; 20 ignored(1 SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsingpu_compute_e2e).1132 passed; 0 failed; 46 ignored; 4 filtered out(25 SKIPPEDnotices).Regression run
Baseline (
upstream/main):PR head (
ea16145):Not tested
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}(#1905), andpso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode not enabled on this host).AI use
Antigravity (Gemini 4 Neon) identified the missing panic recovery and RAII cleanup in
pso_async.rs, wrote the fix and regression tests, ran the test suite and smoke runs, and drafted this PR description.@raylitebull on GitHub · 2026-11-25 02:14 UTC · original
Code review on
ea16145:run_job(catch_unwind) and movingpreload_thread/ thread-priority /BUILDINGTLS cleanup into RAIIBuildGuard::dropincrates/xcl/src/hle/d3d12x/pso_async.rsguarantees panicked worker, preload, and inline builds still callcomplete(p, 0), wake all waiters with the stand-in, and keep pool threads alive.compile_threads() + 2, preload priority/TLS restoration, and concurrent inline waiters cleanly.Build and testis running; oncePR descriptionpasses, verified on both vendors, and marked ready for review, this looks very solid.@JJAutoCompare on GitHub · 2026-11-25 02:38 UTC · original
PR #2053 compatibility verification
Tested
ea16145a4694f0b05a3b00bd76e8ccd973d384bcon STOR-WINLAB with a clean detached checkout. All three async PSO panic tests passed. The workspace suite finished with 28 failures.Environment
32.0.101.9175.DoublePrecisionFloatShaderOps=0, wave range 8–32, andd3d12SDKLayers.dllabsent.rustc 1.100.0 (0ef1bc386 2026-11-09). Unoptimized Cargo profiles with debug info and incremental compilation disabled. Build and temporary files were underL:\XclTooling\neon-slot-6.PATHvia$env:LOCALAPPDATA\XclTooling\dxc-1.9.2609\bin\x64. XCL's DLL loader selected the Windows SDK's DXC/DXIL 1.9.2602.17, as recorded in the suite log. The results reflect that DLL selection.Tested
cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the Arc lock.cargo test -p xcl --lib pso_async::used_tests::a_panicking -- --nocapturereported 3 passed, 0 failed, 0 ignored, and 0SKIPPEDlines. All three also passed in the workspace suite.a_panicking_worker_build_wakes_waiters_and_keeps_workers_aliveverified stand-in fallback, waiter wakeup, failed-job accounting, and a successful follow-up job.a_panicking_preload_build_restores_state_and_keeps_preloaders_aliveverified stand-in fallback, cleared preload thread state, and a successful low-priority follow-up build.a_panicking_inline_bind_build_does_not_unwind_or_hang_waitersverified that the inline caller and concurrent waiter both returned the stand-in.cargo test --workspace --no-fail-fast -- --test-threads=4run underInvoke-ArcTest.ps1exited 101.RUST_TEST_NOCAPTURE=1exposed skip notices from the test harness. The combined output is inpr2053-suite.log.xcl src/lib.rsxcl src/main.rstests/bcpack_parity.rstests/console_dlls_e2e.rstests/console_shaders.rstests/disasm_e2e.rstests/e2e.rstests/gpu_compute_e2e.rstests/gpu_pso_e2e.rstests/heap_probe.rstests/low_va.rstests/pls_quota.rstests/predication_e2e.rstests/rpf_e2e.rstests/shaders_e2e.rstests/sparse_reinit.rstests/texture_states.rstests/xg_oracle.rsxcl-testtitle src/main.rsxcl doctestsThe log contains 27 lines beginning with
SKIPPED. The library emitted 24 (19 unavailable wave64 cases, three refused wave32 per-lane lowering cases, one tiled-resource tier below 2, and one inability to disable the driver cache). The integration binaries emitted three (two missing D3D12 debug-layer checks and one unavailable heap-window case). These lines include subcases. Cargo's pass totals also include early returns for unsetXCL_SAMPLE_*variables. Those skipped paths provide no coverage.Failures
All 27 library failures are unrelated to the changed async PSO path by code inspection. The GPU shader tests use the test runner's direct D3D12 calls. No baseline run was performed.
22 tests received
0x80070057from nativeCreateComputePipelineState. The Arc reports no FP64 shader support, which is relevant to the double-precision cases. The HRESULT alone cannot establish the cause of every rejection.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3gpu::dxil::ops_tests::doubles_match_cpugpu::dxil::ops_tests::groupshared_barrier_and_atomics_rungpu::dxil::round_tests::gpu_direct_f32_round_modes_dynamic_and_denormalsgpu::dxil::round_tests::gpu_direct_f32_round_modes_staticgpu::dxil::round_tests::gpu_direct_f32_round_preserved_denormal_times_inf_is_infgpu::dxil::round_tests::gpu_frexp_exp_f32_denorm_with_directed_roundinggpu::recomp::lower_dxil::tests::f64_programs_on_the_gpugpu::recomp::tests::gpu_clamp_and_omod_per_instructiongpu::recomp::tests::gpu_f64_class_comparegpu::recomp::tests::gpu_f64_compares_with_nangpu::recomp::tests::gpu_f64_literal_high_wordgpu::recomp::tests::gpu_f64_math_randomgpu::recomp::tests::gpu_f64_rootsgpu::recomp::tests::gpu_f64_rounding_and_conversionsgpu::recomp::tests::gpu_float_compares_randomgpu::recomp::tests::gpu_frexp_f64_exp_and_mantgpu::recomp::tests::gpu_ldexp_f64gpu::recomp::tests::gpu_rndne_f64Five shader output mismatches
gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction(fused FMA overflow control).gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips(pixel value 25.609375, expected 26).gpu::recomp::tests::gpu_split_wave64_reduction_tails(split-wave minimum).gpu::recomp::tests::gpu_valu_16_and_64_bit(v_add_f16high half).gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions(pixel-wave min/sum and waterfall read).One integration failure
test_title_runs_and_game_folder_is_untouchedreached the end of the bundled test title with one failed check.RSSetDepthBiasX(-1000.5)left the top-right pixel blue instead of green. This appears unrelated to the panic fix because the failing check uses PC shader bytecode and native dynamic depth bias. A baseline run would be needed to establish whether the failure predates the PR.Not tested
No retail Xbox title or retail shader-pack input, no D3D12 debug-layer validation, no
mainregression smoke run, and no GPU other than this Arc A770. XCL's loading and use of the standalone DXC/DXIL 1.9.2609.5 DLLs were outside the observed run.AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against
pr2053-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 04:41 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Royalflamejlh on GitHub · 2026-11-25 07:04 UTC · original
Linux (Wine + vkd3d-proton) + NVIDIA test of
ea16145merged onmainaaa0936with #684: its 9pso_asynctests pass under Wine, the three new panic tests among them. In 3 runs of the title no pipeline build panicked, so the change's recovery path was not exercised there. The threads that died in these runs, with the change and without it, died of stack overflows, which are not panics and whichcatch_unwinddoes not catch.Setup: Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, RTX 4070 12 GB (driver 615.71.09). Release, cross-compiled to
x86_64-pc-windows-gnu. Title runs:XCL_DIRECT_DXIL=1,XCL_PSO_PRELOAD=0,XCL_SKIP_BINK=1, XCL's driver blobs absent and NVIDIA's disk cache off,WINEDEBUG=err+all,fixme-all, 100 s; retail title 1.0.2.1, the first-run screens completed once and no story progress. The runs without it were made 3 hours earlier, so their DXIL cache held fewer translated shaders.Tested
aaa0936+ #684 (2 runs)ea16145(3 runs)panicked at; with the change alsopanic while building pipeline)virtual_setup_exception stack overflowon a 2 MB threaddriver compile start #44: compute PSO, 322160 B DXILand never logged its finish; the other five overflowing threads logged nothing in XCL's log. Their stacks were 2 MB, where thexcl-pso-*workers get 64 MB (stack_size(64 << 20)inpso_async.rs): a pipeline build died on another thread, by an overflow rather than a panic.core::fmt::writeinside XCL's binary; these runs do not show what used up the stack. #1805 (fixed on XCL's side by #1860, open, not in this tree) is a known overflow of direct-backend pipelines under Wine.Not tested: a build that panics in a title run; Windows; AMD and Intel.
AI use: Claude Code read the diff, built the trees, ran the title and the tests, and wrote this comment: Claude Fable 5.2 for the earlier part (the tests and the two runs without the change at least), Claude Opus 5.5 for the writing; the session changed model during the work.
Posted without review by a person: the account owner was away and reads replies later.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.