Skip to content

D3D12.X: name XCL's own tile-mapping lists and say when a wait for a queue gives up - #873

Merged
theaustinayers merged 1 commit into
xcl-dev:mainfrom
theaustinayers:queue-wait-diagnostics
Nov 24, 2026
Merged

theaustinayers merged 1 commit into
xcl-dev:mainfrom
theaustinayers:queue-wait-diagnostics

Conversation

@theaustinayers

Copy link
Copy Markdown
Collaborator

Diagnostics for a queue that stands still; no behaviour change. With the debug layer on, a retail title's device was removed with "The command allocator was reset after the command list was recorded" (id 541) on an Unnamed ID3D12GraphicsCommandList Object, and nothing in the log said whose list it was, or that a wait had given up just before.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs: XCL's tile-mapping queue, its upload lists and allocators and its readback list and allocator get names (SetName), so a debug-layer message about one of them says so; a list that stays "Unnamed" is the title's.
  • sparse.rs wait_for: a warning when the tile-mapping queue has not reached the fence value after its 5 s limit (it carried on silently, and the caller then resets the allocator).
  • crates/xcl/src/hle/d3d12x/cpu_writes.rs: a warning (the 1st, 2nd, 4th, … time) when the writes after the GPU are done although their queue had not got there after WAIT_MS (10 s): the title then reads a progress value its queue has not reached.

No test: names and log lines only.

Tested

  • NVIDIA GeForce RTX 5090 (driver 621.14), Ryzen 9 9950X3D, Windows 11 build 26300, rustc 1.100.0, debug build for tests, release for the runs
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4: 715 passed, 0 failed, 41 ignored; no SKIPPED tests on this adapter
  • A retail title with XCL_D3D12_DEBUG=1, on a build of main at beaa245 plus these lines: the two debug-layer reports about a command list (id 553) named an "Unnamed" list, so not one of the named ones here.

Regression run

main (e7da8a1 is the commit of #866, merged as a1672ef):

xcl-smoke v1
commit: e7da8a18afd45d41d37ec44056b5b21bc68b4727
gpu: NVIDIA GeForce RTX 5090
title: NYCMain
seconds: 60
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16397 MB

PR:

xcl-smoke v1
commit: dbe932400410828fd0490f86714a1f397d4a1504
gpu: NVIDIA GeForce RTX 5090
title: NYCMain
seconds: 60
exit: 0x0
frames shown: 1627 (PresentX 1627)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16291 MB

Not tested

  • Neither warning has been seen to fire: the one run with these lines was ended at 71 s, before a 10 s wait could run out, and the 60 s regression run does not reach the place.
  • AMD and Intel GPUs, Wine / vkd3d-proton.

AI use

  • Claude Code, Claude Fable 5.2: wrote the lines and this description. The runs above were made on the hardware named.

🤖 Generated with Claude Code

…queue gives up

Diagnostics for a queue that stands still. With the debug layer on, a retail
title's device was removed with "The command allocator was reset after the
command list was recorded" (id 541) on an 'Unnamed ID3D12GraphicsCommandList
Object': the title's list or one of XCL's could not be told apart. XCL's
tile-mapping queue, its upload lists and its readback list now carry names.

Two waits end after a time limit and carry on without a word: the
tile-mapping queue's wait for its own fence (5 s), and the wait of the writes
after the GPU for their queue (10 s; the title then reads a progress value
its queue has not reached). Both now log a warning.

Assisted-by: Claude Code (Claude Fable 5.2)
@theaustinayers
theaustinayers merged commit 1ec4c98 into xcl-dev:main Nov 24, 2026
2 checks passed
@woreksami

Copy link
Copy Markdown

Data on the same id 541 from a second machine, in case it saves you a step: here it is not one of XCL's lists either, and the submit comes from the D3D12 runtime's own thread, after a CPU cycle break.

Setup

What the runs show

Not tested

  • This PR itself (its names would tell whose list the 541 is about; I'll add a run with it); AMD; the title without my local changes.

AI use

  • Claude Code with Claude Opus 5.5: merged the branches, ran the title with the debug layer, read the logs and thread dumps and wrote this comment from those runs.

@woreksami

Copy link
Copy Markdown

Follow-up with this PR (dbe9324) in the tree from my comment above, plus #866, XCL_D3D12_DEBUG=1, same machine and title.

  • The 541 again comes from thread "Internal D3D12 Sync Thread" and the message names no list at all (ID3D12CommandQueue::ExecuteCommandList: The command allocator was reset after the command list was recorded.), so the names here cannot tell whose it is from that message. The names do show up elsewhere: 8 of the id 1047 messages name xcl sparse queue.
  • The new cpu_writes warning (… writes after the GPU so far … had not got there after 10000 ms) did not fire in the run, and neither did the sparse-queue wait warning. So XCL did not publish a progress value early through cpu_writes here.
  • What did happen right before, as in every 541 run:
    87.78–89.84 split command list … (#2 … #6), five title lists
    89.898 Write64 Signal at 0x70416ab00 = 0x614 on q1/ty2 would close a GPU cycle (waiters=[q3]) – signalled on CPU
    89.924 Write64 Signal at 0x70416aaf8 = 0x614 on q3/ty0 would close a GPU cycle (waiters=[q1,q2]) – signalled on CPU
    90.016 id 541 (Internal D3D12 Sync Thread)
    90.042 device removed 0x887a0001
    
  • With D3D12.X: a resource's last Release waits for the queues to pass the work in flight #866 in, no id 921, and the earlier GPU hang at 53 s (seen without D3D12.X: bridge Wait64BitValueX to GPU fences with exact cycle breaking #795 / D3D12.X: split title_list command lists around mid-list Wait64 after Write64 #797) did not come back; the run ended at the 541 instead.

So the only early "done" left in these runs is the #795 cycle break signalling the fences on the CPU: the waiters' queues go on, and lists the runtime was still holding behind a queue.Wait reach the GPU after the title has reset their allocator.

Not tested

  • Whether the waiting lists in those two cycles are the ones the 541 is about (the message has no name), AMD, a build without my local changes.

AI use

  • Claude Code with Claude Opus 5.5: built and ran the tree, read the log and thread dump and wrote this comment from that run.

Abuudiii added a commit to Abuudiii/xcl that referenced this pull request Nov 24, 2026
Keep the legacy fallback warning from xcl-dev#873 and hold deferred 64-bit progress until its producer fence completes. Focused cpu_writes suite: 3 passed on RX 9070 / GE-Proton with both paths exercised.

Assisted-by: omp (GPT-6.2 Sol)
@woreksami

Copy link
Copy Markdown

A correction to my two comments above: the CPU cycle break is not the only way to this removal here.

Same machine and title, tree from above plus #851 (4bf6d60):

  • Without the debug layer: the device was removed (0x887a0001) at 87.4 s with no would close a GPU cycle – signalled on CPU line and no did not complete within 5000 ms – released line in the whole run. Just before it there were splits (Olympus: expand RDNA2 ISA compatibility #5–Olympus: honor disabled process task queues #11 in 86.26–86.75 s) and Wait64BitValueX … bridged to GPU queue.Wait (…; wait-before-signal) lines, four of them with prod=qNone between 85.0 and 87.4 s. The CreateCommandList … → 0x887a0005 lines that follow are after the removal, not its cause. Without the debug layer I can't say which call it was.
  • With the debug layer, same build: id 541 at 135.960 on "Internal D3D12 Sync Thread", 39 ms after two cycle breaks (135.897 / 135.921), then removal at 135.966 and two more 541s from the sync thread.

So across five debug-layer runs every 541 came within ~100 ms of a CPU cycle break, but one run without the debug layer reset with neither a cycle break nor a watchdog release, so "the cycle break causes it" in my earlier comment was too strong. What the runs do share is runtime-held submits (a queue.Wait before its signal) going out from the sync thread after the title has recycled the allocator; the cycle break is one way such a wait ends early.

Not tested

  • The removal without the debug layer under the debug layer (it changes the timing), DRED (it stalls this title in its first seconds, as XCL_DRED's comment says for another title), AMD.

AI use

  • Claude Code with Claude Opus 5.5: built and ran the tree, read the logs and wrote this correction from those runs.

@dcastell1

Copy link
Copy Markdown

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
713 passed; 0 failed; 41 ignored   (exit 0)

Same count as main (the change is naming plus the wait message), so the existing tests exercise it and nothing regresses.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
… split

xcl-dev#708 predates xcl-dev#795 (GPU-fence bridge) and xcl-dev#797 (mid-list split) and was
not rebased. Resolution keeps main's split machinery (xcl-dev#797 + xcl-dev#851) and
cpu_writes from xcl-dev#850 (the xcl-dev#708 per-queue workers with xcl-dev#873's
diagnostics), and ports xcl-dev#708's core change onto it:

- wait_gate.rs (from xcl-dev#708): a queue-side gate the CPU opens once it
  sees the progress value.
- PendingWait::gate: a Wait64 GE, full mask, on a non-sparse value the
  CPU can read, in a direct/compute title list, that starts its PC
  segment (split by xcl-dev#797/xcl-dev#851, or nothing recorded before it).
- execute_with_waits_on / KickoffX: gated waits arm a wait_gate instead
  of the xcl-dev#795 GPU-fence bridge; with sparse writes at or after the list
  in the batch they take the bounded CPU wait (xcl-dev#708's rule). Other waits
  keep the xcl-dev#795 bridge. Arming failure stops the title (xcl-dev#708).
- Dropped from xcl-dev#708: its own title_list piece/split machinery,
  split_recording, restore_after_reopen, open-query / split-barrier
  tracking and the Result-returning execute_with_waits.
- wait_tests.rs (from xcl-dev#708) adapted to push_segments /
  execute_with_waits_on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants