Skip to content

xcl run: XCL_THREAD_DUMP_AT also logs the fences and queue waits behind - #2244

Open
kole07139 wants to merge 1 commit into
xcl-dev:mainfrom
kole07139:dump/sync-state
Open

kole07139 wants to merge 1 commit into
xcl-dev:mainfrom
kole07139:dump/sync-state

Conversation

@kole07139

Copy link
Copy Markdown

At each XCL_THREAD_DUMP_AT dump, XCL now also logs the pending title fences, XCL's own unmet queue waits, and how many GPU waits are armed. These are the summaries the GPU-wait watchdog logs at a time-out. Part of #1452.

A world load can stop with no time-out: presents, submits and DirectStorage requests go to 0, and every thread waits. Until now the thread dump of such a stop did not say whether a fence or a queue was behind, because these summaries were only logged at a time-out.

On #2057's tree this diagnostic showed every fence and queue caught up at 135, 200 and 300 s after a stop at 110 s (#2057 (comment)). So the title was waiting on something other than a fence, and a GPU hang was ruled out.

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: log_sync_state(at) logs fence_x::pending_summary(), internal_waits_summary() and ARMED_GPU_WAITS. It runs on a thread of its own, so a lock that the stall holds cannot hold up the next dump.
  • crates/xcl/src/host.rs: the XCL_THREAD_DUMP_AT thread calls it after each eh::dump_threads(). Without the variable nothing changes.

Example, from the run on #2057's tree, which also logged queues behind and the wait edges; those summaries are not on main:

D3D12.X: sync state at 135 s: pending title ID3D12Fences: none
D3D12.X: sync state at 135 s: XCL's own queue waits unmet: none

Tested

  • Hardware and software:
    • RTX 3070 8 GB (NVIDIA 617.42, 32-lane waves), i9-9900K, 32 GB RAM;
    • Windows 11 Pro N 26200, Rust 1.99.0, DXC 1.8.2502.11.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on this head: 1217 passed, 1 failed, 46 ignored, 25 SKIPPED (20 no wave64 on this 32-lane card, 3 per-lane forms refused, 1 needs Windows Developer Mode to turn the driver cache off, 1 no heap windows).
  • The diagnostic itself, on this head: a 60 s run of the retail title with XCL_THREAD_DUMP_AT=45 logged the three lines after the thread dump (pending title ID3D12Fences: none, XCL's own queue waits unmet: none, 0 GPU waits armed). The thread dump came out as before (145 thread lines). The same function on D3D12.X: integration branch that reaches the in-world HUD on NVIDIA (reference, not for merge) #2057's tree is in the runs linked above.

Regression run (scripts/smoke.ps1 -Game <retail title> -Seconds 60, the same title for both)

main b56a7d3:

xcl-smoke v1
commit: b56a7d3f14d4db0173d93b8cad8d35909b36171d
gpu: NVIDIA GeForce RTX 3070
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1513 (PresentX 1513)
presents per 2 s (last 3): 53 41 47
device removals: 0
crashes: 0
peak commit: 15504 MB

This PR, 8eaad18:

xcl-smoke v1
commit: 8eaad18dc7528f8969d5cae311b1d8af318434e8
gpu: NVIDIA GeForce RTX 3070
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 1458 (PresentX 1459)
presents per 2 s (last 3): 54 60 60
device removals: 0
crashes: 0
peak commit: 17731 MB

Not tested

  • A title stall on this head (the 60 s run above did not stall), or a stall where a fence or queue is behind.
  • AMD, Intel; Linux / Wine.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, ran the tests and the smoke runs, and wrote this description.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XZrhsCAiLU1tTuEBwPLaRW

A retail title's world load can stop with no GPU-wait time-out: presents,
submits and DirectStorage requests go to 0 and every thread waits. The
watchdog's summaries of pending title fences and of XCL's own unmet queue
waits are only logged at a time-out, so such a stop did not say whether
a fence or a queue was behind.

At each XCL_THREAD_DUMP_AT dump XCL now logs the two summaries and the
number of armed GPU waits, on a thread of its own so that a lock the
stall holds cannot hold up the next dump. On xcl-dev#2057's tree this showed
every fence and queue caught up at 135, 200 and 300 s after a stop at
110 s (xcl-dev#2057 (comment)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZrhsCAiLU1tTuEBwPLaRW
@ClosetPie107

Copy link
Copy Markdown

Linux / AMD RDNA4 (RADV) test report for head 8eaad18 merged locally onto main 1a0bbe3 (clean merge).

Environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS
  • Proton Experimental (experimental-11.0-20261112), vkd3d-proton v3.1 (#257 + dxil-spirv master 694cc674), DXVK v3.1.1-209, DXC 1.9.2609.5, x86_64-pc-windows-gnu cross-compile

Tested (debug test binary under Wine, XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64, --test-threads=1 --nocapture)

  • hle::d3d12x::list_x: 34 passed, 0 failed, 0 ignored, 0 skipped (0.32 s).
  • hle::d3d12x::real: 56 passed, 0 failed, 0 ignored, 0 skipped (1.31 s).

Not tested: full workspace suite, live XCL_THREAD_DUMP_AT output in a retail run, native Windows.

AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran the tests on this machine, and drafted this report.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 2 real failures, deterministic (also fail --test-threads=1):
gpu::recomp::pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator
  assertion failed — left: 68, right: 1 (pso.rs:1360)
hle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa
  assertion failed: format 85 kept — left: 28, right: 85 (device_x.rs:1376)

Same pair of failures across this batch of PRs — looks like a shared feature area with two broken assertions. Needs fixes before merge.

— Devin

@kole07139

Copy link
Copy Markdown
Author

@DavidM1911 thanks for the run. I could not reproduce either failure. This PR only adds logging in list_x.rs and host.rs, and neither test goes through those files.

On an RTX 3070, Windows 11, debug, with cargo test -p xcl --lib -- rerouted_disk_entries_follow_the_direct_translator pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa --test-threads=1, both tests pass, 2 passed, 0 failed, on each of these:

tree result
main 55d64c2 alone 2 passed
this PR merged with main 55d64c2 2 passed
this PR merged with main 68a284a 2 passed

AI use: Claude Code (Claude Opus 5.5) ran the three checks and wrote this reply.

@GreemSC

GreemSC commented Nov 25, 2026

Copy link
Copy Markdown

A suggestion for this PR's sync-state lines, from runs where they would not have shown what held the title.

On our runs of the retail title after the first #101, the three lines this PR prints would read pending title ID3D12Fences: none, XCL's own queue waits unmet: none, 0 GPU waits armed while nothing was presented any more. What showed the stop was the SYNC_GRAPH cells that are behind their recorded value:

sync state at the thread dump: 0 armed GPU waits; cells behind:
  0x42437fe00: mem 0x0 done 0x0 sub 0x0@qNone rec 0x620 cpu 0x0 armed [];
  0x42437fe08: mem 0x0 done 0x0 sub 0x0@qNone rec 0x620 cpu 0x0 armed []

rec > sub with nothing armed means a list that writes the value was recorded and never submitted: the submitting thread is stuck. Here the thread dump showed it: a title thread in bind::execute_indirect → dispatch_chain::whole → driver_pso (the case #2404 removes), and with #2404 a title thread in pso_async::resolve_for_bind instead. The five bridged prod=qNone waits of the same runs (≥ 0x620 on 0x42437fe10…fee8) were already met, so they were not the block.

The function we used (in list_x.rs, next to internal_waits_summary), if you want to fold it in:

/// the Wait64BitValueX cells not at their highest recorded value, or with armed GPU waits
fn cells_behind_summary() -> String {
    let mut parts = Vec::new();
    if let Ok(g) = SYNC_GRAPH.try_lock() {
        for (&va, c) in g.iter().flat_map(|gr| gr.cells.iter()) {
            let done = c.fence.as_ref().map_or(0, |f| unsafe { f.GetCompletedValue() });
            if c.armed_waits.is_empty() && done >= c.recorded_max {
                continue;
            }
            let mem = if crate::gpu::shader::readable(va as usize, 8) { unsafe { *(va as *const u64) } } else { 0 };
            let armed: Vec<String> = c.armed_waits.iter().map(|a| format!("{:#x}@q{} {} ms", a.val, queue_id(a.waiting_queue), a.armed_at.elapsed().as_millis())).collect();
            parts.push(format!("{va:#x}: mem {mem:#x} done {done:#x} sub {:#x}@q{:?} rec {:#x} cpu {:#x}{} armed [{}]",
                c.submitted_max, c.submitted_queue.map(queue_id), c.recorded_max, c.cpu_signaled_max,
                if c.non_monotonic { " non-monotonic" } else { "" }, armed.join(", ")));
        }
    } else {
        parts.push("(sync graph locked)".into());
    }
    if parts.is_empty() { "none".into() } else { parts.join("; ") }
}

(try_lock, because a thread dump can come while a submitting thread holds the graph.) Two more things that helped: unwinding 28 frames instead of 14 (with 14, the title-thread callers under XCL's frames were cut off, and we first read the stop wrongly), and dumping again on its own after N seconds with no present.

Setup: RX 7900 XT, Mesa 26.2.5 RADV, Linux, Proton-CachyOS Wine 11, a local vkd3d-proton build; XCL main 68a284a + #1732 + #684 + #1860 + part of #203 (+ #2404 + #2097 for the second reading); XCL_DIRECT_DXIL=1; retail 1.0.2.1; 180 s runs: 4 on the first tree (12 thread dumps, all with the three lines at none / none / 0 and the two cells behind), 1 so far with #2404 + #2097. This is not a PR of ours: no point in a second one next to yours.

AI use: Claude Code (Claude Opus 5.5) wrote the diagnostic, ran the builds and runs, read the logs and wrote this comment.

@kole07139

Copy link
Copy Markdown
Author

Thanks, @GreemSC. In something like 1-2 hours i will implement the suggestions and a Claude Reply will come right after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants