GPU: log the TDR settings, and warn when a GPU hang would freeze the PC #1082

Manually merged
github merged 1 commit from gh-pr/1082/head into gh-pr/1082/base 2026-11-26 04:19:20 +00:00
Owner

@⁠bvtterbroot on GitHub · 2026-11-24 15:34 UTC · original
bvtterbroot:gpu-tdr-level → main · +150 −1 · 4 files · 1 commits · merged 2026-11-25 00:12 UTC

With TdrLevel set to 0, Windows never resets a hung GPU, so a slow or hung world frame freezes the whole PC and the runtime never sees a device removal it could report (#1054). Reports of "the PC froze" don't say whether that setting is in play; this makes the log say it.

Closes #1054.

What

  • New crates/victory-gpu/src/tdr.rs: reads TdrLevel, TdrDelay and TdrDdiDelay from HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers (RegGetValueW, DWORD only; a missing value reads as Windows' default).
  • When the host device is made on a hardware adapter (not under VICTORY_D3D12_WARP), one info line logs the three values, with default where one is not set:
    GPU timeout detection (TdrLevel, TdrDelay, TdrDdiDelay) level=3 delay=8 ddi_delay=default
    
  • A warning for TdrLevel 0 (a hang freezes the PC) and 1 (a timeout is a blue screen), saying to delete TdrLevel or set it to 3 and raise TdrDelay instead. Levels 2 and 3 and an unset value don't warn, and neither does a raised TdrDelay alone.
  • windows-sys in victory-gpu gains the Win32_System_Registry feature; Cargo.lock is unchanged.

This complements #537, which documents raising TdrDelay/TdrDdiDelay in the README; it touches no README lines, so the two don't conflict.

Tested

Windows 11, AMD Radeon RX 7900 XTX, driver 26.11.2, Rust 1.98.1, at ffe310e:

  • cargo test --workspace --locked: all pass, including the 5 new tdr::tests (warnings for 0 and 1; none for unset, 2, 3 or a raised delay alone; a missing value reads as None).
  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: clean.
  • rustfmt --check on tdr.rs: clean.
  • Tdr::read() on this machine gives level: Some(3), delay: Some(8), ddi_delay: None, the same as reg query for that key.

Not tested: a run of the title (I don't have a dump), so the log line has not been seen in a real run's log, and the warning path has not been seen with TdrLevel actually set to 0 (only in unit tests). Not run under Wine, where the key is normally absent and the line logs default for all three.

🤖 Generated with Claude Code

**@⁠bvtterbroot** on GitHub · 2026-11-24 15:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1082) `bvtterbroot:gpu-tdr-level` → `main` · +150 −1 · 4 files · 1 commits · merged 2026-11-25 00:12 UTC With `TdrLevel` set to 0, Windows never resets a hung GPU, so a slow or hung world frame freezes the whole PC and the runtime never sees a device removal it could report (#1054). Reports of "the PC froze" don't say whether that setting is in play; this makes the log say it. Closes #1054. ## What - New `crates/victory-gpu/src/tdr.rs`: reads `TdrLevel`, `TdrDelay` and `TdrDdiDelay` from `HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers` (`RegGetValueW`, DWORD only; a missing value reads as Windows' default). - When the host device is made on a hardware adapter (not under `VICTORY_D3D12_WARP`), one info line logs the three values, with `default` where one is not set: ``` GPU timeout detection (TdrLevel, TdrDelay, TdrDdiDelay) level=3 delay=8 ddi_delay=default ``` - A warning for `TdrLevel` 0 (a hang freezes the PC) and 1 (a timeout is a blue screen), saying to delete `TdrLevel` or set it to 3 and raise `TdrDelay` instead. Levels 2 and 3 and an unset value don't warn, and neither does a raised `TdrDelay` alone. - `windows-sys` in `victory-gpu` gains the `Win32_System_Registry` feature; `Cargo.lock` is unchanged. This complements #537, which documents raising `TdrDelay`/`TdrDdiDelay` in the README; it touches no README lines, so the two don't conflict. ## Tested Windows 11, AMD Radeon RX 7900 XTX, driver 26.11.2, Rust 1.98.1, at `ffe310e`: - `cargo test --workspace --locked`: all pass, including the 5 new `tdr::tests` (warnings for 0 and 1; none for unset, 2, 3 or a raised delay alone; a missing value reads as `None`). - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: clean. - `rustfmt --check` on `tdr.rs`: clean. - `Tdr::read()` on this machine gives `level: Some(3), delay: Some(8), ddi_delay: None`, the same as `reg query` for that key. Not tested: a run of the title (I don't have a dump), so the log line has not been seen in a real run's log, and the warning path has not been seen with `TdrLevel` actually set to 0 (only in unit tests). Not run under Wine, where the key is normally absent and the line logs `default` for all three. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With TdrLevel 0 Windows never resets a hung GPU: a slow or hung world
frame freezes the whole desktop, and the runtime never sees a device
removal it could report (#1054). With 1 the timeout is a blue screen.
Both are set by hand, often to keep slow frames from being reset, and
reports of "the PC froze" do not say so.

When the host device is made on a hardware adapter, read TdrLevel,
TdrDelay and TdrDdiDelay from HKLM\SYSTEM\CurrentControlSet\Control\
GraphicsDrivers, log them ("default" where a value is not set), and warn
for TdrLevel 0 or 1 with what to set instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:19:19 +00:00
github manually merged commit 42961e8e57 into gh-pr/1082/base 2026-11-26 04:19:20 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 16:29 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 42961e8: cargo test -p victory-gpu passes, 55 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 16:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1082#issuecomment-7137756464) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 42961e8: `cargo test -p victory-gpu` passes, 55 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1082
No description provided.