D3D12.X: a long PC call pauses the GPU wait watchdog only up to a cap #3305
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3305"
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 grahamster2 on 2026-11-29T06:54:35Z.
wait_expiredresets an armed bridged GPU wait's clock on every watchdog tick whilepso_async::title_held()is true. A hold can depend on the very GPU wait it pauses, and then the title freezes for good. Seen on an RTX 3080 in a retail title (stacks from an external sampler): a title thread inexecute_indirect→ split →CreateCommandListwas blocked in the NVIDIA driver (D3DKMTDestroyAllocation2) waiting on the GPU while holding a D3D12Core lock. The submit thread insideq_execute_command_lists(a PC call, so the title stays held) was blocked on that lock inalloc_pool::reset_list, and the GPU was stuck behind one armed wait that the watchdog never released.The two kinds of hold are now told apart (
pso_async::held_for_build,pso_async::held_by_pc_call). A hold for a pipeline build (a bind or submit waiting for one: theHELDcounter) still pauses the clock for as long as it lasts. A hold by a long PC call, the kind that can wait on the GPU as in the freeze above, pauses it only untilcap_from(new inArmedGpuWait: when the wait was armed, moved on while the title is held for a build, so build-hold time does not use up the cap) + the cap:XCL_HELD_WAIT_CAP_MS, default 20000,0= no cap. After that the wait expires on the normal watchdog timeout, so about 25 s with the defaults. The 20 s default is not tuned on a measurement: nothing here shows it is long enough for every submission whose driver call does a long compile of its own. On a branch from before "fail closed on unproven wait timeouts" the wait was released 25 s after it was armed and rendering resumed. On main an expired wait without a proven cycle stops the title (stop_for_unresolved_wait) unlessXCL_WAIT_TIMEOUT_CONTINUE=1. So on main this cap turns the permanent freeze into that stop, or withXCL_WAIT_TIMEOUT_CONTINUE=1into the release seen in that run. It also means that a PC-call hold longer than the cap (for example a long load that keeps a submission or texture placements going without a frame) now ends in that stop by default, where before it paused the watchdog for as long as it lasted.No issue.
What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:held_for_build()andheld_by_pc_call()(now public);title_held()is their OR, unchanged.crates/xcl/src/hle/d3d12x/list_x.rs:ArmedGpuWait::cap_from;wait_expired/wait_expired_at/take_expired_gpu_waittake both flags, and only the PC-call hold is capped;held_wait_cap()with the pureparse_held_wait_cap(); the PC calls are not looked at while a build hold pauses the clock anyway; a warning (logged at most 8 times) when a wait expires although a PC call holds the title. The existing tests that buildArmedGpuWaitget the new field.README.md:XCL_HELD_WAIT_CAP_MSnext toXCL_WAIT_TIMEOUT_MS/XCL_GPU_WAIT_TIMEOUT_MS, and that past it the wait stops the title unlessXCL_WAIT_TIMEOUT_CONTINUE=1.Instant::now()):wait_expired_a_pc_call_hold_pauses_the_gpu_wait_watchdog_only_up_to_the_capfails without the change (checked by putting back the uncappedif heldreset);wait_expired_a_build_hold_pauses_the_gpu_wait_watchdog_past_the_cap(a build hold never lets a wait expire early, and a PC-call hold after a long build hold gets the whole cap from its end);held_wait_cap_parses_unset_zero_junk_and_a_value.Tested
cargo build --release -p xcl)a0519dfdc862c79d6921cb71dffa76a81c72f9b7:cargo build --workspaceok;cargo test --workspace -- --test-threads=4: 2611 passed, 0 failed, 49 ignoredSKIPPEDlines on this adapter (no wave64 on NVIDIA, no heap windows, no D3D12 debug layer):SKIPPED gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole: no wave64SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windowsSKIPPED hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap: no heap windows (opt-in: XCL_HEAP_WINDOWS=1)SKIPPED the title under the debug layer (dred: false): no d3d12SDKLayers.dllSKIPPED the title under the debug layer (dred: true): no d3d12SDKLayers.dllSKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))xcllib test binary exited with STATUS_ACCESS_VIOLATION (0xc0000005) while GPU tests (gpu::agility,gpu::bvh,gpu::dxil::bitstream) were running, and printed no counts. It did not come back in two lib-only runs then, nor in the whole-suite run above, which passed on its first try.Regression run
scripts/smoke.ps1 -Game <title folder> -Seconds 60 -StartupTimeoutSeconds 900withXCL_DEVICE_TYPE=lockhart XCL_PREPARE=0(Series S mode as in the contributor's runs; no startup shader preparation, so pipelines are built in game) (smoke.ps1 setsXCL_NETWORK=0); same retail title, same settings for both runs. Both stay on the title's first screens (about 660 draws per 2 s) for the 60 s.main:
this PR's head:
Not tested
XCL_WAIT_TIMEOUT_CONTINUE=1on this head.AI use
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T08:22:23Z.
Ran the capped PC-call wait tests at
a0519dfdon an NVIDIA Blackwell desktop part.System
Results
XCL_ADAPTER=NVIDIA cargo test -p xcl --lib wait_expired_a_pc_call_hold_pauses_the_gpu_wait_watchdog_only_up_to_the_cap -- --test-threads=1: 1 passed, 0 failed, 0 ignored.XCL_ADAPTER=NVIDIA cargo test -p xcl --lib wait_expired_a_build_hold_pauses_the_gpu_wait_watchdog_past_the_cap -- --test-threads=1: 1 passed, 0 failed, 0 ignored.XCL_ADAPTER=NVIDIA cargo test -p xcl --lib held_wait_cap_parses_unset_zero_junk_and_a_value -- --test-threads=1: 1 passed, 0 failed, 0 ignored.What this adds
All three new tests pass: a long PC-call hold pauses the GPU wait watchdog only up to the cap, a pipeline-build hold still pauses it past the cap, and the cap parses unset/zero/junk/value inputs. The thread has no comments yet, so this is the first datapoint in it and the first from an RTX 5070 Ti on driver 32.0.16.2140. These are CPU-side timing tests; no title run or device-hang reproduction was attempted here.
Not tested
A retail title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the commands above on this machine and wrote this report; no game data was used.
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T14:59:09Z.
Review (diff read, not a merge-check):
pc_call, and main'sPcCalldoc names "a pipeline built in the call" as one case. The code's own comments give 22–172 s for whole-program and RDNA2 driver compiles, so with a bridged GPU wait armed, a long in-call compile now gets the title stopped after ~25 s, where main waits it out.Suggested verdict: not yet (exempt in-call pipeline builds, or make the cap opt-in).
(Review written with Claude Code, Claude Opus 5.5; the first point was traced in the code.)
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T16:03:13Z.
Test report for #3305 at
a0519dfdc862c79d6921cb71dffa76a81c72f9b7, against its merge-base withmain,fa204595, under Wine on AMD.Tested
experimental-11.0-20261112, stock vkd3d-protonmaster71cae091. Debug build,x86_64-pc-windows-gnu, under Wine. It wasn't run on Windows.cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>.--test-threads=1 <name>): all 3 pass:held_wait_cap_parses_unset_zero_junk_and_a_value,wait_expired_a_build_hold_pauses_the_gpu_wait_watchdog_past_the_cap,wait_expired_a_pc_call_hold_pauses_the_gpu_wait_watchdog_only_up_to_the_cap. 3 passed, 0 failed.--test-threads=2, with--skip gpu::and these six:failed_restore_stops_before_importing_an_unbacked_window,grooming_leaves_a_window_under_1_gib_only_its_hole(both run out of memory here),write_buffer_immediate_on_open_existing_heap_visible_to_cpu,coherent_buffer_sanitizes_console_flags_and_state,serialize_root_signature_strips_console_flags_and_preserves_pc_flagsandexecute_indirect_reads_the_arguments_written_before_it. Under Wine each of the last four ends the process or makes RADV reject later submissions (#3067), so without them the suite reaches its summary:a0519dfd: 1502 passed, 113 failed, 5 ignoredfa204595: 1500 passed, 112 failed, 5 ignoredacphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure(a memory counter). #3305 doesn't touch that code; on this head it passes 5 of 5 alone and inhle::acphal::as a module, and it failed the same way once in the suite of #3386: a flake of tests running side by side, as far as I can tell. Most of the base's failures under Wine aremain's known ones on stock vkd3d-proton: list creation refused (E_INVALIDARG, #175 / #1701) and the tests after it (#3067).Not tested
gpu::tests in the suite runs-p xcl --lib)AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:03:46Z.
merge-check
base:
d0832e614fhead:
a0519dfdc8merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2893 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (list_x.rs +136/-15, pso_async.rs +8/-2, README). Past 20 s a long PC call no longer pauses the GPU wait watchdog, so about 25 s after a wait was armed it expires and main's
stop_for_unresolved_waitstops the title (the PR says so). Findings: (1) some PC calls are the title's own pipeline compiles: the whole-form build on a title thread is held as a PC call (dispatch_chain.rs ~195,whole(true), the default whenXCL_CS_PSO_WAIT_MSis unset) and so isfinish_pso(real.rs ~4996), and main's own comment (dispatch_chain.rs ~339) records a render thread in the driver for over two minutes on a large whole form. A GPU wait armed during such a compile is now stopped at ~25 s, where main paused the watchdog. Leaving title-thread pipeline compiles out of the cap, or measuring them against it, would avoid stopping a title that was only compiling. (2) Every build hold restarts the cap (~2903), so if a bind waits for a build during the freeze the cap never applies (speculative: a worker's driver call stuck behind the same lock). (3) The 20 s default isn't based on a measurement (the PR says so). Fine: thewait_expired_attests use fixed times, build holds behave as before, there's no new lock order, and it's independent of #3306 / #3307.performance: 60 s smoke of a retail title, main
d0832e61vs this merge (56bba02e): 1516 -> 1673 frames shown (110 %; last presents per 2 s: 60 60 60), peak commit 18133 -> 17101 MB, 0 device removals, 0 crashes. This run doesn't show whether a long PC call overlapped a GPU wait, so it doesn't settle finding (1).verdict: not yet: the cap also stops titles whose GPU wait spans a long title-thread pipeline compile (finding 1), which main waited out
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T06:16:16Z.
merge-check claim
head:
a0519dfdc8Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T11:48:09Z.
merge-check claim withdrawn
Our automated merge-check loop claimed this PR and then stopped before posting a check — two loops were running at once and both are now shut down. No check from us is coming, so this claim is void and the head is free for someone else to take.
AI use: an agent posted this withdrawal.
Imported from ivall/xcl. Originally posted by Hurtibabi on 2026-12-01T16:22:46Z.
merge-check
base:
6bfb5c5153head:
a0519dfdc8merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2907 passed, 0 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no d3d12SDKLayers.dll, 2 no heap windows, 1 no D3D12 debug layer, 1 cannot disable the driver cache without Developer Mode); failing: none
review: read the whole diff (list_x.rs, pso_async.rs, README). (1) Confirms Foniass's finding: the cap applies to every
pc_call, and title-thread pipeline compiles register one (real/dispatch_chain.rs:195whole(true),real.rs:5053finish_psowhen not on a build worker). The code's own notes give 22–172 s for such compiles (pso_async.rs:11203,dispatch_chain.rs:339). A bridged GPU wait armed during such a compile now expires about 25 s aftercap_fromandstop_for_unresolved_waitstops the title, where main paused the watchdog for the whole compile. (2) Every watchdog tick with a build hold movescap_fromto now (wait_expired_at), so the cap never applies while some bind waits for a build; if that build is stuck behind the same driver lock as in the described freeze, the freeze stays (not reproduced, reasoned from the code). (3) The 20 s default is not based on a measurement (the PR says so). Fine: the three new tests run and pass here, the fixed-time tests subtract nothing fromInstant::now(), build holds behave as before, no new lock is taken in the watchdog (held_by_pc_callwas already called throughtitle_held). No duplicate found: no open or merged PR makes this change, and #1607 has no group for it. Not tested: no retail title run (Tier 2 smoke) on this merge, the freeze itself, AMD.performance: reasoned, not measured: per watchdog tick the same checks as before (the PC-call lookup is now skipped while a build hold is active), one more
Instantper armed wait. No frame-time or memory cost by default expected; the behaviour change is that a PC-call hold over ~20 s now stops the title.verdict: not yet: the cap also stops titles whose GPU wait spans a long title-thread pipeline compile (finding 1), which main waited out; no retail smoke run on this merge
hardware / tool and model: NVIDIA GeForce RTX 4090 (driver 621.40 / 32.0.16.2140), Intel Core i7-14700K, Windows 11 Pro 10.0.26200.9974, rustc 1.100.1, debug / Claude Code, Claude Opus 5.5 (claude-opus-5-5)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T21:44:36Z.
Code review location:
crates/xcl/src/hle/d3d12x/list_x.rs; line 2905The cap counts from when the wait was armed, so a known, legitimate long run of PC calls without a frame now stops the title by default. The
PcCalldoc in pso_async.rs (~3457) records a retail title placing 16 384 textures in 29 s without a frame. A GPU wait armed near the start of that load stops pausing at 20 s and expires at about 25 s, and withXCL_WAIT_TIMEOUT_CONTINUEunset main callsstop_for_unresolved_wait. A load that used to finish now ends the title.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T21:44:36Z.
Code review location:
crates/xcl/src/hle/d3d12x/list_x.rs; line 2903Build holds stay uncapped and global (
HELDcounts any bind or submit), and any build hold resetscap_fromfor every armed wait, so the targeted freeze can still be permanent. In the described deadlock (a driver call holding the D3D12Core lock while waiting on the GPU), a pipeline worker's Create*PipelineState can block on the same lock. The title bind waiting on it (build_foreground->Held::new()) keepsheld_for_build()true forever. The same happens if any other title thread waits on a build at least once every 20 s:cap_fromkeeps moving and the stuck wait never expires.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T21:44:36Z.
Review: COMMENTED
Review of
a0519dfd: 3 finding(s). 2 are inline. These are on lines outside the diff:crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs:226: A title thread waiting synchronously for a whole-form compute pipeline compile registers apso_async::pc_call(), not aHeldbuild hold, so the new cap applies to what is really a pipeline build. A late giant compile serialized behindreal::huge_compile_turnkeeps the thread inChain::whole(true)past 20 s.held_for_build()is false andheld_by_pc_call()is true, so the armed GPU wait expires at about 25 s andstop_for_unresolved_waitends the title. Before this PR the clock stood for the whole compile, and the PR says build holds stay uncapped.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.