D3D12.X: a device hang names Windows' GPU timeout when it was one #2738

Open
Raul-Paiva wants to merge 2 commits from upstream-pr/2748 into main
Raul-Paiva commented 2026-11-26 09:58:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T09:58:40Z.


A 0x887a0006 (DEVICE_HUNG) or 0x887a0007 (DEVICE_RESET) removal can be Windows' GPU timeout (TDR): WDDM resets the GPU when it does not preempt within TdrDelay seconds of the scheduler asking (2 s by default, at the default TdrLevel). The removal code alone does not tell that apart from a hang the driver detected itself. The log now says whether Windows logged one. At start it names the timeout in effect. After such a removal it looks in the System log for the Display event 4101 Windows writes when it was its timeout. Logging only. Part of #505.

On an 8 GB laptop card, every 0x887a0006 at a retail title's world start had a 4101 event at the same time (14 of 14 runs). Raising TdrDelay took them away (#505 comment). Without the event, testers on slower cards report these as GPU hangs.

What is in it

  • crates/xcl/src/gpu/tdr.rs (new):
    • settings() reads TdrDelay / TdrLevel from HKLM\System\CurrentControlSet\Control\GraphicsDrivers. Read only, no elevation.
    • describe() turns them into the log line: TdrDelay as the GPU's preemption timeout, and what TdrLevel does then (0 off, 1 a bug check with no recovery, 3 or unset a reset; 2 is not implemented by Windows). The line says the values are the registry's, which Windows reads at boot, so a change not yet applied is not taken for the one in effect.
    • recent_resets() counts Display 4101 events of the last 30 s with EvtQuery. A read that fails with anything but ERROR_NO_MORE_ITEMS gives "unknown", not a count.
    • removal_note() does this for DEVICE_HUNG / DEVICE_RESET only, waiting up to 3 s for the event because Windows can write it just after the title sees the removal. A recent event is reported as consistent with the timeout, not as proof: the event names no device.
    • Unit tests for each.
  • crates/xcl/src/hle/d3d12x/mod.rs: the timeout line after backend 'real'.
  • crates/xcl/src/hle/d3d12x/real.rs:
    • log_removal_note writes the note, once. stop_if_device_removed calls it after the DRED lines and report.json are written and the log is flushed, just before it ends the process. The title's other threads run on during the 3 s wait, so if the title ends by itself then, only the note is lost.
    • log_device_removed and log_removal_note each let a second caller wait for the first one's output, for at most 5 s (ReportOnce). Without that, stop_if_device_removed on another thread ended the process before the output was written; in one run that was 70 ms after the removal. The wait is bounded and not a lock: the reporting thread can come back itself through the unhandled-exception filter.
  • crates/xcl/src/eh.rs: the unhandled-exception filter calls log_removal_note after its own report.
  • crates/xcl/Cargo.toml: the Win32_System_EventLog feature of windows-sys, for EvtQuery. No new dependency.

Tested

  • Hardware: RTX 3070 Laptop GPU 8 GB, driver 621.40, i7-11800H, 32 GB, Windows 10 19045, rustc 1.100.0, release build.

  • On this head (53c67afa, on main a815de93):

    • cargo test --release -p xcl --lib gpu::tdr: 9 passed, 0 failed; report_once: 2 passed, 0 failed.
    • cargo test --release -p xcl --lib hle::d3d12x::real -- --test-threads=4: 175 passed, 3 failed, 0 ignored. The 3 failures are real::dispatch_chain::tests (failed_binding_keeps_indirect_commands_until_allocator_reset, an_indirect_dispatch_runs_its_chain_without_any_whole_form, a_split_indirect_dispatch_slices_the_counts_the_guard_let_through), which get E_INVALIDARG from the driver on this adapter and fail the same way on main a815de93. SKIPPED: 2 "no GPU".
    • Integration tests (cargo test --release -p xcl --no-fail-fast --test '*' -- --test-threads=4): 151 passed, 0 failed, 20 ignored, on this head and on main a815de93. SKIPPED on both: 1 "no heap windows".
    • The whole lib suite was not rerun on this head; the counts below are from earlier heads.
  • The order of the report after a removal, measured the way fromthemoonx's merge-check did. Temporary code, since removed, called ID3D12Device5::RemoveDevice 1.5 s after the backend started and then stop_if_device_removed, and let is_hang take 0x887a0005. The run was the bundled test title under xcl run with XCL_DRED=1, debug build, 12 runs each:

    DRED lines in the log crash in report.json 4101 note title ended by itself first
    before (cb2bc007) 4 4 4 8
    this head (53c67afa) 12 12 2 0
    • On this head the title still ended by itself during the note's wait in 10 of the 12 runs. That lost only the note, and the process then exits with the title's own code instead of the removal's. The DRED lines and the crash in report.json were there every time.
  • On the previous head ba84c7a0 (the same change on main d52ff48c), the lib tests of the modules this PR touches (gpu::tdr, hle::d3d12x::real), release, serial, with the 20 skips: 179 passed, 2 failed, 0 ignored. The 2 failures, real::dispatch_chain::tests::an_indirect_dispatch_runs_its_chain_without_any_whole_form and real::dispatch_chain::tests::failed_binding_keeps_indirect_commands_until_allocator_reset (E_INVALIDARG from the driver on this adapter), fail the same way on main d52ff48c.

  • This PR at 210eaf33, on main 53e85fb1, against main 53e85fb1 (same commands, same machine):

    • cargo test --release --workspace --no-fail-fast -- --test-threads=4: the lib test binary ends early on main too (exit 0x80004005 after sparse upload preparation still failed after bounded retries), so the lib was also run alone, serially (--test-threads=1), with --skip for the 20 tests that end the binary on main (6 list_x, 12 sparse, 1 texture_upload, 1 uma_driver; each passes alone).
    • integration tests: 139 passed, 0 failed, 20 ignored; main: the same.
    • lib, serial with the 20 skips: 2630 passed, 15 failed, 29 ignored. main: 2617 passed, 16 failed, 29 ignored, with vram::tests::d32s8_targets_take_their_own_size_of_video_memory also skipped because it ended the binary there. Every failure here also fails on main (12 title_textures, list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list, standin::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, and that d32s8 test); two that failed on main passed here (alloc_pool::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_reads, vram::superseded_texture_waits_for_every_title_queue), both intermittent in the long run.
    • SKIPPED on this adapter (same on main): the wave64 forms (no wave64), three f16/f32 per-lane forms refused by the recompiler, and the heap-window tests (no heap windows).
  • Earlier, on c20818a (debug, against an older main): 1445 passed, 1 failed (list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list, intermittent on main too), 47 ignored.

  • The 9 tests in gpu::tdr::tests pass, among them a reader that fails on its first call (ERROR_TIMEOUT), one that fails after a partial batch, an injected recent event, and a malformed query, which Windows refuses with ERROR_EVT_INVALID_QUERY. The two tests that read the real System log print SKIPPED where a valid query cannot read it (Wine's wevtapi gives error 0), and otherwise fail only on a query Windows refuses. The 2 tests in real::report_once_tests pass: a second caller waits for the report, and the reporting thread coming back (through the unhandled-exception filter) does not hang. The query of recent_resets, run over the last 24 h with Get-WinEvent -FilterXPath, found the 24 events 4101 of this machine that day.

  • In the PR's smoke run the log has, after the adapter line:

    D3D12.X: Windows resets the GPU when it does not preempt within 10 s (TdrDelay 10), per the registry (read by Windows at boot)
    

    (TdrDelay is 10 on this machine for an earlier test; it is 2 s when not set.)

  • Real removals, each in a 600 s run of a retail title. The tree was this PR on a test tree: main + #2404 and others, with a 1 GiB shader heap profile.

    • With the code of 4c8f841 (its tdr.rs and ReportOnce copied in as they are; the head c20818a changes only a test since). The thread number is in brackets:
      [  7.8 s]         D3D12.X: Windows resets the GPU when it does not preempt within 10 s (TdrDelay 10), per the registry (read by Windows at boot)
      [530.0 s] (41108) D3D12 device removed: 0x887a0006 The GPU will not respond to more commands, …
      [531.2 s] (41108) D3D12 device removed: 1 Display 4101 event(s) in the System log in the last 30 s, consistent with Windows' GPU timeout (the event does not name the device) – …
      [531.2 s] (18116) the D3D12 device was removed (0x887a0006: …) – the title is stopped
      
      • The System log has the 4101 event at that time, after three nvlddmkm 153 events in the 15 s before.
      • The note found the event 1.2 s after the removal, inside the 3 s wait.
      • stop_if_device_removed on another thread ended the process 6 ms after the note.
    • Earlier versions:
      • A 4101 case on the first version, at 259.0 s: the note found the event 1.6 s later.
      • A case without the event, with the lock version of the wait: 0x887a0007 at 233.3 s. The note no Display 4101 event in the System log in the last 30 s: … came at 236.6 s, and the process ended after it. The System log has no 4101 in that window.
      • One run before the wait existed: the process ended 70 ms after the removal, and the note was lost.

Test reports from others (on earlier heads: c9e51e5 is before both review fixes and the report lock, e1ac7f0 before the TdrLevel wording, 4c8f841 before the Wine skip)

  • AMD Radeon RX 9060 XT (RDNA4), Windows 11, on e1ac7f0 (emirduran707): the 8 gpu::tdr tests pass. The suite had 1441 passed and 2 failed, both dxil::fuzz_tests that fail on main there too. Smoke: 1601 frames, 0 removals (main: 1603).
  • RTX 4060 Laptop, Linux with Wine 11 and a locally built vkd3d-proton, on 4c8f841 (pickles976): 8 of 9 gpu::tdr tests and both report_once tests pass. Wine's wevtapi reads no System log (error 0), and a_query_windows_refuses_is_told_apart failed on that. It now skips there like the other System-log test (c20818a). Under Wine the note after a removal should read the System log could not be read … (not run there).
  • RTX 4080 SUPER, Windows 11, on c9e51e5 (sage-sage): 1440 passed, 0 failed, and the gpu::tdr tests of that head pass, including the System log read.

Regression run
scripts/smoke.ps1 -Seconds 120 -Title 'retail title A', release builds of clean trees, one after the other on the machine in Tested, with XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000. The title is left on its own, with no input; the shader cache was warmed by two runs of main before.

main:

xcl-smoke v1
commit: a815de932c4dc8da3b383ca44f4b094aa406fec9
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: retail title A
seconds: 120
exit: 0x0
frames shown: 3287 (PresentX 3287)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14432 MB

This PR:

xcl-smoke v1
commit: 53c67afa1ccbc154dd9f4a387c817b5bd8c9f750
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: retail title A
seconds: 120
exit: 0x0
frames shown: 3360 (PresentX 3360)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15126 MB

Not tested

  • When the title ends by itself during the note's wait (3 s at most), the note is lost and the process exit code is the title's; the DRED lines and report.json are written before the wait.
  • TdrDdiDelay, the time a thread may stay inside the driver (5 s by default), is another way to a TDR. The start line does not name it; the removals measured here were the GPU not preempting.
  • A machine where the System log cannot be read.
  • Intel. AMD and Windows 11 only through the reports above, which had no real removal.

AI use

  • Claude Code (Claude Opus 5.5) wrote the module, the tests and this description. It also ran the suite and the smoke runs.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5507861392 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-11-26T09:58:40Z. --- A `0x887a0006` (`DEVICE_HUNG`) or `0x887a0007` (`DEVICE_RESET`) removal can be Windows' GPU timeout (TDR): WDDM resets the GPU when it does not preempt within `TdrDelay` seconds of the scheduler asking (2 s by default, at the default `TdrLevel`). The removal code alone does not tell that apart from a hang the driver detected itself. The log now says whether Windows logged one. At start it names the timeout in effect. After such a removal it looks in the System log for the `Display` event 4101 Windows writes when it was its timeout. Logging only. Part of #505. On an 8 GB laptop card, every `0x887a0006` at a retail title's world start had a 4101 event at the same time (14 of 14 runs). Raising `TdrDelay` took them away ([#505 comment](https://github.com/xcl-dev/xcl/issues/505#issuecomment-7177571006)). Without the event, testers on slower cards report these as GPU hangs. **What is in it** - `crates/xcl/src/gpu/tdr.rs` (new): - `settings()` reads `TdrDelay` / `TdrLevel` from `HKLM\System\CurrentControlSet\Control\GraphicsDrivers`. Read only, no elevation. - `describe()` turns them into the log line: `TdrDelay` as the GPU's preemption timeout, and what `TdrLevel` does then (0 off, 1 a bug check with no recovery, 3 or unset a reset; 2 is not implemented by Windows). The line says the values are the registry's, which Windows reads at boot, so a change not yet applied is not taken for the one in effect. - `recent_resets()` counts `Display` 4101 events of the last 30 s with `EvtQuery`. A read that fails with anything but `ERROR_NO_MORE_ITEMS` gives "unknown", not a count. - `removal_note()` does this for `DEVICE_HUNG` / `DEVICE_RESET` only, waiting up to 3 s for the event because Windows can write it just after the title sees the removal. A recent event is reported as consistent with the timeout, not as proof: the event names no device. - Unit tests for each. - `crates/xcl/src/hle/d3d12x/mod.rs`: the timeout line after `backend 'real'`. - `crates/xcl/src/hle/d3d12x/real.rs`: - `log_removal_note` writes the note, once. `stop_if_device_removed` calls it after the DRED lines and `report.json` are written and the log is flushed, just before it ends the process. The title's other threads run on during the 3 s wait, so if the title ends by itself then, only the note is lost. - `log_device_removed` and `log_removal_note` each let a second caller wait for the first one's output, for at most 5 s (`ReportOnce`). Without that, `stop_if_device_removed` on another thread ended the process before the output was written; in one run that was 70 ms after the removal. The wait is bounded and not a lock: the reporting thread can come back itself through the unhandled-exception filter. - `crates/xcl/src/eh.rs`: the unhandled-exception filter calls `log_removal_note` after its own report. - `crates/xcl/Cargo.toml`: the `Win32_System_EventLog` feature of `windows-sys`, for `EvtQuery`. No new dependency. **Tested** - Hardware: RTX 3070 Laptop GPU 8 GB, driver 621.40, i7-11800H, 32 GB, Windows 10 19045, rustc 1.100.0, release build. - On this head (53c67afa, on `main` a815de93): - `cargo test --release -p xcl --lib gpu::tdr`: 9 passed, 0 failed; `report_once`: 2 passed, 0 failed. - `cargo test --release -p xcl --lib hle::d3d12x::real -- --test-threads=4`: 175 passed, 3 failed, 0 ignored. The 3 failures are `real::dispatch_chain::tests` (`failed_binding_keeps_indirect_commands_until_allocator_reset`, `an_indirect_dispatch_runs_its_chain_without_any_whole_form`, `a_split_indirect_dispatch_slices_the_counts_the_guard_let_through`), which get E_INVALIDARG from the driver on this adapter and fail the same way on `main` a815de93. SKIPPED: 2 "no GPU". - Integration tests (`cargo test --release -p xcl --no-fail-fast --test '*' -- --test-threads=4`): 151 passed, 0 failed, 20 ignored, on this head and on `main` a815de93. SKIPPED on both: 1 "no heap windows". - The whole lib suite was not rerun on this head; the counts below are from earlier heads. - The order of the report after a removal, measured the way fromthemoonx's [merge-check](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7379762504) did. Temporary code, since removed, called `ID3D12Device5::RemoveDevice` 1.5 s after the backend started and then `stop_if_device_removed`, and let `is_hang` take `0x887a0005`. The run was the bundled test title under `xcl run` with `XCL_DRED=1`, debug build, 12 runs each: | | DRED lines in the log | crash in `report.json` | 4101 note | title ended by itself first | |---|---|---|---|---| | before (cb2bc007) | 4 | 4 | 4 | 8 | | this head (53c67afa) | 12 | 12 | 2 | 0 | - On this head the title still ended by itself during the note's wait in 10 of the 12 runs. That lost only the note, and the process then exits with the title's own code instead of the removal's. The DRED lines and the crash in `report.json` were there every time. - On the previous head ba84c7a0 (the same change on `main` d52ff48c), the lib tests of the modules this PR touches (`gpu::tdr`, `hle::d3d12x::real`), release, serial, with the 20 skips: 179 passed, 2 failed, 0 ignored. The 2 failures, `real::dispatch_chain::tests::an_indirect_dispatch_runs_its_chain_without_any_whole_form` and `real::dispatch_chain::tests::failed_binding_keeps_indirect_commands_until_allocator_reset` (E_INVALIDARG from the driver on this adapter), fail the same way on `main` d52ff48c. - This PR at 210eaf33, on `main` 53e85fb1, against `main` 53e85fb1 (same commands, same machine): - `cargo test --release --workspace --no-fail-fast -- --test-threads=4`: the lib test binary ends early on `main` too (exit 0x80004005 after `sparse upload preparation still failed after bounded retries`), so the lib was also run alone, serially (`--test-threads=1`), with `--skip` for the 20 tests that end the binary on `main` (6 `list_x`, 12 `sparse`, 1 `texture_upload`, 1 `uma_driver`; each passes alone). - integration tests: 139 passed, 0 failed, 20 ignored; `main`: the same. - lib, serial with the 20 skips: 2630 passed, 15 failed, 29 ignored. `main`: 2617 passed, 16 failed, 29 ignored, with `vram::tests::d32s8_targets_take_their_own_size_of_video_memory` also skipped because it ended the binary there. Every failure here also fails on `main` (12 `title_textures`, `list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list`, `standin::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline`, and that `d32s8` test); two that failed on `main` passed here (`alloc_pool::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_reads`, `vram::superseded_texture_waits_for_every_title_queue`), both intermittent in the long run. - SKIPPED on this adapter (same on `main`): the wave64 forms (no wave64), three f16/f32 per-lane forms refused by the recompiler, and the heap-window tests (no heap windows). - Earlier, on `c20818a` (debug, against an older `main`): 1445 passed, 1 failed (`list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list`, intermittent on `main` too), 47 ignored. - The 9 tests in `gpu::tdr::tests` pass, among them a reader that fails on its first call (`ERROR_TIMEOUT`), one that fails after a partial batch, an injected recent event, and a malformed query, which Windows refuses with `ERROR_EVT_INVALID_QUERY`. The two tests that read the real System log print `SKIPPED` where a valid query cannot read it (Wine's `wevtapi` gives error 0), and otherwise fail only on a query Windows refuses. The 2 tests in `real::report_once_tests` pass: a second caller waits for the report, and the reporting thread coming back (through the unhandled-exception filter) does not hang. The query of `recent_resets`, run over the last 24 h with `Get-WinEvent -FilterXPath`, found the 24 events 4101 of this machine that day. - In the PR's smoke run the log has, after the adapter line: ``` D3D12.X: Windows resets the GPU when it does not preempt within 10 s (TdrDelay 10), per the registry (read by Windows at boot) ``` (`TdrDelay` is 10 on this machine for an earlier test; it is 2 s when not set.) - **Real removals**, each in a 600 s run of a retail title. The tree was this PR on a test tree: `main` + #2404 and others, with a 1 GiB shader heap profile. - **With the code of `4c8f841`** (its `tdr.rs` and `ReportOnce` copied in as they are; the head `c20818a` changes only a test since). The thread number is in brackets: ``` [ 7.8 s] D3D12.X: Windows resets the GPU when it does not preempt within 10 s (TdrDelay 10), per the registry (read by Windows at boot) [530.0 s] (41108) D3D12 device removed: 0x887a0006 The GPU will not respond to more commands, … [531.2 s] (41108) D3D12 device removed: 1 Display 4101 event(s) in the System log in the last 30 s, consistent with Windows' GPU timeout (the event does not name the device) – … [531.2 s] (18116) the D3D12 device was removed (0x887a0006: …) – the title is stopped ``` - The System log has the 4101 event at that time, after three `nvlddmkm` 153 events in the 15 s before. - The note found the event 1.2 s after the removal, inside the 3 s wait. - `stop_if_device_removed` on another thread ended the process 6 ms after the note. - **Earlier versions:** - A 4101 case on the first version, at 259.0 s: the note found the event 1.6 s later. - A case without the event, with the lock version of the wait: `0x887a0007` at 233.3 s. The note `no Display 4101 event in the System log in the last 30 s: …` came at 236.6 s, and the process ended after it. The System log has no 4101 in that window. - One run before the wait existed: the process ended 70 ms after the removal, and the note was lost. **Test reports from others** (on earlier heads: `c9e51e5` is before both review fixes and the report lock, `e1ac7f0` before the `TdrLevel` wording, `4c8f841` before the Wine skip) - AMD Radeon RX 9060 XT (RDNA4), Windows 11, on `e1ac7f0` ([emirduran707](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7190094179)): the 8 `gpu::tdr` tests pass. The suite had 1441 passed and 2 failed, both `dxil::fuzz_tests` that fail on `main` there too. Smoke: 1601 frames, 0 removals (`main`: 1603). - RTX 4060 Laptop, Linux with Wine 11 and a locally built vkd3d-proton, on `4c8f841` ([pickles976](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7190755996)): 8 of 9 `gpu::tdr` tests and both `report_once` tests pass. Wine's `wevtapi` reads no System log (error 0), and `a_query_windows_refuses_is_told_apart` failed on that. It now skips there like the other System-log test (`c20818a`). Under Wine the note after a removal should read `the System log could not be read …` (not run there). - RTX 4080 SUPER, Windows 11, on `c9e51e5` ([sage-sage](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7189462806)): 1440 passed, 0 failed, and the `gpu::tdr` tests of that head pass, including the System log read. **Regression run** `scripts/smoke.ps1 -Seconds 120 -Title 'retail title A'`, release builds of clean trees, one after the other on the machine in **Tested**, with `XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000`. The title is left on its own, with no input; the shader cache was warmed by two runs of `main` before. `main`: ``` xcl-smoke v1 commit: a815de932c4dc8da3b383ca44f4b094aa406fec9 gpu: NVIDIA GeForce RTX 3070 Laptop GPU title: retail title A seconds: 120 exit: 0x0 frames shown: 3287 (PresentX 3287) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14432 MB ``` This PR: ``` xcl-smoke v1 commit: 53c67afa1ccbc154dd9f4a387c817b5bd8c9f750 gpu: NVIDIA GeForce RTX 3070 Laptop GPU title: retail title A seconds: 120 exit: 0x0 frames shown: 3360 (PresentX 3360) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15126 MB ``` **Not tested** - When the title ends by itself during the note's wait (3 s at most), the note is lost and the process exit code is the title's; the DRED lines and `report.json` are written before the wait. - `TdrDdiDelay`, the time a thread may stay inside the driver (5 s by default), is another way to a TDR. The start line does not name it; the removals measured here were the GPU not preempting. - A machine where the System log cannot be read. - Intel. AMD and Windows 11 only through the reports above, which had no real removal. **AI use** - Claude Code (Claude Opus 5.5) wrote the module, the tests and this description. It also ran the suite and the smoke runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
luckyteagirl commented 2026-11-26 10:02:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:02:14Z.

Review: COMMENTED


On c9e51e5, recent_resets treats every EvtNext == FALSE as the normal end of the System-log query and returns Some(n). Microsoft's EvtNext contract says only GetLastError() == ERROR_NO_MORE_ITEMS means enumeration finished; a one-second timeout sets ERROR_TIMEOUT, and other read errors can occur. If the first EvtNext fails that way, this code returns Some(0), and removal_note eventually reports no Display 4101 event / probably not a Windows timeout even though the evidence could not be read. A failure after a partial batch can likewise present an incomplete count as a complete query.

Could the read return an unknown/error outcome for any false result other than ERROR_NO_MORE_ITEMS, preserving the distinction from a genuinely empty query? Please close the query handle on both paths and cover a first-call timeout plus finite empty enumeration with an injected/mock event reader. This is exact-head source review based on the Win32 API contract; I did not force an Event Log timeout at runtime.

<!-- greyfinch-sync:ivall/xcl:review:6072037750 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#pullrequestreview-6072037750). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T10:02:14Z. **Review:** COMMENTED --- On `c9e51e5`, `recent_resets` treats every `EvtNext == FALSE` as the normal end of the System-log query and returns `Some(n)`. [Microsoft's `EvtNext` contract](https://learn.microsoft.com/en-us/windows/win32/api/winevt/nf-winevt-evtnext) says only `GetLastError() == ERROR_NO_MORE_ITEMS` means enumeration finished; a one-second timeout sets `ERROR_TIMEOUT`, and other read errors can occur. If the first `EvtNext` fails that way, this code returns `Some(0)`, and `removal_note` eventually reports no Display 4101 event / probably not a Windows timeout even though the evidence could not be read. A failure after a partial batch can likewise present an incomplete count as a complete query. Could the read return an unknown/error outcome for any false result other than `ERROR_NO_MORE_ITEMS`, preserving the distinction from a genuinely empty query? Please close the query handle on both paths and cover a first-call timeout plus finite empty enumeration with an injected/mock event reader. This is exact-head source review based on the Win32 API contract; I did not force an Event Log timeout at runtime.
luckyteagirl commented 2026-11-26 10:02:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:02:20Z.

Review: COMMENTED


On c9e51e5, removal_note reports “it was Windows' GPU timeout” whenever it finds any system-wide Display 4101 in the prior 30 seconds. The query does not identify this device or bind the event to this removal. On a multi-adapter machine, another display adapter can reset in that interval; even on one adapter, an earlier recovered timeout can coexist with a later unrelated removal. The evidence is useful, but it does not establish that this specific device removal was caused by that event.

Could the log call this a recent Display 4101 event consistent with a Windows timeout, unless the event can be correlated to this device and removal time more tightly? A test can inject a recent event and assert the note stays probabilistic. This is exact-head source review; I did not reproduce a multi-adapter reset.

<!-- greyfinch-sync:ivall/xcl:review:6072039349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#pullrequestreview-6072039349). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T10:02:20Z. **Review:** COMMENTED --- On `c9e51e5`, `removal_note` reports “it was Windows' GPU timeout” whenever it finds *any* system-wide Display 4101 in the prior 30 seconds. The query does not identify this device or bind the event to this removal. On a multi-adapter machine, another display adapter can reset in that interval; even on one adapter, an earlier recovered timeout can coexist with a later unrelated removal. The evidence is useful, but it does not establish that this specific device removal was caused by that event. Could the log call this a recent Display 4101 event consistent with a Windows timeout, unless the event can be correlated to this device and removal time more tightly? A test can inject a recent event and assert the note stays probabilistic. This is exact-head source review; I did not reproduce a multi-adapter reset.
luckyteagirl commented 2026-11-26 10:49:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:49:14Z.

Review: COMMENTED


On current head e1ac7f0213876e499786a4307deea67ca16b5c52, describe(Settings { level: Some(1), delay: Some(10) }) says Windows resets the GPU after a submission runs over 10 seconds. Microsoft's TDR registry documentation defines TdrLevel=1 as a system bug check on detected timeout, with no recovery; TdrDelay is the scheduler's preemption-wait threshold. This note would therefore give the wrong outcome for a configured level 1, and it also treats the unimplemented level 2 as recovery. Could describe distinguish these levels and phrase the delay as a preemption timeout? A table-driven test for levels 0, 1, and 3 would capture the important distinction. This is a source and API-contract check; I did not trigger a TDR.

AI use: OpenAI Codex (GPT-6.2 Sol) found and checked the configuration path; OpenAI Codex (GPT-6.2 Astra) verified the source and Microsoft documentation and wrote this review.

<!-- greyfinch-sync:ivall/xcl:review:6072781277 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#pullrequestreview-6072781277). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T10:49:14Z. **Review:** COMMENTED --- On current head `e1ac7f0213876e499786a4307deea67ca16b5c52`, `describe(Settings { level: Some(1), delay: Some(10) })` says Windows resets the GPU after a submission runs over 10 seconds. [Microsoft's TDR registry documentation](https://learn.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys) defines `TdrLevel=1` as a **system bug check on detected timeout, with no recovery**; `TdrDelay` is the scheduler's preemption-wait threshold. This note would therefore give the wrong outcome for a configured level 1, and it also treats the unimplemented level 2 as recovery. Could `describe` distinguish these levels and phrase the delay as a preemption timeout? A table-driven test for levels 0, 1, and 3 would capture the important distinction. This is a source and API-contract check; I did not trigger a TDR. AI use: OpenAI Codex (GPT-6.2 Sol) found and checked the configuration path; OpenAI Codex (GPT-6.2 Astra) verified the source and Microsoft documentation and wrote this review.
Raul-Paiva commented 2026-11-26 11:05:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T10:24:37Z.


Thanks @luckyteagirl, both points were right. Fixed in abdb439 (squashed into the one commit):

  1. EvtNext failures. The loop now goes through count_events, which ends with a count only on ERROR_NO_MORE_ITEMS. Any other GetLastError, on the first read or after a partial batch, gives None, and the note then says the System log could not be read, not "no event". The query handle is closed on both paths (EvtClose(h) after count_events, whatever it returns). only_the_end_of_the_query_gives_a_count drives it with an injected reader: an empty end, two batches then the end, a first-call ERROR_TIMEOUT, and a timeout after a batch.
  2. What a 4101 event proves. The note no longer says "it was". It now reads N Display 4101 event(s) in the System log in the last 30 s, consistent with Windows' GPU timeout (the event does not name the device). a_recent_event_is_evidence_not_proof injects a recent event and checks that wording. an_event_written_after_the_removal_is_still_found covers the 3 s wait.

The description has the new test counts and a smoke run on abdb439. The one suite failure in that run is vram::tests::d32s8_targets_take_their_own_size_of_video_memory (E_FAIL under parallel load; it passes alone and this change does not touch vram.rs).

AI use: Claude Code (Claude Opus 5.5) made the changes and wrote this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7189327828 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7189327828). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-11-26T10:24:37Z. --- Thanks @luckyteagirl, both points were right. Fixed in `abdb439` (squashed into the one commit): 1. **`EvtNext` failures.** The loop now goes through `count_events`, which ends with a count only on `ERROR_NO_MORE_ITEMS`. Any other `GetLastError`, on the first read or after a partial batch, gives `None`, and the note then says the System log could not be read, not "no event". The query handle is closed on both paths (`EvtClose(h)` after `count_events`, whatever it returns). `only_the_end_of_the_query_gives_a_count` drives it with an injected reader: an empty end, two batches then the end, a first-call `ERROR_TIMEOUT`, and a timeout after a batch. 2. **What a 4101 event proves.** The note no longer says "it was". It now reads `N Display 4101 event(s) in the System log in the last 30 s, consistent with Windows' GPU timeout (the event does not name the device)`. `a_recent_event_is_evidence_not_proof` injects a recent event and checks that wording. `an_event_written_after_the_removal_is_still_found` covers the 3 s wait. The description has the new test counts and a smoke run on `abdb439`. The one suite failure in that run is `vram::tests::d32s8_targets_take_their_own_size_of_video_memory` (`E_FAIL` under parallel load; it passes alone and this change does not touch `vram.rs`). AI use: Claude Code (Claude Opus 5.5) made the changes and wrote this reply.
sage-sage commented 2026-11-26 11:05:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by sage-sage on 2026-11-26T10:30:42Z.


Test report: passes on NVIDIA. Exact head c9e51e5c (its base is current main b49be18, so head = merged).

Tested

  • RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build
  • cargo test --workspace -- --test-threads=4: 1440 passed, 0 failed, 47 ignored; the four gpu::tdr::tests pass, including the_system_log_and_the_settings_can_be_read on this Windows build
  • SKIPPED: 29 lines, the same as on main on this machine (wave64, debug layer, Developer Mode, heap windows)

Not tested

  • No real device removal or TDR here, so not removal_note() on a hung device; AMD, Intel.

Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7189462806 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7189462806). Originally posted by [sage-sage](https://github.com/sage-sage) on 2026-11-26T10:30:42Z. --- **Test report: passes on NVIDIA.** Exact head `c9e51e5c` (its base is current `main` `b49be18`, so head = merged). **Tested** - RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build - `cargo test --workspace -- --test-threads=4`: 1440 passed, 0 failed, 47 ignored; the four `gpu::tdr::tests` pass, including `the_system_log_and_the_settings_can_be_read` on this Windows build - SKIPPED: 29 lines, the same as on `main` on this machine (wave64, debug layer, Developer Mode, heap windows) **Not tested** - No real device removal or TDR here, so not `removal_note()` on a hung device; AMD, Intel. Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Raul-Paiva commented 2026-11-26 11:05:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T10:44:48Z.


One more fix, squashed in e1ac7f0. It comes from a real removal, not the review.

On another run with this PR, the device was removed and the note never reached the log. Two threads saw the removal at the same time:

  • the first logged D3D12 device removed and waited for the 4101 event;
  • stop_if_device_removed on a second thread found the report already started (DONE was set) and ended the process 70 ms later.

log_device_removed now holds a lock for the whole report, so a second caller waits for it and then returns.

With the lock, on the next real removal (0x887a0007 at 233.3 s, no 4101 event in the System log), the note came at 236.6 s and the process ended after it.

On e1ac7f0:

  • suite: 1443 passed, 0 failed, 47 ignored;
  • smoke: 1346 frames, 0 removals.

The description is updated.

@sage-sage, thanks for the test on c9e51e5. The change since is in tdr.rs, plus the lock in real.rs.

AI use: Claude Code (Claude Opus 5.5) found the race in the run log, made the fix and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7189779656 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7189779656). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-11-26T10:44:48Z. --- One more fix, squashed in `e1ac7f0`. It comes from a real removal, not the review. On another run with this PR, the device was removed and the note never reached the log. Two threads saw the removal at the same time: - the first logged `D3D12 device removed` and waited for the 4101 event; - `stop_if_device_removed` on a second thread found the report already started (`DONE` was set) and ended the process 70 ms later. `log_device_removed` now holds a lock for the whole report, so a second caller waits for it and then returns. With the lock, on the next real removal (`0x887a0007` at 233.3 s, no 4101 event in the System log), the note came at 236.6 s and the process ended after it. On `e1ac7f0`: - suite: 1443 passed, 0 failed, 47 ignored; - smoke: 1346 frames, 0 removals. The description is updated. @sage-sage, thanks for the test on `c9e51e5`. The change since is in `tdr.rs`, plus the lock in `real.rs`. AI use: Claude Code (Claude Opus 5.5) found the race in the run log, made the fix and wrote this.
emirduran707 commented 2026-11-26 11:05:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-26T10:58:43Z.


Independent AMD RDNA4 (native wave64) verification of exact PR head e1ac7f0213876e499786a4307deea67ca16b5c52 on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1441 passed, 2 failed, 47 ignored (8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1 heap_window_out_of_memory_falls_back_to_the_switch_form no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • All 8 new gpu::tdr::tests::* tests passed on this Windows 11 machine (a_recent_event_is_evidence_not_proof, an_event_written_after_the_removal_is_still_found, only_hung_and_reset_devices_are_timeouts, only_the_end_of_the_query_gives_a_count, other_removals_get_no_note, the_query_asks_for_display_4101_in_a_window, the_settings_are_described_as_windows_applies_them, the_system_log_and_the_settings_can_be_read).
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3) are pre-existing on unmodified main on this RX 9060 XT / driver 32.0.31044.16.
  • cargo build --release -p xcl + 60 s retail-title smoke test (scripts/smoke.ps1, offline):
xcl-smoke v1
commit: e1ac7f0213876e499786a4307deea67ca16b5c52
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1601 (PresentX 1601)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18751 MB

(Compare against main b49be183 on this machine: 1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)

Not tested

  • Live TDR event triggering during a real GPU hang; NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.
<!-- greyfinch-sync:ivall/xcl:comment:7190094179 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7190094179). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-26T10:58:43Z. --- Independent AMD RDNA4 (native wave64) verification of exact PR head `e1ac7f0213876e499786a4307deea67ca16b5c52` on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver `32.0.31044.16`, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC `1.9.2602.17`). **Tested** - `cargo build --workspace` (debug): passed (`0` errors). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `1441 passed, 2 failed, 47 ignored` (`8 SKIPPED`: 6 per-lane DXIL forms refused by host adapter/driver, 1 `heap_window_out_of_memory_falls_back_to_the_switch_form` no heap windows, 1 `pso_measurement_compiles_an_exact_synthetic_record` Windows Developer Mode off). - All 8 new `gpu::tdr::tests::*` tests passed on this Windows 11 machine (`a_recent_event_is_evidence_not_proof`, `an_event_written_after_the_removal_is_still_found`, `only_hung_and_reset_devices_are_timeouts`, `only_the_end_of_the_query_gives_a_count`, `other_removals_get_no_note`, `the_query_asks_for_display_4101_in_a_window`, `the_settings_are_described_as_windows_applies_them`, `the_system_log_and_the_settings_can_be_read`). - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `fuzz_validate_and_gpu_3`) are pre-existing on unmodified `main` on this RX 9060 XT / driver `32.0.31044.16`. - `cargo build --release -p xcl` + 60 s retail-title smoke test (`scripts/smoke.ps1`, offline): ``` xcl-smoke v1 commit: e1ac7f0213876e499786a4307deea67ca16b5c52 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1601 (PresentX 1601) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18751 MB ``` (Compare against `main` `b49be183` on this machine: `1603 frames, 18576 MB peak, 0 device removals, 0 crashes`.) **Not tested** - Live TDR event triggering during a real GPU hang; NVIDIA / Intel GPUs, Linux / Wine. **AI use** - Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.
Raul-Paiva commented 2026-11-26 11:05:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T10:58:46Z.


Thanks @luckyteagirl, right again. Fixed in 1949ac1 (squashed; e0ddf63 has the same tree with the old commit message).

describe now follows the TDR registry keys. TdrDelay is phrased as the preemption timeout, and the level decides what follows:

  • TdrLevel 0: detection off.
  • TdrLevel 1: Windows bug-checks, with no recovery, when the GPU does not preempt within N s ….
  • TdrLevel 3 or unset: Windows resets the GPU when it does not preempt within N s ….
  • Any other value, 2 included: named as a level Windows does not implement, so it is never described as a recovery.

the_settings_are_described_as_windows_applies_them is now a table over unset, 0, 1, 2 and 3. The module comment and the commit message had the same "submission runs over N s" wording; both are fixed.

On e0ddf63, the suite had 1442 passed and 1 failed. The failure was list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list, an intermittent one that also fails on main; it passed 3 of 3 runs alone. The smoke run on 1949ac1 is in the description.

AI use: Claude Code (Claude Opus 5.5) made the change and wrote this reply.

<!-- greyfinch-sync:ivall/xcl:comment:7190095624 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7190095624). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-11-26T10:58:46Z. --- Thanks @luckyteagirl, right again. Fixed in `1949ac1` (squashed; `e0ddf63` has the same tree with the old commit message). `describe` now follows [the TDR registry keys](https://learn.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys). `TdrDelay` is phrased as the preemption timeout, and the level decides what follows: - `TdrLevel` 0: detection off. - `TdrLevel` 1: `Windows bug-checks, with no recovery, when the GPU does not preempt within N s …`. - `TdrLevel` 3 or unset: `Windows resets the GPU when it does not preempt within N s …`. - Any other value, 2 included: named as a level Windows does not implement, so it is never described as a recovery. `the_settings_are_described_as_windows_applies_them` is now a table over unset, 0, 1, 2 and 3. The module comment and the commit message had the same "submission runs over N s" wording; both are fixed. On `e0ddf63`, the suite had 1442 passed and 1 failed. The failure was `list_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list`, an intermittent one that also fails on `main`; it passed 3 of 3 runs alone. The smoke run on `1949ac1` is in the description. AI use: Claude Code (Claude Opus 5.5) made the change and wrote this reply.
Aniseto commented 2026-11-26 12:06:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T11:09:30Z.


Ran the TDR diagnostics tests at 1949ac11:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu::tdr::tests -- --test-threads=1 --nocapture
8 passed; 0 failed; 0 ignored; 1336 filtered out      (exit 0)

All eight tests pass here, including the one that reads this machine's real System log and registry TdrDelay/TdrLevel settings.

What this adds: the existing NVIDIA report is on an RTX 4080 SUPER (and an AMD one on RX 9060 XT), both on earlier heads. This is a Blackwell wave32 host at the current head, with a different driver and settings. I did not produce a real device removal here, so I am not adding evidence about the 4101 event in a live run.

Not tested: a real 0x887a0006/0x887a0007 removal on this host, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7190349539 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7190349539). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-26T11:09:30Z. --- Ran the TDR diagnostics tests at `1949ac11`: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu::tdr::tests -- --test-threads=1 --nocapture 8 passed; 0 failed; 0 ignored; 1336 filtered out (exit 0) ``` All eight tests pass here, including the one that reads this machine's real System log and registry `TdrDelay`/`TdrLevel` settings. What this adds: the existing NVIDIA report is on an RTX 4080 SUPER (and an AMD one on RX 9060 XT), both on earlier heads. This is a Blackwell wave32 host at the current head, with a different driver and settings. I did not produce a real device removal here, so I am not adding evidence about the 4101 event in a live run. Not tested: a real `0x887a0006`/`0x887a0007` removal on this host, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
pickles976 commented 2026-11-26 12:06:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-26T11:27:37Z.


Wine/NVIDIA verification of exact head 4c8f8411783ff092df10aaaec45f6a21573f9f89 (Linux 6.17, Wine 11.0, RTX 4060 Laptop 8 GB, NVIDIA 590.48.1, DXVK 3.1.1, Rust 1.98.1 x86_64-pc-windows-msvc). Caveat: locally built diagnostic-relaxed vkd3d-proton 3.2.0 2576c0b4adfae4a+ — not stock-runtime certification. Unchanged owner code; fresh 28.37 s compile; one test thread; 9 GiB/512 MiB cgroup scope. Log verify-pr2748-tdr.log kept locally.

gpu::tdr::tests 8/9. Passing: only_hung_and_reset_devices_are_timeouts, the_settings_are_described_as_windows_applies_them, the_query_asks_for_display_4101_in_a_window, only_the_end_of_the_query_gives_a_count, a_recent_event_is_evidence_not_proof, an_event_written_after_the_removal_is_still_found, other_removals_get_no_note, and the_system_log_and_the_settings_can_be_read — the last via its designed skip path: under Wine the System log is not readable (error 0), which is exactly the case the test's guard is written for.

One failure, and it is a Wine wevtapi fidelity gap, not a logic defect: a_query_windows_refuses_is_told_apart panics with a malformed query gave Err(0) — EvtExecuteQuery("*[System[EventID=") returns Err(0) under Wine rather than ERROR_EVT_INVALID_QUERY. On Windows this test would classify the refusal; Wine's wevtapi does not distinguish a malformed query from other failures here. I did not modify the test. This means the TDR-verification value of the PR on Wine stacks is limited to the non-query logic (settings description, hang-code classification, removal-note construction), while the actual System-log query needs Windows to prove out.

real::report_once_tests 2/2: a_second_caller_waits_for_the_first_report and the_reporting_thread_coming_back_does_not_hang both pass (0.21 s each), including the reporting-thread reuse path.

No device removal was triggered here and no title was run; this is the module's unit surface only.

AI use: omp, harness model openai-codex/gpt-6-astra, ran the checks and drafted this report. No upstream code changes or assets attached.

<!-- greyfinch-sync:ivall/xcl:comment:7190755996 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7190755996). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-26T11:27:37Z. --- Wine/NVIDIA verification of exact head `4c8f8411783ff092df10aaaec45f6a21573f9f89` (Linux 6.17, Wine 11.0, RTX 4060 Laptop 8 GB, NVIDIA 590.48.1, DXVK 3.1.1, Rust 1.98.1 x86_64-pc-windows-msvc). **Caveat: locally built diagnostic-relaxed vkd3d-proton 3.2.0 `2576c0b4adfae4a+` — not stock-runtime certification.** Unchanged owner code; fresh 28.37 s compile; one test thread; 9 GiB/512 MiB cgroup scope. Log `verify-pr2748-tdr.log` kept locally. **`gpu::tdr::tests` 8/9.** Passing: `only_hung_and_reset_devices_are_timeouts`, `the_settings_are_described_as_windows_applies_them`, `the_query_asks_for_display_4101_in_a_window`, `only_the_end_of_the_query_gives_a_count`, `a_recent_event_is_evidence_not_proof`, `an_event_written_after_the_removal_is_still_found`, `other_removals_get_no_note`, and `the_system_log_and_the_settings_can_be_read` — the last via its designed skip path: under Wine the System log is not readable (`error 0`), which is exactly the case the test's guard is written for. **One failure, and it is a Wine `wevtapi` fidelity gap, not a logic defect:** `a_query_windows_refuses_is_told_apart` panics with `a malformed query gave Err(0)` — `EvtExecuteQuery("*[System[EventID=")` returns `Err(0)` under Wine rather than `ERROR_EVT_INVALID_QUERY`. On Windows this test would classify the refusal; Wine's wevtapi does not distinguish a malformed query from other failures here. I did not modify the test. This means the TDR-verification value of the PR on Wine stacks is limited to the non-query logic (settings description, hang-code classification, removal-note construction), while the actual System-log query needs Windows to prove out. **`real::report_once_tests` 2/2:** `a_second_caller_waits_for_the_first_report` and `the_reporting_thread_coming_back_does_not_hang` both pass (0.21 s each), including the reporting-thread reuse path. No device removal was triggered here and no title was run; this is the module's unit surface only. AI use: omp, harness model `openai-codex/gpt-6-astra`, ran the checks and drafted this report. No upstream code changes or assets attached.
Raul-Paiva commented 2026-11-26 12:06:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T11:43:13Z.


@pickles976, thanks for the Wine run. You were right about the cause, and the test was the problem: a_query_windows_refuses_is_told_apart only skipped on ERROR_ACCESS_DENIED. It now first runs a valid query, and if that cannot read the System log (your error 0), it prints SKIPPED like the_system_log_and_the_settings_can_be_read. It asserts ERROR_EVT_INVALID_QUERY only where the log can be read.

That is in c20818a, the new head; only that test changed since 4c8f841. When you have time, could you run gpu::tdr::tests there again under Wine? I expect 9 passed, with 2 SKIPPED lines. If you also run real::report_once_tests and the rest of the suite, that would help too.

AI use: Claude Code (Claude Opus 5.5) made the change and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7191081099 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7191081099). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-11-26T11:43:13Z. --- @pickles976, thanks for the Wine run. You were right about the cause, and the test was the problem: `a_query_windows_refuses_is_told_apart` only skipped on `ERROR_ACCESS_DENIED`. It now first runs a valid query, and if that cannot read the System log (your `error 0`), it prints `SKIPPED` like `the_system_log_and_the_settings_can_be_read`. It asserts `ERROR_EVT_INVALID_QUERY` only where the log can be read. That is in `c20818a`, the new head; only that test changed since `4c8f841`. When you have time, could you run `gpu::tdr::tests` there again under Wine? I expect 9 passed, with 2 `SKIPPED` lines. If you also run `real::report_once_tests` and the rest of the suite, that would help too. AI use: Claude Code (Claude Opus 5.5) made the change and wrote this.
Aniseto commented 2026-11-26 12:07:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T12:00:26Z.


Re-ran the TDR diagnostics tests at c20818ac after the head moved again (124 lines changed across gpu/tdr.rs and hle/d3d12x/real.rs, with a new test for a refused event query).

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu::tdr::tests -- --test-threads=1 --nocapture
9 passed; 0 failed; 0 ignored; 1338 filtered out      (exit 0)

All nine pass here, including the new a_query_windows_refuses_is_told_apart and the test that reads this machine's real System log and TDR registry settings. This is a new report following mine at 1949ac11, not an edit.

Not tested: a real 0x887a0006/0x887a0007 removal on this host, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7191445076 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7191445076). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-26T12:00:26Z. --- Re-ran the TDR diagnostics tests at `c20818ac` after the head moved again (124 lines changed across `gpu/tdr.rs` and `hle/d3d12x/real.rs`, with a new test for a refused event query). Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=nvidia cargo test -p xcl --lib gpu::tdr::tests -- --test-threads=1 --nocapture 9 passed; 0 failed; 0 ignored; 1338 filtered out (exit 0) ``` All nine pass here, including the new `a_query_windows_refuses_is_told_apart` and the test that reads this machine's real System log and TDR registry settings. This is a new report following mine at `1949ac11`, not an edit. Not tested: a real `0x887a0006`/`0x887a0007` removal on this host, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, Wine, release profile, title data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Decodere commented 2026-11-26 13:05:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T12:10:44Z.


Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2748 at c20818ac7c6f653561959767ea20b918cf5594b3 (exact parent origin/main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)

Targeted Win11 / RTX 4060 release unit tests (c20818ac)

  • cargo test --release -p xcl --lib gpu::tdr:: -- --test-threads=4 --nocapture: 9 passed, 0 failed, 0 ignored (0.50 s, 0 skipped, exit 0), including live Windows 11 26200 System Event Log + TDR registry checks (the_system_log_and_the_settings_can_be_read, a_query_windows_refuses_is_told_apart, a_recent_event_is_evidence_not_proof, an_event_written_after_the_removal_is_still_found, the_settings_are_described_as_windows_applies_them, the_query_asks_for_display_4101_in_a_window, only_hung_and_reset_devices_are_timeouts, only_the_end_of_the_query_gives_a_count, and other_removals_get_no_note).
  • cargo test --release -p xcl --lib hle::d3d12x::real:: -- --test-threads=4: 62 passed, 0 failed, 0 ignored (0.74 s, 0 skipped, exit 0).

Observations

  • All 9 gpu::tdr::tests (including live native Windows 11 System Event Log query and TDR registry inspection, with 0 skips) and all 62 hle::d3d12x::real:: tests passed cleanly in --release on exact head c20818ac.
  • Quiet 60 s retail smoke ran cleanly (exit: 0x0, 1558 frames shown, 60 60 60 steady-state presents per 2 s, 0 device removals, 0 crashes, 14008 MB peak commit vs parent b49be183's 14018 MB / 1518 frames).

Paired 60 s RTX 4060 smoke (b49be183 vs c20818ac)

Parent origin/main (b49be183):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB

PR #2748 head (c20818ac):

xcl-smoke v1
commit: c20818ac7c6f653561959767ea20b918cf5594b3
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1558 (PresentX 1559)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14008 MB

Limits of coverage

  • Full workspace test suite was not re-run on c20818ac (only targeted gpu::tdr:: and hle::d3d12x::real:: release tests plus paired quiet 60 s smoke).
  • The quiet 60 s retail smoke exited with 0 device removals, so a real live GPU TDR hang / Display 4101 event emission on removal was not provoked on this host (live Event Log / TDR registry queries and Display 4101 correlation logic are covered by gpu::tdr::tests).
  • Native Windows 11 (26200) / RTX 4060 only; no Wine/Linux run on this host.

AI use

Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts and smoke blocks were taken directly from cargo test and scripts/smoke.ps1 outputs.

<!-- greyfinch-sync:ivall/xcl:comment:7191666975 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7191666975). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T12:10:44Z. --- **Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2748 at `c20818ac7c6f653561959767ea20b918cf5594b3`** (exact parent `origin/main` `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7`). Measurements and targeted test results only; not a full source review. ### Setup - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` - **Toolchain / caches:** `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.9.2609.5`, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs) - **Workload:** Retail workload `title: 29640639` via `scripts/smoke.ps1 -Seconds 60` (`XCL_NETWORK=0 XCL_ACTIVITY=1`, default flags, no input) ### Targeted Win11 / RTX 4060 release unit tests (`c20818ac`) - `cargo test --release -p xcl --lib gpu::tdr:: -- --test-threads=4 --nocapture`: **9 passed, 0 failed, 0 ignored** (`0.50 s`, `0` skipped, exit `0`), including live Windows 11 `26200` System Event Log + TDR registry checks (`the_system_log_and_the_settings_can_be_read`, `a_query_windows_refuses_is_told_apart`, `a_recent_event_is_evidence_not_proof`, `an_event_written_after_the_removal_is_still_found`, `the_settings_are_described_as_windows_applies_them`, `the_query_asks_for_display_4101_in_a_window`, `only_hung_and_reset_devices_are_timeouts`, `only_the_end_of_the_query_gives_a_count`, and `other_removals_get_no_note`). - `cargo test --release -p xcl --lib hle::d3d12x::real:: -- --test-threads=4`: **62 passed, 0 failed, 0 ignored** (`0.74 s`, `0` skipped, exit `0`). ### Observations - All 9 `gpu::tdr::tests` (including live native Windows 11 System Event Log query and TDR registry inspection, with `0` skips) and all 62 `hle::d3d12x::real::` tests passed cleanly in `--release` on exact head `c20818ac`. - Quiet 60 s retail smoke ran cleanly (`exit: 0x0`, `1558` frames shown, `60 60 60` steady-state presents per 2 s, `0` device removals, `0` crashes, `14008 MB` peak commit vs parent `b49be183`'s `14018 MB` / `1518` frames). ### Paired 60 s RTX 4060 smoke (`b49be183` vs `c20818ac`) Parent `origin/main` (`b49be183`): ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1518 (PresentX 1518) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14018 MB ``` PR #2748 head (`c20818ac`): ``` xcl-smoke v1 commit: c20818ac7c6f653561959767ea20b918cf5594b3 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1558 (PresentX 1559) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14008 MB ``` ### Limits of coverage - Full workspace test suite was not re-run on `c20818ac` (only targeted `gpu::tdr::` and `hle::d3d12x::real::` release tests plus paired quiet 60 s smoke). - The quiet 60 s retail smoke exited with `0` device removals, so a real live GPU TDR hang / Display 4101 event emission on removal was not provoked on this host (live Event Log / TDR registry queries and Display 4101 correlation logic are covered by `gpu::tdr::tests`). - Native Windows 11 (`26200`) / RTX 4060 only; no Wine/Linux run on this host. ### AI use Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts and smoke blocks were taken directly from `cargo test` and `scripts/smoke.ps1` outputs.
Raul-Paiva commented 2026-11-27 11:32:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-27T11:32:14Z.


Status update, and three real removals the diagnostic caught.

Review points: all three from @luckyteagirl are addressed.

  • The EvtNext end-of-enumeration and the wording of a 4101 that isn't tied to this device: abdb439.
  • TdrLevel wording per level: 1949ac1.
  • The skip path under Wine: c20818a.

Could you take another look when you have time?

The head c20818ac still merges cleanly into main; main has moved 23 commits since the base. I can rebase it and rerun the smoke on main and on the new head if that helps the merge.

In use: this commit has been in my local test tree (main 8b957be plus several open PRs) for the last day. It names the cause on three 0x887a0007 removals during a retail title. All three came with DRED page fault at GPU VA 0x0.

Run Removal at (log time) The diagnostic, ~3 s later
1 474.2 s no Display 4101 event in the System log in the last 30 s: not Windows' GPU timeout, as far as the log shows (TdrDelay 10)
2 462.3 s same
3 436.0 s same

So on this machine (RTX 3070 Laptop 8 GB, driver 621.24, Windows 10 19045), these hangs are not TDRs: they are a GPU page fault, which matches the separate VA 0x0 reports on #2404. The note came out once per removal, with no lost or doubled lines since the lock in e1ac7f0.

AI use: Claude Code (Claude Opus 5.5) collected the log lines and drafted this comment; I checked them against the logs.

<!-- greyfinch-sync:ivall/xcl:comment:7217187612 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7217187612). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-11-27T11:32:14Z. --- Status update, and three real removals the diagnostic caught. **Review points:** all three from @luckyteagirl are addressed. - The `EvtNext` end-of-enumeration and the wording of a 4101 that isn't tied to this device: abdb439. - TdrLevel wording per level: 1949ac1. - The skip path under Wine: c20818a. Could you take another look when you have time? The head c20818ac still merges cleanly into `main`; main has moved 23 commits since the base. I can rebase it and rerun the smoke on main and on the new head if that helps the merge. **In use:** this commit has been in my local test tree (main 8b957be plus several open PRs) for the last day. It names the cause on three 0x887a0007 removals during a retail title. All three came with DRED `page fault at GPU VA 0x0`. | Run | Removal at (log time) | The diagnostic, ~3 s later | |---|---|---| | 1 | 474.2 s | `no Display 4101 event in the System log in the last 30 s: not Windows' GPU timeout, as far as the log shows` (TdrDelay 10) | | 2 | 462.3 s | same | | 3 | 436.0 s | same | So on this machine (RTX 3070 Laptop 8 GB, driver 621.24, Windows 10 19045), these hangs are not TDRs: they are a GPU page fault, which matches the separate VA 0x0 reports on #2404. The note came out once per removal, with no lost or doubled lines since the lock in e1ac7f0. **AI use:** Claude Code (Claude Opus 5.5) collected the log lines and drafted this comment; I checked them against the logs.
Foniass commented 2026-12-01 08:52:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:52:17Z.


Triage (#1607) – head 86ca095

No open or merged PR reads the TDR settings or the Display 4101 event. Main has no TdrDelay/EvtQuery code.
Worth knowing: on DEVICE_HUNG/RESET, log_device_removed now polls the System log for up to 3 s (removal_note), and a second thread that sees the removal waits up to 5 s (ReportOnce::start), before stop_if_device_removed ends the process. This only affects a process that is already stopping. other_removals_get_no_note reads the machine's real registry and System log. Both required checks pass on 86ca095a.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305894625 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7305894625). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:52:17Z. --- **Triage (#1607)** – head 86ca095 No open or merged PR reads the TDR settings or the Display 4101 event. Main has no `TdrDelay`/`EvtQuery` code. Worth knowing: on DEVICE_HUNG/RESET, `log_device_removed` now polls the System log for up to 3 s (`removal_note`), and a second thread that sees the removal waits up to 5 s (`ReportOnce::start`), before `stop_if_device_removed` ends the process. This only affects a process that is already stopping. `other_removals_get_no_note` reads the machine's real registry and System log. Both required checks pass on 86ca095a. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
fromthemoonx commented 2026-12-03 13:24:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-03T13:24:15Z.


merge-check
base: a815de932c
head: 86ca095ac3
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3029 passed, 0 failed, 56 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same list as on main 395405e4; failing: none. The 11 new tests pass, with the real System log read (no skip).
review: read the whole diff (5 files, +320 -4).

  1. Medium: looking for the event can cost the crash report. log_device_removed waits up to 3 s for the 4101 event before it logs the DRED lines, and stop_if_device_removed writes report.json only after that. The title's other threads run on during the wait. If the title ends by itself then, the log has no DRED lines and report.json has no crash.
    Measured with the bundled test title under xcl run (debug build, XCL_DRED=1). Temporary code removed the device with ID3D12Device5::RemoveDevice 1.5 s after the backend started and called stop_if_device_removed. That gives 0x887a0005, so for this test I also let is_hang accept that code. 12 runs each:
DRED lines in the log crash in report.json 4101 note title ended by itself first
main 12 12 – 0
this PR 7 7 7 5
this PR + the change below 12 12 9 3

The change: take the note out of log_device_removed, and look for the event in stop_if_device_removed after write_final and log::flush, just before TerminateProcess. Then only the note can be lost. How often a retail title ends by itself within 3 s of a real hang I cannot say; the description's runs did not.
2) A second thread that sees the removal waits for the first one, at most 5 s, and the reporting thread coming back does not hang. Both are tested, and both look right to me.
3) Not tested: a real GPU timeout (I did not provoke one on this machine), a retail title, AMD.
performance: none while the device is fine (reasoned): two registry reads and one log line at start. After a hang the process ends up to 3 s later.
verdict: not yet: the wait for the event comes before the DRED lines and the crash report, which are then lost when the title ends first (point 1)
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)

@Raul-Paiva point 1 needs a change; the rest is fine.

The change I tried (scratch code, not polished)
// stop_if_device_removed, after report::write_final(Some(msg)) and log::flush():
static NOTE: ReportOnce = ReportOnce::new();
if let Some(_finished) = NOTE.start(std::time::Duration::from_secs(5)) {
    if let Some(note) = crate::gpu::tdr::removal_note(e.code().0 as u32, std::time::Duration::from_secs(3)) {
        crate::xlog_error!("D3D12 device removed: {note}");
        crate::log::flush();
    }
}
<!-- greyfinch-sync:ivall/xcl:comment:7379762504 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7379762504). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-12-03T13:24:15Z. --- merge-check base: a815de932c4dc8da3b383ca44f4b094aa406fec9 head: 86ca095ac3ee7e5c1f48e80ef68a9277114cf63c merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3029 passed, 0 failed, 56 ignored; SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same list as on main 395405e4; failing: none. The 11 new tests pass, with the real System log read (no skip). review: read the whole diff (5 files, +320 -4). 1) **Medium: looking for the event can cost the crash report.** `log_device_removed` waits up to 3 s for the 4101 event before it logs the DRED lines, and `stop_if_device_removed` writes `report.json` only after that. The title's other threads run on during the wait. If the title ends by itself then, the log has no DRED lines and `report.json` has no crash. Measured with the bundled test title under `xcl run` (debug build, `XCL_DRED=1`). Temporary code removed the device with `ID3D12Device5::RemoveDevice` 1.5 s after the backend started and called `stop_if_device_removed`. That gives 0x887a0005, so for this test I also let `is_hang` accept that code. 12 runs each: | | DRED lines in the log | crash in `report.json` | 4101 note | title ended by itself first | |---|---|---|---|---| | main | 12 | 12 | – | 0 | | this PR | **7** | **7** | 7 | 5 | | this PR + the change below | 12 | 12 | 9 | 3 | The change: take the note out of `log_device_removed`, and look for the event in `stop_if_device_removed` after `write_final` and `log::flush`, just before `TerminateProcess`. Then only the note can be lost. How often a retail title ends by itself within 3 s of a real hang I cannot say; the description's runs did not. 2) A second thread that sees the removal waits for the first one, at most 5 s, and the reporting thread coming back does not hang. Both are tested, and both look right to me. 3) Not tested: a real GPU timeout (I did not provoke one on this machine), a retail title, AMD. performance: none while the device is fine (reasoned): two registry reads and one log line at start. After a hang the process ends up to 3 s later. verdict: not yet: the wait for the event comes before the DRED lines and the crash report, which are then lost when the title ends first (point 1) hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5) @Raul-Paiva point 1 needs a change; the rest is fine. <details><summary>The change I tried (scratch code, not polished)</summary> ```rust // stop_if_device_removed, after report::write_final(Some(msg)) and log::flush(): static NOTE: ReportOnce = ReportOnce::new(); if let Some(_finished) = NOTE.start(std::time::Duration::from_secs(5)) { if let Some(note) = crate::gpu::tdr::removal_note(e.code().0 as u32, std::time::Duration::from_secs(3)) { crate::xlog_error!("D3D12 device removed: {note}"); crate::log::flush(); } } ``` </details>
Raul-Paiva commented 2026-12-03 15:22:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T15:22:26Z.


Thanks, point 1 is fixed in 53c67afa (rebased onto main a815de93), along the lines you tried.

  • log_device_removed no longer waits. The note is now log_removal_note, once per process through its own ReportOnce.
  • stop_if_device_removed calls it after report::write_final and log::flush, just before TerminateProcess.
  • One addition: the unhandled-exception filter (eh.rs) also logs the removal, and it now calls log_removal_note after its own report too. Otherwise that path would have lost the note altogether.

I reran your measurement here: RTX 3070 Laptop, debug build, XCL_DRED=1, the bundled title under xcl run, RemoveDevice 1.5 s after the backend started, is_hang taking 0x887a0005 for the test only, 12 runs each.

DRED lines crash in report.json 4101 note title ended by itself first
before (cb2bc007) 4 4 4 8
53c67afa 12 12 2 0

The title still ended by itself during the note's wait in 10 of 12 runs. That lost only the note, and the exit code was the title's own. The description says so under Not tested. Tests, integration counts and the smoke pair of this head are in the description.

The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.

<!-- greyfinch-sync:ivall/xcl:comment:7383031854 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7383031854). Originally posted by [Raul-Paiva](https://github.com/Raul-Paiva) on 2026-12-03T15:22:26Z. --- Thanks, point 1 is fixed in 53c67afa (rebased onto `main` a815de93), along the lines you tried. - `log_device_removed` no longer waits. The note is now `log_removal_note`, once per process through its own `ReportOnce`. - `stop_if_device_removed` calls it after `report::write_final` and `log::flush`, just before `TerminateProcess`. - One addition: the unhandled-exception filter (`eh.rs`) also logs the removal, and it now calls `log_removal_note` after its own report too. Otherwise that path would have lost the note altogether. I reran your measurement here: RTX 3070 Laptop, debug build, `XCL_DRED=1`, the bundled title under `xcl run`, `RemoveDevice` 1.5 s after the backend started, `is_hang` taking `0x887a0005` for the test only, 12 runs each. | | DRED lines | crash in `report.json` | 4101 note | title ended by itself first | |---|---|---|---|---| | before (cb2bc007) | 4 | 4 | 4 | 8 | | 53c67afa | 12 | 12 | 2 | 0 | The title still ended by itself during the note's wait in 10 of 12 runs. That lost only the note, and the exit code was the title's own. The description says so under **Not tested**. Tests, integration counts and the smoke pair of this head are in the description. The reply was posted by Claude Code (Claude Opus 5.5) on my behalf, and I reviewed it before it went out.
Foniass commented 2026-12-03 15:25:26 +00:00 (Migrated from github.com)

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


Follow-up review of 53c67afa, since 86ca095a (code reading only, not a merge-check) · 2 medium

In short: The new commit 53c67afa moves the System-log wait for Display event 4101 behind the report. log_device_removed no longer waits. stop_if_device_removed and the unhandled-exception filter call the new log_removal_note only after report.json is written and the log is flushed. That fixes the crash-report loss raised in the merge-check: by the author's rerun, 12 of 12 runs now keep the DRED lines and the report. The price is the note itself: it now came out in only 2 of 12 runs. The whole lib suite has not been run on this head.

Medium

  1. The timeout note is now lost in most removals. In the author's rerun, the title ended by itself during the 3 s wait in 10 of 12 runs, so only 2 notes reached the log. The wait for 4101 only starts after the report, at the very end. Start the System-log query in a background thread as soon as log_device_removed sees the removal, without blocking. Then log_removal_note waits only for what is left of the 3 s, after the report. The query gets the time the DRED dump and the report take, and nothing before the report waits for it.
  2. The whole lib suite is not reported on this head. Tested gives gpu::tdr, report_once, hle::d3d12x::real and the integration tests on 53c67afa, and says the lib counts are from earlier heads. This commit changes eh.rs and the removal path that every title can take. CONTRIBUTING.md asks for cargo test --workspace -- --test-threads=4 on the head under review.
Checked and fine
  • Earlier merge-check point fixed: the crash report could be lost. log_device_removed now logs the reason, the commit and the DRED data without waiting. stop_if_device_removed writes report.json and flushes the log before log_removal_note (real.rs ~12641).
  • log_removal_note runs once per process through its own ReportOnce, and only when GetDeviceRemovedReason reports a removal. A second caller waits at most 5 s for the first. It flushes the log after the note, since TerminateProcess follows.
  • In eh.rs the call sits after the report block and before the title's own filter is chained. It does nothing unless the device was removed, so ordinary unhandled exceptions are unchanged.
  • The 3 real::dispatch_chain failures fail the same way on main a815de93 on that adapter, as the description says.
  • The smoke pair is on a retail title, of main a815de93 and this head.

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

<!-- greyfinch-sync:ivall/xcl:comment:7383116582 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2748#issuecomment-7383116582). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T15:25:26Z. --- **Follow-up review** of `53c67afa`, since `86ca095a` (code reading only, not a merge-check) · 2 medium **In short:** The new commit `53c67afa` moves the System-log wait for Display event 4101 behind the report. `log_device_removed` no longer waits. `stop_if_device_removed` and the unhandled-exception filter call the new `log_removal_note` only after `report.json` is written and the log is flushed. That fixes the crash-report loss raised in the merge-check: by the author's rerun, 12 of 12 runs now keep the DRED lines and the report. The price is the note itself: it now came out in only 2 of 12 runs. The whole lib suite has not been run on this head. #### Medium 1. **The timeout note is now lost in most removals.** In the author's rerun, the title ended by itself during the 3 s wait in 10 of 12 runs, so only 2 notes reached the log. The wait for 4101 only starts after the report, at the very end. Start the System-log query in a background thread as soon as `log_device_removed` sees the removal, without blocking. Then `log_removal_note` waits only for what is left of the 3 s, after the report. The query gets the time the DRED dump and the report take, and nothing before the report waits for it. 2. **The whole lib suite is not reported on this head.** **Tested** gives `gpu::tdr`, `report_once`, `hle::d3d12x::real` and the integration tests on `53c67afa`, and says the lib counts are from earlier heads. This commit changes `eh.rs` and the removal path that every title can take. CONTRIBUTING.md asks for `cargo test --workspace -- --test-threads=4` on the head under review. <details><summary>Checked and fine</summary> - Earlier merge-check point fixed: the crash report could be lost. `log_device_removed` now logs the reason, the commit and the DRED data without waiting. `stop_if_device_removed` writes `report.json` and flushes the log before `log_removal_note` (`real.rs` ~12641). - `log_removal_note` runs once per process through its own `ReportOnce`, and only when `GetDeviceRemovedReason` reports a removal. A second caller waits at most 5 s for the first. It flushes the log after the note, since `TerminateProcess` follows. - In `eh.rs` the call sits after the report block and before the title's own filter is chained. It does nothing unless the device was removed, so ordinary unhandled exceptions are unchanged. - The 3 `real::dispatch_chain` failures fail the same way on `main` `a815de93` on that adapter, as the description says. - The smoke pair is on a retail title, of `main` `a815de93` and this head. </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/2748:upstream-pr/2748'
git switch 'upstream-pr/2748'

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