Add opt-in VICTORY_NO_TDR switch to disable the direct queue's GPU timeout #3250

Open
Moonwolf711 wants to merge 2 commits from upstream-pr/3252 into main
Moonwolf711 commented 2026-11-26 14:39:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moonwolf711 on 2026-11-26T14:39:08Z.


The title can submit one indivisible multi-second GPU workload per frame (everything between waits is a single command-list burst). The default two-second TDR watchdog then removes the device mid-frame and the process exits through DXGI_ERROR_DEVICE_HUNG (0x887A0007) — the run-ending GPU fault the README warns about.

Change

When the existing VICTORY_NO_TDR switch is set, create the direct command queue with D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT instead of the default. This is per-queue and process-local, so Windows keeps TDR protection for every other process on the machine — no TdrDelay registry edits needed.

Verification (RX 6600 XT, driver-level translate cache warm)

  • Without the flag: every run ends in device removal after roughly a minute of world streaming, log shows DXGI_ERROR_DEVICE_HUNG at the present.
  • With VICTORY_NO_TDR=1: the same build runs past frame 3000 at a steady 30 fps with zero device faults, and the run continues. The saved host pipeline library is written normally at exit.

The switch defaults to off, so nothing changes for existing users.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6628986334 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3252). Originally posted by [Moonwolf711](https://github.com/Moonwolf711) on 2026-11-26T14:39:08Z. --- The title can submit one indivisible multi-second GPU workload per frame (everything between waits is a single command-list burst). The default two-second TDR watchdog then removes the device mid-frame and the process exits through `DXGI_ERROR_DEVICE_HUNG` (0x887A0007) — the run-ending GPU fault the README warns about. ## Change When the existing `VICTORY_NO_TDR` switch is set, create the direct command queue with `D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT` instead of the default. This is per-queue and process-local, so Windows keeps TDR protection for every other process on the machine — no `TdrDelay` registry edits needed. ## Verification (RX 6600 XT, driver-level translate cache warm) - Without the flag: every run ends in device removal after roughly a minute of world streaming, log shows `DXGI_ERROR_DEVICE_HUNG` at the present. - With `VICTORY_NO_TDR=1`: the same build runs past frame 3000 at a steady 30 fps with zero device faults, and the run continues. The saved host pipeline library is written normally at exit. The switch defaults to off, so nothing changes for existing users.
Dukestar69 commented 2026-11-26 14:49:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T14:49:18Z.

Review: APPROVED


Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):

  • Opt-in VICTORY_NO_TDR cleanly sets D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT on the host direct queue without changing default behavior when unset.
  • Verified CreateCommandQueue and host GPU execution succeed with VICTORY_NO_TDR=1 on both RTX 5090 and WARP (
    esource::tests::buffer_data_reaches_the_host_texture passed on both).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6076159854 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3252#pullrequestreview-6076159854). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T14:49:18Z. **Review:** APPROVED --- Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP): - Opt-in VICTORY_NO_TDR cleanly sets D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT on the host direct queue without changing default behavior when unset. - Verified CreateCommandQueue and host GPU execution succeed with VICTORY_NO_TDR=1 on both RTX 5090 and WARP ( esource::tests::buffer_data_reaches_the_host_texture passed on both). - cargo clippy -p victory-gpu --all-targets -- -D warnings: clean. - cargo xtask policy: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Moonwolf711 commented 2026-11-26 16:24:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Moonwolf711 on 2026-11-26T16:24:14Z.


Update pushed (5c2ff9d): the flag now covers every command queue, not only the direct one.

Follow-up evidence: a diagnostics build (VICTORY_D3D12_DEBUG=1) that hit the same device removal reported the debug layer's reason as DXGI_ERROR_DEVICE_RESET: "The hardware took an unreasonable amount of time to execute a command on a different Device Context... TDR has been triggered" — i.e. the timeout fired on a queue the direct-queue-only flag did not protect. The same run's final state also showed thousands of live ID3D12Heap/ID3D12CommandAllocator/ID3D12GraphicsCommandList objects (the debug layer's "Kernel memory failure... memory leak" hint), so the timeout switch addresses the watchdog dimension of the fault; a separate resource-lifetime dimension may remain.

The shader-emit host's validation queues now get the flag too (with an inline env check, since victory-shader cannot reach victory-gpu's switch module).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7197599485 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3252#issuecomment-7197599485). Originally posted by [Moonwolf711](https://github.com/Moonwolf711) on 2026-11-26T16:24:14Z. --- Update pushed (`5c2ff9d`): the flag now covers **every** command queue, not only the direct one. Follow-up evidence: a diagnostics build (`VICTORY_D3D12_DEBUG=1`) that hit the same device removal reported the debug layer's reason as `DXGI_ERROR_DEVICE_RESET`: *"The hardware took an unreasonable amount of time to execute a command on a different Device Context... TDR has been triggered"* — i.e. the timeout fired on a queue the direct-queue-only flag did not protect. The same run's final state also showed thousands of live `ID3D12Heap`/`ID3D12CommandAllocator`/`ID3D12GraphicsCommandList` objects (the debug layer's "Kernel memory failure... memory leak" hint), so the timeout switch addresses the watchdog dimension of the fault; a separate resource-lifetime dimension may remain. The shader-emit host's validation queues now get the flag too (with an inline env check, since `victory-shader` cannot reach `victory-gpu`'s switch module).
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/3252:upstream-pr/3252'
git switch 'upstream-pr/3252'

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