D3D12.X: snapshot queue progress before a presentation stall aborts #1180
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1189"
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 rison1337 on 2026-11-24T13:01:56Z.
A title can stop presenting and abort through its watchdog before device removal provides a useful report. Add opt-in
XCL_STALL_SECONDS=8snapshots of submission stages, existing allocator fence progress and unfinished pipeline jobs. Part of #505.What is in it
Tested
cargo build --locked --release --workspace --target x86_64-pc-windows-msvc -j4succeeded.cargo test --locked --release --workspace --target x86_64-pc-windows-msvc -j4 --no-fail-fast -- --test-threads=4 --nocapture: 746 passed, 0 failed, 41 ignored. Four bodies reported SKIPPED: two wave64 checks and two requiring the absent D3D12 debug layer (these returns are included in Cargo's passed count).XCL_STALL_SECONDS=8.Regression run
Main:
This commit:
Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:25:52Z.
Independent verification on current
main384f7f7(branch already contains it — clean).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
cargo test -p xcl --lib stall: 7 passed, 0 failed — includes the newstall::tests(snapshots_wait_for_the_first_frame_and_are_bounded_until_progress,stall_timeout_is_opt_in_and_bounded,nested_submissions_restore_the_outer_stage_and_busy_tracking_is_skipped) plus the pso_async diagnostic test.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-24T17:02:39Z.
I tested the queue-progress sampler during world loading in the retail game on Windows 11 with an RTX 3080. The two runs gave different results.
On a local integration of #1189 over
930e8b4, the sampler captured three snapshots roughly 8, 16 and 24 seconds after frames stopped appearing. In all three, each of the five sampled fences had a completed value equal to its submitted value. Those values stayed unchanged across snapshots. This narrows the observation to the tracked fences. Other GPU work could still have been outstanding.On
b7aa9f3, the clean control reached a black screen and then a guest access violation about 30 seconds after the last recorded presentation activity. With #1189 integrated locally at26dbf855, the run ended earlier withDXGI_ERROR_DEVICE_HUNG(0x887A0006), before the first eight-second stall snapshot. The 15 focused tests passed, and the synthetic title exited successfully.The sampler produced useful fence data on the earlier base. The newer run never reached the control’s stall, so it leaves queue progress during that interval unresolved. With one run per build and a shared driver cache, I can’t attribute the device hang to the sampler.
AI use: I used OpenAI Codex with GPT‑6.2 Sol to integrate the diagnostic, run the synthetic checks and offline game replays, and analyze the logs. A separate GPT‑6.2 Sol agent at high reasoning reviewed the source integration. GPT‑6.1 Terra agents at medium reasoning checked upstream overlap and independently reviewed the saved results. The independent result reviews used the recorded evidence and did not rerun the game.
Imported from ivall/xcl. Originally posted by Alm0stSurely on 2026-11-24T21:36:17Z.
Linux/Proton world-loading result on RTX 5080. The sampler captured three snapshots after the last shown frame on a local integration of
099d94b8be6a485842efd6f4fbfacbdc4619ef10over mainc4d37bec1bb4286eb373aea963404a23f13401fa. In the one overlapping submission hook we retained main's scratch-copy bookkeeping immediately before the allocator-marker stage.At 8.0, 16.0 and 24.0 seconds without a new frame the count remained 1,378. Both observed queue submission calls had returned. The allocator tracker covered one of those queues: 2,784 submitted / 2,784 completed in all three snapshots. The other queue had no allocator-fence row. Five compute pipeline jobs were sampled unfinished each time. The last nonzero submission interval included 12 submits and zero presents. At the 240 s runtime limit the separate shutdown check still reported pending GPU fences after its 10 s wait. That check uses fresh fences; its warning does not identify the queue.
The stock-main control and the diagnostic run both reached illustrated story loading and then black. One run per configuration. This confirms the snapshots work during this stall under Proton and shows why reporting the scope of the fence tracker matters.
EndeavourOS, Ryzen 9 9950X3D, RTX 5080, NVIDIA 620.73.04, 60 GiB usable RAM. Proton Experimental, vkd3d-proton
4522cc1/ dxil-spirv53aac418with the previously reported dominance performance patch.xcl.exe run <title.exe>,XCL_DIRECT_DXIL=1,XCL_RUN_SECONDS=240,XCL_PSO_TRACE=1,XCL_ACTIVITY=1; diagnostic run addedXCL_STALL_SECONDS=8and a vkd3d queue profile. Separate private copies of the same starting cache and 45 history keys. Exit 0 after the time limit.Test integration and analysis assisted by Codex (GPT-6.2 Astra).
Short control on stock main, same Proton setup. We set
XCL_RUN_SECONDS=30and started with another private copy of the same cache. The final three full 2 s samples, ending at 24.022, 26.023 and 28.024 s, each recorded 60 presents. XCL stopped the title at 30.001 s; at 40.039 s it emitted the same pending-fences warning, then Proton exited 0. Therefore the shutdown warning alone cannot distinguish this presenting run from the black-screen run. In this revisionend_titleattempts to suspend the other process threads before signalling the newly created drain fences. We did not measure which driver threads were suspended.Follow-up on main
689f2db477c3c062cf162649781640ef8a977c18, with local command-list tracing, HLSL (XCL_DIRECT_DXIL=0), warm cache, same Proton/RTX 5080 setup and a 240 s cap. Illustrated loading was visible, then black at 105 and 240 s. The last traced PresentX was at 88.454 s. We tracked successful resets so the same backing-list address could be distinguished across recordings. Of 17 recordings with a wrapped DrawInstanced or DrawIndexedInstanced after that PresentX, four closed successfully and reached native queue submission. Twelve closed successfully but had no subsequent matching resolved queue input or native submission before the cap. One had no observed close after its last draw. The last native submission marker was at 142.675 s. The resolved-input marker is after texture refresh and list expansion. This narrows where to trace handoff for that cohort; GPU completion and which lists are required for the next frame remain open. Local investigation assisted by Codex (GPT-6.2 Astra).Raw-input follow-up, same main and HLSL configuration, separate 240 s run. We logged each list argument before texture refresh or segment expansion, and both the title wrapper and native segment at successful Close. After the last PresentX at 86.745 s there were 18 recordings containing a tracked draw. Seven wrappers appeared in the raw arguments and their segments reached native submission. Nine recordings closed successfully, but neither the wrapper nor the native pointer appeared in the raw arguments again during that recording; no native submission was observed for them. Two recordings had no observed Close after their last draw. Across 6,188 nonempty queue calls, every call ID reached the resolved-input marker. The nine were therefore already absent at the measured API boundary. Whether the title needed them for the next frame remains open. The last native submission was at 226.391 s, with the display still black at 240 s. Local investigation assisted by Codex (GPT-6.2 Astra).
Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-29T15:48:37Z.
@rison1337 I wrote something close to this for my Mac branch before I found this PR, so I compared the two to avoid a second PR. Mine is
XCL_STALL_REPORTonvakaobr/xclmac/integration; I am not opening it upstream.They answer different questions:
XCL_STALL_SECONDS)XCL_STALL_REPORTqueue.Waitwatchdog release or the sparse queue's 5 s fence timeout; also before the first frame and while frames are still showntry_lockonly, never waitsSo yours covers the CPU side and the builds, which mine does not, and mine says what is in the submission a queue stopped at. Measured on a Mac (M5 Pro, CrossOver 26.3 + D3DMetal) with our test title: queue A held behind a fence wait with a
Write64BitValueBottomOfPipeXsubmitted after it, queue B'sWait64BitValueXon that value bridged to a GPUqueue.Wait; 4 ms after the watchdog released B's wait the report readq0 has reached 1 of 2 submissions; the oldest not done, 2 (5032 ms ago, 1 lists). That case shows frames still, or none yet, so a frame-based trigger would not see it.If this PR goes in, I would offer the parts of mine it lacks as a follow-up on top of it rather than a second module (both add
hle/d3d12x/stall.rs):One difference in how fences are read: here the snapshot thread calls
GetCompletedValueitself; mine reads fences on a helper thread and waits at most 500 ms, in case a call stays in the driver. I have not seen one stay there on D3DMetal (a queue Metal had timed out still answered at once), so that is caution, not a known problem.This PR is now in conflict with
main. Are you still on it? If you rebase it, I can run its tests on the Mac.AI use: Claude Code with Claude Opus 5.5 compared the two from the code and drafted this comment; the measurement is from my run. I checked it before posting.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:03:08Z.
Triage (#1607) – head
099d94bNo open PR makes the same change. #1179 (same title) is closed; main's
XCL_STALL_TRACErecords CPU-side stall spans, and #1580/#1123/#1323 log when a GPU wait times out, not when shown frames stop. The snapshot is opt-in (XCL_STALL_SECONDS), only usestry_lock, and does nothing inq_execute_command_listswhen it is unset.No problems found in the diff. The branch conflicts with main.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.