D3D12.X: XCL_QUEUE_NO_TIMEOUT, and a line per title command queue #3674

Open
Prime1997 wants to merge 1 commit from upstream-pr/3674 into main
Prime1997 commented 2026-12-02 05:54:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-12-02T05:54:49Z.


Requested by Prime

Open-world runs of a game title on an RTX 3060 Ti 8 GB ended with DXGI_ERROR_DEVICE_HUNG at the same place in the game in two runs. The direct queue and three async compute queues had been on one frame for 2.4-3.4 s, local video memory was 0.4-1.2 GB over its budget, and the async queues' service p99 was already 2.2 s the minute before. This looks like work that runs past Windows' 2 s GPU timeout while memory pages, not a translator bug. The new switch XCL_QUEUE_NO_TIMEOUT makes the title's compute queues (or its direct and compute queues) with D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT, so Windows lets that work finish instead of removing the device. It is off by default. Each title command queue now also gets one log line at creation: its type, priority, console and PC flags, and whether its GPU timeout is on.

Related: #3260 changes how CreateCommandQueueX (#48) reads the console's queue desc and splits create_command_queue_x; the two will conflict, and the switch should apply on top of whichever desc translation lands. #2748 logs when a device hang was Windows' GPU timeout; this one is a way around it.

What is in it

  • crates/xcl/src/hle/d3d12x/device_x.rs: XCL_QUEUE_NO_TIMEOUT (read and logged once) adds DISABLE_GPU_TIMEOUT to the PC desc of compute, or direct and compute, queues; copy queues never. A log line per title queue (first 32). Unit tests for the parsing and the flag.

Tested

  • RTX 3060 Ti 8 GB, Windows 11, release build: the change has been in our test builds since 1 Dec (no measured before/after on its own).
  • This branch (on main 1c8b5514): cargo check -p xcl --lib --tests --target x86_64-pc-windows-gnu passes. The test suite was not run on this exact branch.

Regression run

  • Not run yet: testers welcome.

Not tested

  • The suite and scripts/smoke.ps1 on this branch; AMD.
  • Whether the switch on its own gets past the hang above.
  • With the switch on, GPU work that never ends freezes the title (and the desktop, when the GPU cannot be preempted) instead of ending it.

Switches

  • XCL_QUEUE_NO_TIMEOUT: default unset (0): queues get the GPU timeout the console asked for. compute: compute queues have no GPU timeout. all: direct and compute queues have none. =0 is the same as unset.

AI use

  • Claude Code wrote the change and this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5600753681 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3674). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-12-02T05:54:49Z. --- <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime**_ Open-world runs of a game title on an RTX 3060 Ti 8 GB ended with `DXGI_ERROR_DEVICE_HUNG` at the same place in the game in two runs. The direct queue and three async compute queues had been on one frame for 2.4-3.4 s, local video memory was 0.4-1.2 GB over its budget, and the async queues' service p99 was already 2.2 s the minute before. This looks like work that runs past Windows' 2 s GPU timeout while memory pages, not a translator bug. The new switch `XCL_QUEUE_NO_TIMEOUT` makes the title's compute queues (or its direct and compute queues) with `D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT`, so Windows lets that work finish instead of removing the device. It is off by default. Each title command queue now also gets one log line at creation: its type, priority, console and PC flags, and whether its GPU timeout is on. Related: #3260 changes how `CreateCommandQueueX` (#48) reads the console's queue desc and splits `create_command_queue_x`; the two will conflict, and the switch should apply on top of whichever desc translation lands. #2748 logs when a device hang was Windows' GPU timeout; this one is a way around it. **What is in it** - `crates/xcl/src/hle/d3d12x/device_x.rs`: `XCL_QUEUE_NO_TIMEOUT` (read and logged once) adds `DISABLE_GPU_TIMEOUT` to the PC desc of compute, or direct and compute, queues; copy queues never. A log line per title queue (first 32). Unit tests for the parsing and the flag. **Tested** - RTX 3060 Ti 8 GB, Windows 11, release build: the change has been in our test builds since 1 Dec (no measured before/after on its own). - This branch (on main 1c8b5514): `cargo check -p xcl --lib --tests --target x86_64-pc-windows-gnu` passes. The test suite was not run on this exact branch. **Regression run** - Not run yet: testers welcome. **Not tested** - The suite and `scripts/smoke.ps1` on this branch; AMD. - Whether the switch on its own gets past the hang above. - With the switch on, GPU work that never ends freezes the title (and the desktop, when the GPU cannot be preempted) instead of ending it. **Switches** - `XCL_QUEUE_NO_TIMEOUT`: default unset (`0`): queues get the GPU timeout the console asked for. `compute`: compute queues have no GPU timeout. `all`: direct and compute queues have none. `=0` is the same as unset. **AI use** - Claude Code wrote the change and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-02 09:17:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T09:17:54Z.


Review (head 11fdcfd8, diff read, not a merge-check; checks red):

  • PR description check is red. PR checks refuses it because Regression run has no xcl-smoke block on head 11fdcfd830 and none on a commit of main. Tested also has no suite counts: only cargo check for the gnu target, while CONTRIBUTING asks for cargo test --workspace on a GPU with the real counts.
  • The switch may not change the queues that hung. pc_queue_desc (crates/xcl/src/hle/d3d12x/device_x.rs ~76, already on main) passes the console's bit 0 through as PC DISABLE_GPU_TIMEOUT. So a compute queue that the title makes with flags 3 (the commit message says the retail game uses 2 or 3) already has no GPU timeout on main, and compute does nothing for it. The description also says the direct queue q0 was stuck for 2.4-3.4 s, and compute leaves q0 with its timeout. Nothing yet shows which of q0/q1/q3/q4 lacked the flag. The new per-queue line answers that, so the motivation should be checked against it before this is presented as the fix for that hang. "Whether the switch on its own gets past the hang" is rightly listed under Not tested.
  • No fallback if the flag is refused. create_command_queue_x (~162) returns the CreateCommandQueue HRESULT unchanged, so with the switch on, a failed create fails the title's queue instead of retrying without the flag. The flag value is the same one main already forwards from bit 0, so a failure is unlikely, but it is untested and only matters when the switch is on.
  • README not updated. README already documents the diagnostic switches (XCL_WAIT_TIMEOUT_MS ~351, XCL_DUMP_ON ~427). A user-facing workaround that can freeze the desktop should be listed there with that warning. Right now it is only in the PR text.

Fine: the default path is unchanged by reading. When the switch is unset/0, with_no_timeout(.., AsAsked) returns the desc unchanged (unit-tested), the env var is read once through OnceLock, and the only additions are one "off" line and the queue line. The queue line is logged only when a queue is created, capped at 32, and the string is built only when it is logged, so it does not touch the hot path. Copy queues are never changed. A null desc behaves as before. Compared with #3673: that PR is the progress-fence diagnostics that produce the service-time numbers quoted here. It touches different files (gpu_progress.rs, list_x.rs, watch.rs), merges cleanly with this one, and the two are complementary, not duplicates.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7340674393 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3674#issuecomment-7340674393). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T09:17:54Z. --- Review (head 11fdcfd8, diff read, not a merge-check; checks red): - **PR description check is red.** `PR checks` refuses it because **Regression run** has no `xcl-smoke` block on head 11fdcfd830e1 and none on a commit of main. **Tested** also has no suite counts: only `cargo check` for the gnu target, while CONTRIBUTING asks for `cargo test --workspace` on a GPU with the real counts. - **The switch may not change the queues that hung.** `pc_queue_desc` (`crates/xcl/src/hle/d3d12x/device_x.rs` ~76, already on main) passes the console's bit 0 through as PC `DISABLE_GPU_TIMEOUT`. So a compute queue that the title makes with flags 3 (the commit message says the retail game uses 2 or 3) already has no GPU timeout on main, and `compute` does nothing for it. The description also says the direct queue q0 was stuck for 2.4-3.4 s, and `compute` leaves q0 with its timeout. Nothing yet shows which of q0/q1/q3/q4 lacked the flag. The new per-queue line answers that, so the motivation should be checked against it before this is presented as the fix for that hang. "Whether the switch on its own gets past the hang" is rightly listed under **Not tested**. - **No fallback if the flag is refused.** `create_command_queue_x` (~162) returns the `CreateCommandQueue` HRESULT unchanged, so with the switch on, a failed create fails the title's queue instead of retrying without the flag. The flag value is the same one main already forwards from bit 0, so a failure is unlikely, but it is untested and only matters when the switch is on. - **README not updated.** README already documents the diagnostic switches (`XCL_WAIT_TIMEOUT_MS` ~351, `XCL_DUMP_ON` ~427). A user-facing workaround that can freeze the desktop should be listed there with that warning. Right now it is only in the PR text. Fine: the default path is unchanged by reading. When the switch is unset/`0`, `with_no_timeout(.., AsAsked)` returns the desc unchanged (unit-tested), the env var is read once through `OnceLock`, and the only additions are one "off" line and the queue line. The queue line is logged only when a queue is created, capped at 32, and the string is built only when it is logged, so it does not touch the hot path. Copy queues are never changed. A null `desc` behaves as before. Compared with #3673: that PR is the progress-fence diagnostics that produce the service-time numbers quoted here. It touches different files (`gpu_progress.rs`, `list_x.rs`, `watch.rs`), merges cleanly with this one, and the two are complementary, not duplicates. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-02 09:38:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T09:38:04Z.


Test report (not a merge-check: PR description red)
base: 1c8b551475
head: 11fdcfd830
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 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 by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3674#issuecomment-7340674393 and its findings stand. Most serious: main already passes the console's bit 0 through as DISABLE_GPU_TIMEOUT, so the switch may not affect the queues that hung.
performance: 60 s smoke of a retail title, main 1c8b5514 vs this merge (11fdcfd8): 1652 -> 1674 frames shown (101 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 17287 MB, 0 device removals, 0 crashes.
assessment: merges, builds and passes the whole suite on current main, and the smoke run is clean; the blocking point is in the review: main already passes the console's bit 0 through as DISABLE_GPU_TIMEOUT, so the switch may not affect the queues that hung
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:7341242982 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3674#issuecomment-7341242982). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T09:38:04Z. --- Test report (not a merge-check: `PR description` red) base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 11fdcfd830e1b09ff6ff87fea70f5637de1d04d0 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 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 by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3674#issuecomment-7340674393 and its findings stand. Most serious: main already passes the console's bit 0 through as `DISABLE_GPU_TIMEOUT`, so the switch may not affect the queues that hung. performance: 60 s smoke of a retail title, main 1c8b5514 vs this merge (11fdcfd8): 1652 -> 1674 frames shown (101 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 17287 MB, 0 device removals, 0 crashes. assessment: merges, builds and passes the whole suite on current main, and the smoke run is clean; the blocking point is in the review: main already passes the console's bit 0 through as `DISABLE_GPU_TIMEOUT`, so the switch may not affect the queues that hung 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.
Foniass commented 2026-12-03 15:57:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T15:57:54Z.


merge-check
base: 16c2fd082a
head: 11fdcfd830
merge: clean
build: ok
tests: 3012 passed, 0 failed, 56 ignored; 28 skipped, the same as on main
review: 3 medium, 2 nits (below)
performance: 60 s smoke run: 1683 → 1647 frames (97 % of main), peak commit 18505 → 17819 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 231 s there, 0 device removals, 0 crashes, 2.7 presents/s; run with XCL_SKIP_CS=95cc13288a27a96e (the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)
verdict: not yet: PR description is red; otherwise no blocking finding, the suite passes and the smoke run is clean
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5


In short: Adds an opt-in XCL_QUEUE_NO_TIMEOUT that makes the title's compute queues (or direct and compute queues) with DISABLE_GPU_TIMEOUT, plus one log line per title queue. The head has not changed since my earlier review: the default path is unchanged and nothing in the code blocks it. Still open: the switch may not touch the queues that hung, and the README is not updated.

Medium

  1. The switch may not change the queues that hung. Still open from my earlier review. pc_queue_desc (device_x.rs ~76, already on main) passes the console's bit 0 through as DISABLE_GPU_TIMEOUT, so a compute queue the title makes with flags 3 already has no timeout on main and compute changes nothing for it. The direct queue that was also stuck for 2.4-3.4 s keeps its timeout under compute. Use the new per-queue line from a hanging run to show which queues lacked the flag before presenting this as the fix for that hang.
  2. README does not list the switch. Still open from my earlier review. README documents the diagnostic switches (XCL_WAIT_TIMEOUT_MS ~355). A workaround that can freeze the title, and the desktop with it, should be listed there with that warning.
  3. AI use names no model. "Claude Code wrote the change and this description" names no model. Give the exact model name.

Nit

  1. Undocumented values of the switch. parse_no_timeout (~91) also takes async (as compute) and 1 and on (as all), and any other value quietly means off (it is only logged). The description documents only compute, all and 0. Document the extra values or drop them.
  2. No fallback if the flag is refused. Still open from my earlier review. create_command_queue_x (~161) returns the CreateCommandQueue HRESULT unchanged, so with the switch on a refused create fails the title's queue instead of retrying without the flag. Unlikely to happen, since main already forwards the same bit.
Checked and fine
  • Unset or 0: with_no_timeout(.., AsAsked) returns the PC desc unchanged (unit-tested), and the variable is read once through OnceLock
  • Copy queues never get the flag, and a null desc behaves as before
  • The queue line is logged only at queue creation, capped at 32 lines, and its string is built only when it is logged
  • Merges cleanly into current origin/main; create_command_queue_x is unchanged on main since the base, and #3260 (which would have conflicted) is closed
  • Unit tests cover the parsing and the flag for each queue type
How this was tested
  • Merged onto main 16c2fd08, then cargo build --workspace and cargo test --workspace --no-fail-fast -- --test-threads=4.
  • The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar).
  • scripts/smoke.ps1: 60 s of a retail title on main 16c2fd08 and on this merge; presents per 2 s at the end: 60 60 60.
  • Title run: the release build of this merge launched the retail title with XCL_RUN_SECONDS=300 and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7384027744 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3674#issuecomment-7384027744). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T15:57:54Z. --- merge-check base: 16c2fd082ae2e96967a2ab553bc2e1032e491f70 head: 11fdcfd830e1b09ff6ff87fea70f5637de1d04d0 merge: clean build: ok tests: 3012 passed, 0 failed, 56 ignored; 28 skipped, the same as on main review: 3 medium, 2 nits (below) performance: 60 s smoke run: 1683 → 1647 frames (97 % of main), peak commit 18505 → 17819 MB, no device removal, no crash title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 231 s there, 0 device removals, 0 crashes, 2.7 presents/s; run with `XCL_SKIP_CS=95cc13288a27a96e` (the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590) verdict: not yet: `PR description` is red; otherwise no blocking finding, the suite passes and the smoke run is clean hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 --- **In short:** Adds an opt-in XCL_QUEUE_NO_TIMEOUT that makes the title's compute queues (or direct and compute queues) with DISABLE_GPU_TIMEOUT, plus one log line per title queue. The head has not changed since my earlier review: the default path is unchanged and nothing in the code blocks it. Still open: the switch may not touch the queues that hung, and the README is not updated. #### Medium 1. **The switch may not change the queues that hung.** Still open from my earlier review. pc_queue_desc (device_x.rs ~76, already on main) passes the console's bit 0 through as DISABLE_GPU_TIMEOUT, so a compute queue the title makes with flags 3 already has no timeout on main and `compute` changes nothing for it. The direct queue that was also stuck for 2.4-3.4 s keeps its timeout under `compute`. Use the new per-queue line from a hanging run to show which queues lacked the flag before presenting this as the fix for that hang. 2. **README does not list the switch.** Still open from my earlier review. README documents the diagnostic switches (XCL_WAIT_TIMEOUT_MS ~355). A workaround that can freeze the title, and the desktop with it, should be listed there with that warning. 3. **AI use names no model.** "Claude Code wrote the change and this description" names no model. Give the exact model name. #### Nit 4. **Undocumented values of the switch.** parse_no_timeout (~91) also takes `async` (as compute) and `1` and `on` (as all), and any other value quietly means off (it is only logged). The description documents only `compute`, `all` and `0`. Document the extra values or drop them. 5. **No fallback if the flag is refused.** Still open from my earlier review. create_command_queue_x (~161) returns the CreateCommandQueue HRESULT unchanged, so with the switch on a refused create fails the title's queue instead of retrying without the flag. Unlikely to happen, since main already forwards the same bit. <details><summary>Checked and fine</summary> - Unset or 0: with_no_timeout(.., AsAsked) returns the PC desc unchanged (unit-tested), and the variable is read once through OnceLock - Copy queues never get the flag, and a null desc behaves as before - The queue line is logged only at queue creation, capped at 32 lines, and its string is built only when it is logged - Merges cleanly into current origin/main; create_command_queue_x is unchanged on main since the base, and #3260 (which would have conflicted) is closed - Unit tests cover the parsing and the flag for each queue type </details> <details><summary>How this was tested</summary> - Merged onto main `16c2fd08`, then `cargo build --workspace` and `cargo test --workspace --no-fail-fast -- --test-threads=4`. - The skipped GPU tests are those this card can't run (no wave64 on NVIDIA, no D3D12 debug layer, and similar). - `scripts/smoke.ps1`: 60 s of a retail title on main `16c2fd08` and on this merge; presents per 2 s at the end: 60 60 60. - Title run: the release build of this merge launched the retail title with `XCL_RUN_SECONDS=300` and scripted A presses counted from the first frame (`XCL_PRESS_BASE=frame`, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
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/3674:upstream-pr/3674'
git switch 'upstream-pr/3674'

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/3674'
git switch 'upstream-pr/3674'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3674'
git switch 'upstream-pr/3674'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3674'
git switch 'main'
git merge --squash 'upstream-pr/3674'
git switch 'main'
git merge --ff-only 'upstream-pr/3674'
git switch 'main'
git merge 'upstream-pr/3674'
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!3674
No description provided.