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

Manually merged
github merged 1 commit from gh-pr/1983/head into gh-pr/1983/base 2026-11-26 05:12:51 +00:00
Owner

@⁠treybertram06 on GitHub · 2026-11-25 00:22 UTC · original
treybertram06:d3d12x-internal-wait-log → main · +83 −3 · 3 files · 1 commits · merged 2026-11-25 01:15 UTC

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: #505

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

**@⁠treybertram06** on GitHub · 2026-11-25 00:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1983) `treybertram06:d3d12x-internal-wait-log` → `main` · +83 −3 · 3 files · 1 commits · merged 2026-11-25 01:15 UTC 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://git.gtahub.st/github/xcl-dev--xcl/issues/505 **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
When a bridged Wait64BitValueX times out, the watchdog logs the producer
queue's state, but not the queue.Waits XCL adds on its own: texture page
mappings (vram::before_execute), sparse uploads and tile mappings, and
sparse readbacks. They are not in SYNC_GRAPH, so a producer queue that
stands behind one of them looked like a queue with "no tracked wait".

On an RTX 3080 10 GB (driver 621.01) with the retail title, every timeout
came with the producer queue (and another title queue) waiting for the
texture page-mapping fence, about 25 mappings behind after 7.7 s; skipping
that one wait in a local experiment took the CPU releases from 4 to 0-1
per run.

note_internal_wait records each such wait per queue, and each watchdog
round logs the unmet ones next to the pending title fences. The watchdog
timeout (5000 ms) can now be changed with XCL_GPU_WAIT_TIMEOUT_MS, like
XCL_WAIT_TIMEOUT_MS for the CPU waits. No behaviour change otherwise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015JSG96tVb4ZSAZ5WH4v95v
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:49 +00:00
github manually merged commit c4396e234d into gh-pr/1983/base 2026-11-26 05:12:51 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 00:57 UTC · original · edited 2026-11-25 01:08 UTC

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.
**@⁠futurepro62** on GitHub · 2026-11-25 00:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1983#issuecomment-7149065605) · edited 2026-11-25 01:08 UTC 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://git.gtahub.st/github/xcl-dev--xcl/issues/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.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:12 UTC · original

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.

**@⁠raylitebull** on GitHub · 2026-11-25 01:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1983#issuecomment-7149322204) 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`.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:31 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/1983#issuecomment-7151994948) 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.