D3D12.X: a device hang names Windows' GPU timeout when it was one #2738
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2748"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T09:58:40Z.
A
0x887a0006(DEVICE_HUNG) or0x887a0007(DEVICE_RESET) removal can be Windows' GPU timeout (TDR): WDDM resets the GPU when it does not preempt withinTdrDelayseconds of the scheduler asking (2 s by default, at the defaultTdrLevel). 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 theDisplayevent 4101 Windows writes when it was its timeout. Logging only. Part of #505.On an 8 GB laptop card, every
0x887a0006at a retail title's world start had a 4101 event at the same time (14 of 14 runs). RaisingTdrDelaytook 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()readsTdrDelay/TdrLevelfromHKLM\System\CurrentControlSet\Control\GraphicsDrivers. Read only, no elevation.describe()turns them into the log line:TdrDelayas the GPU's preemption timeout, and whatTdrLeveldoes 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()countsDisplay4101 events of the last 30 s withEvtQuery. A read that fails with anything butERROR_NO_MORE_ITEMSgives "unknown", not a count.removal_note()does this forDEVICE_HUNG/DEVICE_RESETonly, 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.crates/xcl/src/hle/d3d12x/mod.rs: the timeout line afterbackend 'real'.crates/xcl/src/hle/d3d12x/real.rs:log_removal_notewrites the note, once.stop_if_device_removedcalls it after the DRED lines andreport.jsonare 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_removedandlog_removal_noteeach let a second caller wait for the first one's output, for at most 5 s (ReportOnce). Without that,stop_if_device_removedon 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 callslog_removal_noteafter its own report.crates/xcl/Cargo.toml: theWin32_System_EventLogfeature ofwindows-sys, forEvtQuery. 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, onmaina815de93):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 arereal::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 onmaina815de93. SKIPPED: 2 "no GPU".cargo test --release -p xcl --no-fail-fast --test '*' -- --test-threads=4): 151 passed, 0 failed, 20 ignored, on this head and onmaina815de93. SKIPPED on both: 1 "no heap windows".The order of the report after a removal, measured the way fromthemoonx's merge-check did. Temporary code, since removed, called
ID3D12Device5::RemoveDevice1.5 s after the backend started and thenstop_if_device_removed, and letis_hangtake0x887a0005. The run was the bundled test title underxcl runwithXCL_DRED=1, debug build, 12 runs each:report.jsoncb2bc007)53c67afa)report.jsonwere there every time.On the previous head
ba84c7a0(the same change onmaind52ff48c), 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_formandreal::dispatch_chain::tests::failed_binding_keeps_indirect_commands_until_allocator_reset(E_INVALIDARG from the driver on this adapter), fail the same way onmaind52ff48c.This PR at
210eaf33, onmain53e85fb1, againstmain53e85fb1(same commands, same machine):cargo test --release --workspace --no-fail-fast -- --test-threads=4: the lib test binary ends early onmaintoo (exit 0x80004005 aftersparse upload preparation still failed after bounded retries), so the lib was also run alone, serially (--test-threads=1), with--skipfor the 20 tests that end the binary onmain(6list_x, 12sparse, 1texture_upload, 1uma_driver; each passes alone).main: the same.main: 2617 passed, 16 failed, 29 ignored, withvram::tests::d32s8_targets_take_their_own_size_of_video_memoryalso skipped because it ended the binary there. Every failure here also fails onmain(12title_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 thatd32s8test); two that failed onmainpassed 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.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 oldermain): 1445 passed, 1 failed (list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list, intermittent onmaintoo), 47 ignored.The 9 tests in
gpu::tdr::testspass, 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 withERROR_EVT_INVALID_QUERY. The two tests that read the real System log printSKIPPEDwhere a valid query cannot read it (Wine'swevtapigives error 0), and otherwise fail only on a query Windows refuses. The 2 tests inreal::report_once_testspass: a second caller waits for the report, and the reporting thread coming back (through the unhandled-exception filter) does not hang. The query ofrecent_resets, run over the last 24 h withGet-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:
(
TdrDelayis 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.4c8f841(itstdr.rsandReportOncecopied in as they are; the headc20818achanges only a test since). The thread number is in brackets:nvlddmkm153 events in the 15 s before.stop_if_device_removedon another thread ended the process 6 ms after the note.0x887a0007at 233.3 s. The noteno 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.Test reports from others (on earlier heads:
c9e51e5is before both review fixes and the report lock,e1ac7f0before theTdrLevelwording,4c8f841before the Wine skip)e1ac7f0(emirduran707): the 8gpu::tdrtests pass. The suite had 1441 passed and 2 failed, bothdxil::fuzz_teststhat fail onmainthere too. Smoke: 1601 frames, 0 removals (main: 1603).4c8f841(pickles976): 8 of 9gpu::tdrtests and bothreport_oncetests pass. Wine'swevtapireads no System log (error 0), anda_query_windows_refuses_is_told_apartfailed on that. It now skips there like the other System-log test (c20818a). Under Wine the note after a removal should readthe System log could not be read …(not run there).c9e51e5(sage-sage): 1440 passed, 0 failed, and thegpu::tdrtests 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, withXCL_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 ofmainbefore.main:This PR:
Not tested
report.jsonare 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.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:02:14Z.
Review: COMMENTED
On
c9e51e5,recent_resetstreats everyEvtNext == FALSEas the normal end of the System-log query and returnsSome(n). Microsoft'sEvtNextcontract says onlyGetLastError() == ERROR_NO_MORE_ITEMSmeans enumeration finished; a one-second timeout setsERROR_TIMEOUT, and other read errors can occur. If the firstEvtNextfails that way, this code returnsSome(0), andremoval_noteeventually 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.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:02:20Z.
Review: COMMENTED
On
c9e51e5,removal_notereports “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.
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 definesTdrLevel=1as a system bug check on detected timeout, with no recovery;TdrDelayis 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. Coulddescribedistinguish 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.
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):EvtNextfailures. The loop now goes throughcount_events, which ends with a count only onERROR_NO_MORE_ITEMS. Any otherGetLastError, on the first read or after a partial batch, givesNone, 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)aftercount_events, whatever it returns).only_the_end_of_the_query_gives_a_countdrives it with an injected reader: an empty end, two batches then the end, a first-callERROR_TIMEOUT, and a timeout after a batch.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_proofinjects a recent event and checks that wording.an_event_written_after_the_removal_is_still_foundcovers the 3 s wait.The description has the new test counts and a smoke run on
abdb439. The one suite failure in that run isvram::tests::d32s8_targets_take_their_own_size_of_video_memory(E_FAILunder parallel load; it passes alone and this change does not touchvram.rs).AI use: Claude Code (Claude Opus 5.5) made the changes and wrote this reply.
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 currentmainb49be18, so head = merged).Tested
cargo test --workspace -- --test-threads=4: 1440 passed, 0 failed, 47 ignored; the fourgpu::tdr::testspass, includingthe_system_log_and_the_settings_can_be_readon this Windows buildmainon this machine (wave64, debug layer, Developer Mode, heap windows)Not tested
removal_note()on a hung device; AMD, Intel.Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
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:
D3D12 device removedand waited for the 4101 event;stop_if_device_removedon a second thread found the report already started (DONEwas set) and ended the process 70 ms later.log_device_removednow 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 (
0x887a0007at 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:The description is updated.
@sage-sage, thanks for the test on
c9e51e5. The change since is intdr.rs, plus the lock inreal.rs.AI use: Claude Code (Claude Opus 5.5) found the race in the run log, made the fix and wrote this.
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-26T10:58:43Z.
Independent AMD RDNA4 (native wave64) verification of exact PR head
e1ac7f0213876e499786a4307deea67ca16b5c52on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC1.9.2602.17).Tested
cargo build --workspace(debug): passed (0errors).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, 1heap_window_out_of_memory_falls_back_to_the_switch_formno heap windows, 1pso_measurement_compiles_an_exact_synthetic_recordWindows Developer Mode off).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).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3) are pre-existing on unmodifiedmainon this RX 9060 XT / driver32.0.31044.16.cargo build --release -p xcl+ 60 s retail-title smoke test (scripts/smoke.ps1, offline):(Compare against
mainb49be183on this machine:1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-11-26T10:58:46Z.
Thanks @luckyteagirl, right again. Fixed in
1949ac1(squashed;e0ddf63has the same tree with the old commit message).describenow follows the TDR registry keys.TdrDelayis phrased as the preemption timeout, and the level decides what follows:TdrLevel0: detection off.TdrLevel1:Windows bug-checks, with no recovery, when the GPU does not preempt within N s ….TdrLevel3 or unset:Windows resets the GPU when it does not preempt within N s ….the_settings_are_described_as_windows_applies_themis 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 waslist_x::tests::a_reset_while_the_last_submit_runs_records_on_another_pc_list, an intermittent one that also fails onmain; it passed 3 of 3 runs alone. The smoke run on1949ac1is in the description.AI use: Claude Code (Claude Opus 5.5) made the change and wrote this reply.
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.
All eight tests pass here, including the one that reads this machine's real System log and registry
TdrDelay/TdrLevelsettings.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/0x887a0007removal 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.
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.02576c0b4adfae4a+— not stock-runtime certification. Unchanged owner code; fresh 28.37 s compile; one test thread; 9 GiB/512 MiB cgroup scope. Logverify-pr2748-tdr.logkept locally.gpu::tdr::tests8/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, andthe_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
wevtapifidelity gap, not a logic defect:a_query_windows_refuses_is_told_apartpanics witha malformed query gave Err(0)—EvtExecuteQuery("*[System[EventID=")returnsErr(0)under Wine rather thanERROR_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_tests2/2:a_second_caller_waits_for_the_first_reportandthe_reporting_thread_coming_back_does_not_hangboth 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.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_apartonly skipped onERROR_ACCESS_DENIED. It now first runs a valid query, and if that cannot read the System log (yourerror 0), it printsSKIPPEDlikethe_system_log_and_the_settings_can_be_read. It assertsERROR_EVT_INVALID_QUERYonly where the log can be read.That is in
c20818a, the new head; only that test changed since4c8f841. When you have time, could you rungpu::tdr::teststhere again under Wine? I expect 9 passed, with 2SKIPPEDlines. If you also runreal::report_once_testsand the rest of the suite, that would help too.AI use: Claude Code (Claude Opus 5.5) made the change and wrote this.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T12:00:26Z.
Re-ran the TDR diagnostics tests at
c20818acafter the head moved again (124 lines changed acrossgpu/tdr.rsandhle/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.
All nine pass here, including the new
a_query_windows_refuses_is_told_apartand the test that reads this machine's real System log and TDR registry settings. This is a new report following mine at1949ac11, not an edit.Not tested: a real
0x887a0006/0x887a0007removal 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.
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 parentorigin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.Setup
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)title: 29640639viascripts/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,0skipped, exit0), including live Windows 1126200System 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, andother_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,0skipped, exit0).Observations
gpu::tdr::tests(including live native Windows 11 System Event Log query and TDR registry inspection, with0skips) and all 62hle::d3d12x::real::tests passed cleanly in--releaseon exact headc20818ac.exit: 0x0,1558frames shown,60 60 60steady-state presents per 2 s,0device removals,0crashes,14008 MBpeak commit vs parentb49be183's14018 MB/1518frames).Paired 60 s RTX 4060 smoke (
b49be183vsc20818ac)Parent
origin/main(b49be183):PR #2748 head (
c20818ac):Limits of coverage
c20818ac(only targetedgpu::tdr::andhle::d3d12x::real::release tests plus paired quiet 60 s smoke).0device 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 bygpu::tdr::tests).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 testandscripts/smoke.ps1outputs.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.
EvtNextend-of-enumeration and the wording of a 4101 that isn't tied to this device:abdb439.1949ac1.c20818a.Could you take another look when you have time?
The head
c20818acstill merges cleanly intomain; 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
8b957beplus several open PRs) for the last day. It names the cause on three 0x887a0007 removals during a retail title. All three came with DREDpage fault at GPU VA 0x0.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)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.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:52:17Z.
Triage (#1607) – head
86ca095No open or merged PR reads the TDR settings or the Display 4101 event. Main has no
TdrDelay/EvtQuerycode.Worth knowing: on DEVICE_HUNG/RESET,
log_device_removednow 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), beforestop_if_device_removedends the process. This only affects a process that is already stopping.other_removals_get_no_notereads the machine's real registry and System log. Both required checks pass on86ca095a.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-03T13:24:15Z.
merge-check
base:
a815de932chead:
86ca095ac3merge: 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).
log_device_removedwaits up to 3 s for the 4101 event before it logs the DRED lines, andstop_if_device_removedwritesreport.jsononly 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 andreport.jsonhas no crash.Measured with the bundled test title under
xcl run(debug build,XCL_DRED=1). Temporary code removed the device withID3D12Device5::RemoveDevice1.5 s after the backend started and calledstop_if_device_removed. That gives 0x887a0005, so for this test I also letis_hangaccept that code. 12 runs each:report.jsonThe change: take the note out of
log_device_removed, and look for the event instop_if_device_removedafterwrite_finalandlog::flush, just beforeTerminateProcess. 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)
Imported from ivall/xcl. Originally posted by Raul-Paiva on 2026-12-03T15:22:26Z.
Thanks, point 1 is fixed in
53c67afa(rebased ontomaina815de93), along the lines you tried.log_device_removedno longer waits. The note is nowlog_removal_note, once per process through its ownReportOnce.stop_if_device_removedcalls it afterreport::write_finalandlog::flush, just beforeTerminateProcess.eh.rs) also logs the removal, and it now callslog_removal_noteafter 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 underxcl run,RemoveDevice1.5 s after the backend started,is_hangtaking0x887a0005for the test only, 12 runs each.report.jsoncb2bc007)53c67afaThe 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.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T15:25:26Z.
Follow-up review of
53c67afa, since86ca095a(code reading only, not a merge-check) · 2 mediumIn short: The new commit
53c67afamoves the System-log wait for Display event 4101 behind the report.log_device_removedno longer waits.stop_if_device_removedand the unhandled-exception filter call the newlog_removal_noteonly afterreport.jsonis 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
log_device_removedsees the removal, without blocking. Thenlog_removal_notewaits 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.gpu::tdr,report_once,hle::d3d12x::realand the integration tests on53c67afa, and says the lib counts are from earlier heads. This commit changeseh.rsand the removal path that every title can take. CONTRIBUTING.md asks forcargo test --workspace -- --test-threads=4on the head under review.Checked and fine
log_device_removednow logs the reason, the commit and the DRED data without waiting.stop_if_device_removedwritesreport.jsonand flushes the log beforelog_removal_note(real.rs~12641).log_removal_noteruns once per process through its ownReportOnce, and only whenGetDeviceRemovedReasonreports a removal. A second caller waits at most 5 s for the first. It flushes the log after the note, sinceTerminateProcessfollows.eh.rsthe 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.real::dispatch_chainfailures fail the same way onmaina815de93on that adapter, as the description says.maina815de93and this head.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.