D3D12.X: snapshot queue progress before a presentation stall aborts #1189

Open
github-bot wants to merge 1 commit from github-bot/gh-1189 into main AGit
Owner

@⁠rison1337 on GitHub · 2026-11-24 13:01 UTC · original
rison1337:codex/stall-snapshot → main · +312 −0 · 8 files · 1 commits · open

A title can stop presenting and abort through its watchdog before device removal provides a useful report. Add opt-in XCL_STALL_SECONDS=8 snapshots of submission stages, existing allocator fence progress and unfinished pipeline jobs. Part of #505.

What is in it

  • A bounded monitor with non-blocking tracker reads: up to three reports per pause, rearmed by a new shown frame. Recorded list/PSO pairs are labelled as metadata, not the GPU's current instruction. No added GPU signals or waits.
  • README usage and five controls for timeout/rearming, nested submissions, busy trackers, pipeline job states and a real GPU queue held at a fence then released.

Tested

  • RTX 4060 8 GB, driver 32.0.16.2101; Ryzen 5 7500F; Windows 11 26300; Rust 1.100.0, x86_64-pc-windows-msvc; release, DXC 1.9.2609.5.
  • cargo build --locked --release --workspace --target x86_64-pc-windows-msvc -j4 succeeded.
  • 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).
  • Both 60 s title runs below used no input; the PR run enabled XCL_STALL_SECONDS=8.

Regression run
Main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 4060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1472 (PresentX 1472)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14636 MB

This commit:

xcl-smoke v1
commit: 099d94b8be6a485842efd6f4fbfacbdc4619ef10
gpu: NVIDIA GeForce RTX 4060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1418 (PresentX 1419)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14686 MB

Not tested

  • AMD, Intel, native wave64, or the D3D12 debug layer. Sample-dependent tests ran without XCL_SAMPLE_* inputs.
  • Diagnosis of the retail world-loading hang: this comparison stays at the first-run screens. No claim that the snapshots fix that hang or establish which instruction the GPU is executing.

AI use

  • OpenAI Codex with GPT-6.1 Sol wrote the implementation, tests and description, and ran the commands above on the named machine. The user reviews and publishes this PR manually.
**@⁠rison1337** on GitHub · 2026-11-24 13:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1189) `rison1337:codex/stall-snapshot` → `main` · +312 −0 · 8 files · 1 commits · open A title can stop presenting and abort through its watchdog before device removal provides a useful report. Add opt-in `XCL_STALL_SECONDS=8` snapshots of submission stages, existing allocator fence progress and unfinished pipeline jobs. Part of #505. **What is in it** - A bounded monitor with non-blocking tracker reads: up to three reports per pause, rearmed by a new shown frame. Recorded list/PSO pairs are labelled as metadata, not the GPU's current instruction. No added GPU signals or waits. - README usage and five controls for timeout/rearming, nested submissions, busy trackers, pipeline job states and a real GPU queue held at a fence then released. **Tested** - RTX 4060 8 GB, driver 32.0.16.2101; Ryzen 5 7500F; Windows 11 26300; Rust 1.100.0, x86_64-pc-windows-msvc; release, DXC 1.9.2609.5. - `cargo build --locked --release --workspace --target x86_64-pc-windows-msvc -j4` succeeded. - `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). - Both 60 s title runs below used no input; the PR run enabled `XCL_STALL_SECONDS=8`. **Regression run** Main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: NVIDIA GeForce RTX 4060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1472 (PresentX 1472) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14636 MB ``` This commit: ``` xcl-smoke v1 commit: 099d94b8be6a485842efd6f4fbfacbdc4619ef10 gpu: NVIDIA GeForce RTX 4060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1418 (PresentX 1419) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14686 MB ``` **Not tested** - AMD, Intel, native wave64, or the D3D12 debug layer. Sample-dependent tests ran without XCL_SAMPLE_* inputs. - Diagnosis of the retail world-loading hang: this comparison stays at the first-run screens. No claim that the snapshots fix that hang or establish which instruction the GPU is executing. **AI use** - OpenAI Codex with GPT-6.1 Sol wrote the implementation, tests and description, and ran the commands above on the named machine. The user reviews and publishes this PR manually.
Opt-in XCL_STALL_SECONDS samples submission stages and the existing allocator
fences before a title watchdog ends the process. Busy trackers are skipped;
no GPU wait or signal is added. Bound the records and repeated snapshots,
and distinguish queued pipeline jobs from jobs already taken by a worker.

Assisted-by: OpenAI Codex (exact model identifier unavailable)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:28 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 13:25 UTC · original

Independent verification on current main 384f7f7 (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 new stall::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.

**@⁠DavidM1911** on GitHub · 2026-11-24 13:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1189#issuecomment-7132818478) Independent verification on current `main` `384f7f7` (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 new `stall::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.
Author
Owner

@⁠Gevroska on GitHub · 2026-11-24 17:02 UTC · original

I tested the queue-progress sampler during GTA VI world loading 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 at 26dbf855, the run ended earlier with DXGI_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.

**@⁠Gevroska** on GitHub · 2026-11-24 17:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1189#issuecomment-7138598134) I tested the queue-progress sampler during GTA VI world loading 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 at `26dbf855`, the run ended earlier with `DXGI_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.
Author
Owner

@⁠Alm0stSurely on GitHub · 2026-11-24 21:36 UTC · original · edited 2026-11-24 22:33 UTC

Linux/Proton world-loading result on RTX 5080. The sampler captured three snapshots after the last shown frame on a local integration of 099d94b8be6a485842efd6f4fbfacbdc4619ef10 over main c4d37bec1bb4286eb373aea963404a23f13401fa. 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-spirv 53aac418 with 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 added XCL_STALL_SECONDS=8 and 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=30 and 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 revision end_title attempts 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).

**@⁠Alm0stSurely** on GitHub · 2026-11-24 21:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/1189#issuecomment-7145149483) · edited 2026-11-24 22:33 UTC Linux/Proton world-loading result on RTX 5080. The sampler captured three snapshots after the last shown frame on a local integration of `099d94b8be6a485842efd6f4fbfacbdc4619ef10` over main `c4d37bec1bb4286eb373aea963404a23f13401fa`. 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-spirv `53aac418` with 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 added `XCL_STALL_SECONDS=8` and 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=30` and 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 revision `end_title` attempts 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).
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/xcl/src/hle/d3d12x/mod.rs
  • crates/xcl/src/hle/d3d12x/real.rs
  • crates/xcl/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1189/head:github-bot/gh-1189'
git switch 'github-bot/gh-1189'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1189'
git switch 'github-bot/gh-1189'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1189'
git switch 'github-bot/gh-1189'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1189'
git switch 'main'
git merge --squash 'github-bot/gh-1189'
git switch 'main'
git merge --ff-only 'github-bot/gh-1189'
git switch 'main'
git merge 'github-bot/gh-1189'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.