D3D12.X: a long PC call pauses the GPU wait watchdog only up to a cap #3305

Open
grahamster2 wants to merge 1 commit from upstream-pr/3305 into main
grahamster2 commented 2026-11-29 06:54:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grahamster2 on 2026-11-29T06:54:35Z.


wait_expired resets an armed bridged GPU wait's clock on every watchdog tick while pso_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 in execute_indirect → split → CreateCommandList was blocked in the NVIDIA driver (D3DKMTDestroyAllocation2) waiting on the GPU while holding a D3D12Core lock. The submit thread inside q_execute_command_lists (a PC call, so the title stays held) was blocked on that lock in alloc_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: the HELD counter) 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 until cap_from (new in ArmedGpuWait: 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) unless XCL_WAIT_TIMEOUT_CONTINUE=1. So on main this cap turns the permanent freeze into that stop, or with XCL_WAIT_TIMEOUT_CONTINUE=1 into 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() and held_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_wait take both flags, and only the PC-call hold is capped; held_wait_cap() with the pure parse_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 build ArmedGpuWait get the new field.
  • README.md: XCL_HELD_WAIT_CAP_MS next to XCL_WAIT_TIMEOUT_MS / XCL_GPU_WAIT_TIMEOUT_MS, and that past it the wait stops the title unless XCL_WAIT_TIMEOUT_CONTINUE=1.
  • Tests (times from a fixed base forward, so nothing is subtracted from Instant::now()): wait_expired_a_pc_call_hold_pauses_the_gpu_wait_watchdog_only_up_to_the_cap fails without the change (checked by putting back the uncapped if held reset); 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

  • NVIDIA GeForce RTX 3080 10 GB, driver 610.88; AMD Ryzen 5 7600X; Windows 11 build 10.0.26200.9974; rustc 1.94.0 (4a4ef493e 2026-03-02); tests in the debug profile, smoke runs on a release build (cargo build --release -p xcl)
  • on a0519dfdc862c79d6921cb71dffa76a81c72f9b7: cargo build --workspace ok; cargo test --workspace -- --test-threads=4: 2611 passed, 0 failed, 49 ignored
  • 29 SKIPPED lines 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 wave64
    • SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64
    • SKIPPED 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 wave64
    • SKIPPED 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 wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
    • SKIPPED 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 wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
    • SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64
    • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
    • SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
    • SKIPPED 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.dll
    • SKIPPED the title under the debug layer (dred: true): no d3d12SDKLayers.dll
    • SKIPPED 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))
  • On an earlier revision of this branch the first run of that command stopped early once: the xcl lib 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 900 with XCL_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 sets XCL_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:

xcl-smoke v1
commit: fa204595a488c60c6c5f905244f0172072c9c2a9
gpu: NVIDIA GeForce RTX 3080
title: 5d6132ca
seconds: 60
exit: 0x0
frames shown: 1680 (PresentX 1680)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 12321 MB

this PR's head:

xcl-smoke v1
commit: a0519dfdc862c79d6921cb71dffa76a81c72f9b7
gpu: NVIDIA GeForce RTX 3080
title: 5d6132ca
seconds: 60
exit: 0x0
frames shown: 1675 (PresentX 1675)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 12233 MB

Not tested

  • The freeze itself was not reproduced on this PR's head commit. The 25 s release was seen on an older branch, before main's fail-closed wait timeout. The 60 s smoke run stays on the title's first screens and does not reach this freeze.
  • PC-call holds longer than 20 s in long loads: not seen in the smoke run; with this change such a hold ends in the stop on main (default), which no run here exercised.
  • AMD GPUs, other titles, and XCL_WAIT_TIMEOUT_CONTINUE=1 on this head.

AI use

  • Claude Code with Claude Opus 5.5: wrote the code and tests, ran the tests and smoke runs, drafted this description. A separate Claude Code agent that did not write the change reviewed the diff adversarially and its findings were fixed before opening.
<!-- greyfinch-sync:ivall/xcl:issue:5548423839 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305). Originally posted by [grahamster2](https://github.com/grahamster2) on 2026-11-29T06:54:35Z. --- `wait_expired` resets an armed bridged GPU wait's clock on every watchdog tick while `pso_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 in `execute_indirect` → split → `CreateCommandList` was blocked in the NVIDIA driver (`D3DKMTDestroyAllocation2`) waiting on the GPU while holding a D3D12Core lock. The submit thread inside `q_execute_command_lists` (a PC call, so the title stays held) was blocked on that lock in `alloc_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: the `HELD` counter) 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 until `cap_from` (new in `ArmedGpuWait`: 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`) unless `XCL_WAIT_TIMEOUT_CONTINUE=1`.** So on main this cap turns the permanent freeze into that stop, or with `XCL_WAIT_TIMEOUT_CONTINUE=1` into 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()` and `held_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_wait` take both flags, and only the PC-call hold is capped; `held_wait_cap()` with the pure `parse_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 build `ArmedGpuWait` get the new field. - `README.md`: `XCL_HELD_WAIT_CAP_MS` next to `XCL_WAIT_TIMEOUT_MS` / `XCL_GPU_WAIT_TIMEOUT_MS`, and that past it the wait stops the title unless `XCL_WAIT_TIMEOUT_CONTINUE=1`. - Tests (times from a fixed base forward, so nothing is subtracted from `Instant::now()`): `wait_expired_a_pc_call_hold_pauses_the_gpu_wait_watchdog_only_up_to_the_cap` fails without the change (checked by putting back the uncapped `if held` reset); `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** - NVIDIA GeForce RTX 3080 10 GB, driver 610.88; AMD Ryzen 5 7600X; Windows 11 build 10.0.26200.9974; rustc 1.94.0 (4a4ef493e 2026-03-02); tests in the debug profile, smoke runs on a release build (`cargo build --release -p xcl`) - on `a0519dfdc862c79d6921cb71dffa76a81c72f9b7`: `cargo build --workspace` ok; `cargo test --workspace -- --test-threads=4`: 2611 passed, 0 failed, 49 ignored - 29 `SKIPPED` lines 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 wave64` - `SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64` - `SKIPPED 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 wave64` - `SKIPPED 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 wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64` - `SKIPPED 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 wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: f64, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64` - `SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64` - `SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` - `SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` - `SKIPPED 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.dll` - `SKIPPED the title under the debug layer (dred: true): no d3d12SDKLayers.dll` - `SKIPPED 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))` - On an earlier revision of this branch the first run of that command stopped early once: the `xcl` lib 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 900` with `XCL_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 sets `XCL_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: ``` xcl-smoke v1 commit: fa204595a488c60c6c5f905244f0172072c9c2a9 gpu: NVIDIA GeForce RTX 3080 title: 5d6132ca seconds: 60 exit: 0x0 frames shown: 1680 (PresentX 1680) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 12321 MB ``` this PR's head: ``` xcl-smoke v1 commit: a0519dfdc862c79d6921cb71dffa76a81c72f9b7 gpu: NVIDIA GeForce RTX 3080 title: 5d6132ca seconds: 60 exit: 0x0 frames shown: 1675 (PresentX 1675) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 12233 MB ``` **Not tested** - The freeze itself was not reproduced on this PR's head commit. The 25 s release was seen on an older branch, before main's fail-closed wait timeout. The 60 s smoke run stays on the title's first screens and does not reach this freeze. - PC-call holds longer than 20 s in long loads: not seen in the smoke run; with this change such a hold ends in the stop on main (default), which no run here exercised. - AMD GPUs, other titles, and `XCL_WAIT_TIMEOUT_CONTINUE=1` on this head. **AI use** - Claude Code with Claude Opus 5.5: wrote the code and tests, ran the tests and smoke runs, drafted this description. A separate Claude Code agent that did not write the change reviewed the diff adversarially and its findings were fixed before opening.
Aniseto commented 2026-11-29 08:22:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-29T08:22:23Z.


Ran the capped PC-call wait tests at a0519dfd on an NVIDIA Blackwell desktop part.

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40)
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5
  • Build: debug

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.

<!-- greyfinch-sync:ivall/xcl:comment:7253062358 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7253062358). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-29T08:22:23Z. --- Ran the capped PC-call wait tests at `a0519dfd` on an NVIDIA Blackwell desktop part. **System** - GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40) - CPU: Intel Core i5-12400F, 64 GB RAM - OS: Windows 11 Pro build 26200 x64 - Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5 - Build: debug **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.
Foniass commented 2026-11-29 14:59:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T14:59:09Z.


Review (diff read, not a merge-check):

  • The 20 s cap also applies to pipeline compiles done inside a PC call. It applies to every pc_call, and main's PcCall doc 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.
  • The 20 s default is untuned, by the PR's own description. Its tests and smoke ran before #2499 / #2698 landed.

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.)

<!-- greyfinch-sync:ivall/xcl:comment:7257728701 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7257728701). Originally posted by [Foniass](https://github.com/Foniass) on 2026-11-29T14:59:09Z. --- Review (diff read, not a merge-check): - **The 20 s cap also applies to pipeline compiles done inside a PC call.** It applies to every `pc_call`, and main's `PcCall` doc 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. - The 20 s default is untuned, by the PR's own description. Its tests and smoke ran before #2499 / #2698 landed. 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.)
ClosetPie107 commented 2026-11-30 16:03:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T16:03:13Z.


Test report for #3305 at a0519dfdc862c79d6921cb71dffa76a81c72f9b7, against its merge-base with main, fa204595, under Wine on AMD.

Tested

  • RX 9070 16 GB (RDNA4), Mesa 26.3.1 RADV, Ryzen 5 9600X, CachyOS; Proton Experimental experimental-11.0-20261112, stock vkd3d-proton master 71cae091. Debug build, x86_64-pc-windows-gnu, under Wine. It wasn't run on Windows.
  • Command: cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>.
  • The PR's new tests, each alone (--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.
  • The lib suite at --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_flags and execute_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:
    • #3305 a0519dfd: 1502 passed, 113 failed, 5 ignored
    • base fa204595: 1500 passed, 112 failed, 5 ignored
  • The only test failing on #3305 and not on the base is acphal::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 in hle::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 are main's known ones on stock vkd3d-proton: list creation refused (E_INVALIDARG, #175 / #1701) and the tests after it (#3067).

Not tested

  • native Windows
  • NVIDIA
  • the gpu:: tests in the suite runs
  • the workspace's other crates and integration tests (only -p xcl --lib)
  • a game run (no regression block)

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7284037803 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7284037803). Originally posted by [ClosetPie107](https://github.com/ClosetPie107) on 2026-11-30T16:03:13Z. --- Test report for #3305 at `a0519dfdc862c79d6921cb71dffa76a81c72f9b7`, against its merge-base with `main`, `fa204595`, under Wine on AMD. **Tested** - RX 9070 16 GB (RDNA4), Mesa 26.3.1 RADV, Ryzen 5 9600X, CachyOS; Proton Experimental `experimental-11.0-20261112`, stock vkd3d-proton `master` `71cae091`. Debug build, `x86_64-pc-windows-gnu`, under Wine. It wasn't run on Windows. - Command: `cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>`. - The PR's new tests, each alone (`--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.** - The lib suite at `--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_flags` and `execute_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: - #3305 `a0519dfd`: 1502 passed, 113 failed, 5 ignored - base `fa204595`: 1500 passed, 112 failed, 5 ignored - The only test failing on #3305 and not on the base is `acphal::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 in `hle::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 are `main`'s known ones on stock vkd3d-proton: list creation refused (`E_INVALIDARG`, #175 / #1701) and the tests after it (#3067). **Not tested** - native Windows - NVIDIA - the `gpu::` tests in the suite runs - the workspace's other crates and integration tests (only `-p xcl --lib`) - a game run (no regression block) AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Foniass commented 2026-12-01 06:03:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:03:46Z.


merge-check
base: d0832e614f
head: a0519dfdc8
merge: 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_wait stops 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 when XCL_CS_PSO_WAIT_MS is unset) and so is finish_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: the wait_expired_at tests 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 d0832e61 vs 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.

<!-- greyfinch-sync:ivall/xcl:comment:7302435343 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7302435343). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:03:46Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: a0519dfdc862c79d6921cb71dffa76a81c72f9b7 merge: 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_wait` stops 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 when `XCL_CS_PSO_WAIT_MS` is unset) and so is `finish_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: the `wait_expired_at` tests 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 d0832e61 vs 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.
brainhay5 commented 2026-12-01 06:16:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T06:16:16Z.


merge-check claim
head: a0519dfdc8

<!-- greyfinch-sync:ivall/xcl:comment:7302682857 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7302682857). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T06:16:16Z. --- merge-check claim head: a0519dfdc862c79d6921cb71dffa76a81c72f9b7
brainhay5 commented 2026-12-01 11:48:09 +00:00 (Migrated from github.com)

Imported 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.

<!-- greyfinch-sync:ivall/xcl:comment:7310162823 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7310162823). Originally posted by [brainhay5](https://github.com/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.*
Hurtibabi commented 2026-12-01 16:22:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Hurtibabi on 2026-12-01T16:22:46Z.


merge-check
base: 6bfb5c5153
head: a0519dfdc8
merge: 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:195 whole(true), real.rs:5053 finish_pso when 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 after cap_from and stop_for_unresolved_wait stops the title, where main paused the watchdog for the whole compile. (2) Every watchdog tick with a build hold moves cap_from to 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 from Instant::now(), build holds behave as before, no new lock is taken in the watchdog (held_by_pc_call was already called through title_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 Instant per 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)

<!-- greyfinch-sync:ivall/xcl:comment:7317506352 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#issuecomment-7317506352). Originally posted by [Hurtibabi](https://github.com/Hurtibabi) on 2026-12-01T16:22:46Z. --- merge-check base: 6bfb5c5153ccc23517daf30aa1071ddb0fadb53c head: a0519dfdc862c79d6921cb71dffa76a81c72f9b7 merge: 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:195` `whole(true)`, `real.rs:5053` `finish_pso` when 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 after `cap_from` and `stop_for_unresolved_wait` stops the title, where main paused the watchdog for the whole compile. (2) Every watchdog tick with a build hold moves `cap_from` to 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 from `Instant::now()`, build holds behave as before, no new lock is taken in the watchdog (`held_by_pc_call` was already called through `title_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 `Instant` per 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)
bmjask commented 2026-12-01 21:44:36 +00:00 (Migrated from github.com)

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 2905

@@ -2855,12 +2874,39 @@ pub(super) unsafe fn break_cycles_before_title_signal(sig_q: usize, title_fence:
     }
 }
 
-/// Whether an armed GPU wait has outlasted the watchdog; its clock stands while a submit or bind is held for a pipeline build.
-fn wait_expired(aw: &mut ArmedGpuWait, held: bool) -> bool {
-    if held {
-        aw.armed_at = Instant::now();
+/// Whether an armed GPU wait has outlasted the watchdog. Its clock stands while the title is held.
+/// A hold for a pipeline build (`build_held`: a submit or bind waiting for one) pauses it for as
+/// long as it lasts. A hold by a long PC call (`pc_call_held`) pauses it only until
+/// `held_wait_cap()` after the wait was armed or last held for a build (`cap_from`): such a call
+/// can itself depend on this GPU wait (a driver call blocked on the GPU), and without the cap that
+/// would freeze the title forever. Past the cap that hold no longer resets the clock, so the wait
+/// expires on the normal timeout (cap + timeout after `cap_from` at the earliest).
+fn wait_expired(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool) -> bool {
+    let now = Instant::now();
+    let expired = wait_expired_at(aw, build_held, pc_call_held, now, gpu_wait_watchdog_timeout(), held_wait_cap());
+    if expired && pc_call_held {
+        static HELD_CAP_WARN: AtomicU64 = AtomicU64::new(0);
+        if once(&HELD_CAP_WARN, 8) {
+            crate::xlog_warn!(
+                "D3D12.X: GPU wait for {:#x} expires although a PC call holds the title: {} ms since it was armed or last held for a build, past the hold cap",
+                aw.val,
+                now.duration_since(aw.cap_from).as_millis()
+            );
+        }
+    }
+    expired
+}
+
+fn wait_expired_at(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool, now: Instant, timeout: Duration, cap: Option<Duration>) -> bool {
+    if build_held {
+        // (time held for a build does not count towards the PC-call cap)
+        aw.cap_from = now;
+    }
+    let pc_call_pauses = pc_call_held && cap.map_or(true, |cap| now.saturating_duration_since(aw.cap_from) < cap);

The 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 PcCall doc 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 with XCL_WAIT_TIMEOUT_CONTINUE unset main calls stop_for_unresolved_wait. A load that used to finish now ends the title.

<!-- greyfinch-sync:ivall/xcl:review-comment:4761441108 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#discussion_r4761441108). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-01T21:44:36Z. **Code review location:** `crates/xcl/src/hle/d3d12x/list_x.rs`; line 2905 ~~~~diff @@ -2855,12 +2874,39 @@ pub(super) unsafe fn break_cycles_before_title_signal(sig_q: usize, title_fence: } } -/// Whether an armed GPU wait has outlasted the watchdog; its clock stands while a submit or bind is held for a pipeline build. -fn wait_expired(aw: &mut ArmedGpuWait, held: bool) -> bool { - if held { - aw.armed_at = Instant::now(); +/// Whether an armed GPU wait has outlasted the watchdog. Its clock stands while the title is held. +/// A hold for a pipeline build (`build_held`: a submit or bind waiting for one) pauses it for as +/// long as it lasts. A hold by a long PC call (`pc_call_held`) pauses it only until +/// `held_wait_cap()` after the wait was armed or last held for a build (`cap_from`): such a call +/// can itself depend on this GPU wait (a driver call blocked on the GPU), and without the cap that +/// would freeze the title forever. Past the cap that hold no longer resets the clock, so the wait +/// expires on the normal timeout (cap + timeout after `cap_from` at the earliest). +fn wait_expired(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool) -> bool { + let now = Instant::now(); + let expired = wait_expired_at(aw, build_held, pc_call_held, now, gpu_wait_watchdog_timeout(), held_wait_cap()); + if expired && pc_call_held { + static HELD_CAP_WARN: AtomicU64 = AtomicU64::new(0); + if once(&HELD_CAP_WARN, 8) { + crate::xlog_warn!( + "D3D12.X: GPU wait for {:#x} expires although a PC call holds the title: {} ms since it was armed or last held for a build, past the hold cap", + aw.val, + now.duration_since(aw.cap_from).as_millis() + ); + } + } + expired +} + +fn wait_expired_at(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool, now: Instant, timeout: Duration, cap: Option<Duration>) -> bool { + if build_held { + // (time held for a build does not count towards the PC-call cap) + aw.cap_from = now; + } + let pc_call_pauses = pc_call_held && cap.map_or(true, |cap| now.saturating_duration_since(aw.cap_from) < cap); ~~~~ --- The 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 `PcCall` doc 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 with `XCL_WAIT_TIMEOUT_CONTINUE` unset main calls `stop_for_unresolved_wait`. A load that used to finish now ends the title.
bmjask commented 2026-12-01 21:44:36 +00:00 (Migrated from github.com)

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 2903

@@ -2855,12 +2874,39 @@ pub(super) unsafe fn break_cycles_before_title_signal(sig_q: usize, title_fence:
     }
 }
 
-/// Whether an armed GPU wait has outlasted the watchdog; its clock stands while a submit or bind is held for a pipeline build.
-fn wait_expired(aw: &mut ArmedGpuWait, held: bool) -> bool {
-    if held {
-        aw.armed_at = Instant::now();
+/// Whether an armed GPU wait has outlasted the watchdog. Its clock stands while the title is held.
+/// A hold for a pipeline build (`build_held`: a submit or bind waiting for one) pauses it for as
+/// long as it lasts. A hold by a long PC call (`pc_call_held`) pauses it only until
+/// `held_wait_cap()` after the wait was armed or last held for a build (`cap_from`): such a call
+/// can itself depend on this GPU wait (a driver call blocked on the GPU), and without the cap that
+/// would freeze the title forever. Past the cap that hold no longer resets the clock, so the wait
+/// expires on the normal timeout (cap + timeout after `cap_from` at the earliest).
+fn wait_expired(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool) -> bool {
+    let now = Instant::now();
+    let expired = wait_expired_at(aw, build_held, pc_call_held, now, gpu_wait_watchdog_timeout(), held_wait_cap());
+    if expired && pc_call_held {
+        static HELD_CAP_WARN: AtomicU64 = AtomicU64::new(0);
+        if once(&HELD_CAP_WARN, 8) {
+            crate::xlog_warn!(
+                "D3D12.X: GPU wait for {:#x} expires although a PC call holds the title: {} ms since it was armed or last held for a build, past the hold cap",
+                aw.val,
+                now.duration_since(aw.cap_from).as_millis()
+            );
+        }
+    }
+    expired
+}
+
+fn wait_expired_at(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool, now: Instant, timeout: Duration, cap: Option<Duration>) -> bool {
+    if build_held {
+        // (time held for a build does not count towards the PC-call cap)
+        aw.cap_from = now;

Build holds stay uncapped and global (HELD counts any bind or submit), and any build hold resets cap_from for 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()) keeps held_for_build() true forever. The same happens if any other title thread waits on a build at least once every 20 s: cap_from keeps moving and the stuck wait never expires.

<!-- greyfinch-sync:ivall/xcl:review-comment:4761441119 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#discussion_r4761441119). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-01T21:44:36Z. **Code review location:** `crates/xcl/src/hle/d3d12x/list_x.rs`; line 2903 ~~~~diff @@ -2855,12 +2874,39 @@ pub(super) unsafe fn break_cycles_before_title_signal(sig_q: usize, title_fence: } } -/// Whether an armed GPU wait has outlasted the watchdog; its clock stands while a submit or bind is held for a pipeline build. -fn wait_expired(aw: &mut ArmedGpuWait, held: bool) -> bool { - if held { - aw.armed_at = Instant::now(); +/// Whether an armed GPU wait has outlasted the watchdog. Its clock stands while the title is held. +/// A hold for a pipeline build (`build_held`: a submit or bind waiting for one) pauses it for as +/// long as it lasts. A hold by a long PC call (`pc_call_held`) pauses it only until +/// `held_wait_cap()` after the wait was armed or last held for a build (`cap_from`): such a call +/// can itself depend on this GPU wait (a driver call blocked on the GPU), and without the cap that +/// would freeze the title forever. Past the cap that hold no longer resets the clock, so the wait +/// expires on the normal timeout (cap + timeout after `cap_from` at the earliest). +fn wait_expired(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool) -> bool { + let now = Instant::now(); + let expired = wait_expired_at(aw, build_held, pc_call_held, now, gpu_wait_watchdog_timeout(), held_wait_cap()); + if expired && pc_call_held { + static HELD_CAP_WARN: AtomicU64 = AtomicU64::new(0); + if once(&HELD_CAP_WARN, 8) { + crate::xlog_warn!( + "D3D12.X: GPU wait for {:#x} expires although a PC call holds the title: {} ms since it was armed or last held for a build, past the hold cap", + aw.val, + now.duration_since(aw.cap_from).as_millis() + ); + } + } + expired +} + +fn wait_expired_at(aw: &mut ArmedGpuWait, build_held: bool, pc_call_held: bool, now: Instant, timeout: Duration, cap: Option<Duration>) -> bool { + if build_held { + // (time held for a build does not count towards the PC-call cap) + aw.cap_from = now; ~~~~ --- Build holds stay uncapped and global (`HELD` counts any bind or submit), and any build hold resets `cap_from` for 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()`) keeps `held_for_build()` true forever. The same happens if any other title thread waits on a build at least once every 20 s: `cap_from` keeps moving and the stuck wait never expires.
bmjask commented 2026-12-01 21:44:36 +00:00 (Migrated from github.com)

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 a pso_async::pc_call(), not a Held build hold, so the new cap applies to what is really a pipeline build. A late giant compile serialized behind real::huge_compile_turn keeps the thread in Chain::whole(true) past 20 s. held_for_build() is false and held_by_pc_call() is true, so the armed GPU wait expires at about 25 s and stop_for_unresolved_wait ends 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.

<!-- greyfinch-sync:ivall/xcl:review:6140703829 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3305#pullrequestreview-6140703829). Originally posted by [bmjask](https://github.com/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 a `pso_async::pc_call()`, not a `Held` build hold, so the new cap applies to what is really a pipeline build. A late giant compile serialized behind `real::huge_compile_turn` keeps the thread in `Chain::whole(true)` past 20 s. `held_for_build()` is false and `held_by_pc_call()` is true, so the armed GPU wait expires at about 25 s and `stop_for_unresolved_wait` ends 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._
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3305:upstream-pr/3305'
git switch 'upstream-pr/3305'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3305'
git switch 'upstream-pr/3305'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3305'
git switch 'upstream-pr/3305'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3305'
git switch 'main'
git merge --squash 'upstream-pr/3305'
git switch 'main'
git merge --ff-only 'upstream-pr/3305'
git switch 'main'
git merge 'upstream-pr/3305'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3305
No description provided.