D3D12.X: the GPU wait watchdog lists the waits XCL put on queues itself #1973

Merged
treybertram06 merged 1 commit from upstream-pr/1983 into main 2026-11-25 01:15:58 +00:00
treybertram06 commented 2026-11-25 00:22:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by treybertram06 on 2026-11-25T00:22:21Z.


When a bridged Wait64BitValueX times out, the GPU wait watchdog logs the waiter, the producer queue and the pending title fences. It does not log the queue.Waits that XCL adds on its own, for texture page mappings, sparse uploads and tile mappings, and sparse readbacks. Those are not in SYNC_GRAPH. A producer queue that stands behind one of them therefore looks like a queue with no tracked wait, which is what #1452 reported. This PR lists the unmet ones at every watchdog round, and makes the watchdog's 5 s timeout configurable for diagnostics. Logging only, no behaviour change. Context: https://github.com/xcl-dev/xcl/issues/505#issuecomment-7148049216

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: note_internal_wait records each XCL-issued wait per queue, and drops the ones already met. internal_waits_summary lists the unmet ones. The watchdog logs them after pending title ID3D12Fences. XCL_GPU_WAIT_TIMEOUT_MS overrides GPU_WAIT_WATCHDOG_TIMEOUT the same way XCL_WAIT_TIMEOUT_MS overrides the CPU timeout. Plus the unit test an_internal_wait_is_listed_until_its_fence_reaches_the_value.
  • crates/xcl/src/hle/d3d12x/vram.rs (before_execute) and crates/xcl/src/hle/d3d12x/sparse.rs (upload wait, readback wait): one note_internal_wait call after each existing queue.Wait.

Example line, from a local build with this change on a retail title. In that run the producer queue q3 and q2 were waiting for the page-mapping fence:

D3D12.X: XCL's own queue waits unmet during GPU wait timeout: q2: texture page mappings >= 0x16c89 (done 0x16c7c, 7702 ms), q3: texture page mappings >= 0x16c96 (done 0x16c7c, 7699 ms)

Tested

  • RTX 3080 10 GB, driver 621.01, Ryzen 9 5900X, 64 GB, Windows 11 Pro 26300, rustc 1.100.0. Tests debug, title release.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on c4396e2: 994 passed, 0 failed, 45 ignored.
  • SKIPPED (91): 68 validator 1.7 < 1.8 (validation step only); 19 no wave64 (32-lane hardware); 3 per-lane-form refusals in lower_dxil::tests::f16_programs_on_the_gpu / f32_programs_on_the_gpu (V_MUL_F16, V_PK_MUL_F16, V_CVT_F16_F32: "its #1426 semantics differ from the console's"); 1 heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.
  • Retail title: the example line above comes from runs on a local tree, main c4d37be + #1478 and local caps, with the same logging. There it showed every timeout's producer queue behind the page-mapping fence. Skipping that one wait, as a local experiment only, took the CPU releases from 4 to 0–1 per run.

Regression run

xcl-smoke v1
commit: 80f4819098e921f2e1ab371144d4832f68ffedd6
gpu: NVIDIA GeForce RTX 3080
title: 4ba6c38e
seconds: 60
exit: 0x0
frames shown: 1523 (PresentX 1523)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16618 MB
xcl-smoke v1
commit: c4396e234d38b3ece461a643ff43ff8156cbd135
gpu: NVIDIA GeForce RTX 3080
title: 4ba6c38e
seconds: 60
exit: 0x0
frames shown: 1597 (PresentX 1597)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15781 MB

Not tested

  • The smoke runs stay on the start screen for 60 s, where no GPU wait times out, so they do not reach the new log line. The line itself was only checked on the local tree described above.
  • AMD, Linux / vkd3d-proton.

AI use

  • Claude Code with Claude Opus 5.5: wrote the diagnostic, the test, the commit message and this description, and ran the tests, smoke runs and title runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_015JSG96tVb4ZSAZ5WH4v95v

<!-- greyfinch-sync:ivall/xcl:issue:6594221500 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1983). Originally posted by [treybertram06](https://github.com/treybertram06) on 2026-11-25T00:22:21Z. --- When a bridged `Wait64BitValueX` times out, the GPU wait watchdog logs the waiter, the producer queue and the pending title fences. It does not log the `queue.Wait`s that XCL adds on its own, for texture page mappings, sparse uploads and tile mappings, and sparse readbacks. Those are not in `SYNC_GRAPH`. A producer queue that stands behind one of them therefore looks like a queue with no tracked wait, which is what #1452 reported. This PR lists the unmet ones at every watchdog round, and makes the watchdog's 5 s timeout configurable for diagnostics. Logging only, no behaviour change. Context: https://github.com/xcl-dev/xcl/issues/505#issuecomment-7148049216 **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `note_internal_wait` records each XCL-issued wait per queue, and drops the ones already met. `internal_waits_summary` lists the unmet ones. The watchdog logs them after `pending title ID3D12Fences`. `XCL_GPU_WAIT_TIMEOUT_MS` overrides `GPU_WAIT_WATCHDOG_TIMEOUT` the same way `XCL_WAIT_TIMEOUT_MS` overrides the CPU timeout. Plus the unit test `an_internal_wait_is_listed_until_its_fence_reaches_the_value`. - `crates/xcl/src/hle/d3d12x/vram.rs` (`before_execute`) and `crates/xcl/src/hle/d3d12x/sparse.rs` (upload wait, readback wait): one `note_internal_wait` call after each existing `queue.Wait`. Example line, from a local build with this change on a retail title. In that run the producer queue `q3` and `q2` were waiting for the page-mapping fence: ``` D3D12.X: XCL's own queue waits unmet during GPU wait timeout: q2: texture page mappings >= 0x16c89 (done 0x16c7c, 7702 ms), q3: texture page mappings >= 0x16c96 (done 0x16c7c, 7699 ms) ``` **Tested** - RTX 3080 10 GB, driver 621.01, Ryzen 9 5900X, 64 GB, Windows 11 Pro 26300, rustc 1.100.0. Tests debug, title release. - `cargo build --workspace && cargo test --workspace -- --test-threads=4` on `c4396e2`: **994 passed, 0 failed, 45 ignored**. - SKIPPED (91): 68 `validator 1.7 < 1.8 (validation step only)`; 19 `no wave64` (32-lane hardware); 3 per-lane-form refusals in `lower_dxil::tests::f16_programs_on_the_gpu` / `f32_programs_on_the_gpu` (`V_MUL_F16`, `V_PK_MUL_F16`, `V_CVT_F16_F32`: "its #1426 semantics differ from the console's"); 1 `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows`. - Retail title: the example line above comes from runs on a local tree, `main` `c4d37be` + #1478 and local caps, with the same logging. There it showed every timeout's producer queue behind the page-mapping fence. Skipping that one wait, as a local experiment only, took the CPU releases from 4 to 0–1 per run. **Regression run** ``` xcl-smoke v1 commit: 80f4819098e921f2e1ab371144d4832f68ffedd6 gpu: NVIDIA GeForce RTX 3080 title: 4ba6c38e seconds: 60 exit: 0x0 frames shown: 1523 (PresentX 1523) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16618 MB ``` ``` xcl-smoke v1 commit: c4396e234d38b3ece461a643ff43ff8156cbd135 gpu: NVIDIA GeForce RTX 3080 title: 4ba6c38e seconds: 60 exit: 0x0 frames shown: 1597 (PresentX 1597) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15781 MB ``` **Not tested** - The smoke runs stay on the start screen for 60 s, where no GPU wait times out, so they do not reach the new log line. The line itself was only checked on the local tree described above. - AMD, Linux / vkd3d-proton. **AI use** - Claude Code with Claude Opus 5.5: wrote the diagnostic, the test, the commit message and this description, and ran the tests, smoke runs and title runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015JSG96tVb4ZSAZ5WH4v95v
futurepro62 commented 2026-11-25 01:11:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-25T00:57:41Z.


Full-suite run, since this PR has no test report yet. Tested exact head c4396e2 (on its base 80f4819).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 983 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: an_internal_wait_is_listed_until_its_fence_reaches_the_value.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 993 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 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))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 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))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7149065605 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1983#issuecomment-7149065605). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-25T00:57:41Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `c4396e2` (on its base `80f4819`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **983 passed, 0 failed, 43 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `an_internal_wait_is_listed_until_its_fence_reaches_the_value`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **993 passed, 0 failed, 45 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `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))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `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))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `7994cd1` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests and `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://github.com/xcl-dev/xcl/issues/1651#issuecomment-7146069648)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
upstream-sync closed this pull request 2026-11-25 02:08:06 +00:00
raylitebull commented 2026-11-25 02:08:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:12:58Z.


Code review on c4396e2:

  • Recording XCL's own queue waits for the GPU wait watchdog diagnostics makes wait-chain diagnosis much clearer, and RTX 3080 + RTX 5070 Ti runs pass cleanly.
  • Diff audited and CI workflow approved (currently running).

Remaining before merge: Build and test (Windows, no GPU) finishing green plus an AMD verification pass on c4396e2.

<!-- greyfinch-sync:ivall/xcl:comment:7149322204 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1983#issuecomment-7149322204). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:12:58Z. --- Code review on `c4396e2`: - Recording XCL's own queue waits for the GPU wait watchdog diagnostics makes wait-chain diagnosis much clearer, and RTX 3080 + RTX 5070 Ti runs pass cleanly. - Diff audited and `CI` workflow approved (currently running). **Remaining before merge:** `Build and test (Windows, no GPU)` finishing green plus an **AMD** verification pass on `c4396e2`.
DavidM1911 commented 2026-11-25 04:10:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T03:31:30Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7151994948 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1983#issuecomment-7151994948). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T03:31:30Z. --- 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!
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!1973
No description provided.