Skip to content

D3D12.X: XCL_GPU_CULPRIT_ARGS keeps the root arguments of named dispatches - #2205

Open
Prime1997 wants to merge 2 commits into
xcl-dev:mainfrom
Prime1997:contrib/culprit-dispatch-args
Open

Prime1997 wants to merge 2 commits into
xcl-dev:mainfrom
Prime1997:contrib/culprit-dispatch-args

Conversation

@Prime1997

@Prime1997 Prime1997 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Prime. · project thread

When XCL_GPU_CULPRIT names a dispatch that started and did not finish, the next question is what the title passed it. Two retail compute programs, a542b07e605c8fd7 and 777348c43857fdd2, loop over a count the title supplies in a constant buffer and exit only on equality (analysis in #1452). A stale or garbage count would keep the GPU inside one dispatch until the device is removed. With XCL_GPU_CULPRIT_ARGS=<cs hash>[,...], the not-done dispatches of those shaders are logged with their root arguments: root constants, and the first 16 words of each root buffer, both as recorded and as read again when the report is made. Nothing changes without the variable. Part of #1452.

Stacked on #1323; only the top commit (291bf6a) belongs here. #1323 conflicts with current main in two places (bind.rs ExecuteIndirect, list_x.rs watchdog log), so this branch carries #1323's commit rebased onto 568e7db with those two resolved, its authorship kept.

What is in it

  • crates/xcl/src/hle/d3d12x/culprit.rs: XCL_GPU_CULPRIT_ARGS parsing, the root-argument description, the kept arguments per dispatch number (capped at 4096), and their lines in the culprit report.
  • crates/xcl/src/hle/d3d12x/bind.rs: a translated Dispatch with a culprit marker keeps its root arguments when its shader is named.

Tested

  • NVIDIA GeForce RTX 3060 Ti 8 GB, driver 617.14, Windows 11 Pro 26200, Rust stable MSVC; debug suite, release smoke.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 at 7e197a7, the same tree as the head 291bf6a (the head only changes the commit's author identity): 1159 passed, 0 failed, 46 ignored; 25 SKIPPED lines (no wave64 on this adapter; per-lane form refused for some f16/f32 cases; driver cache cannot be disabled).
  • New unit tests: culprit_args_hashes_parse_as_printed, root_arguments_are_described_with_their_buffers; cargo test -p xcl --lib culprit: 5 passed, 0 failed.

Regression run

xcl-smoke v1
commit: 568e7db7729c8fa6c8f0f4b32d798faaf11462bb
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 357 (PresentX 357)
presents per 2 s (last 3): 17 18 18
device removals: 0
crashes: 0
peak commit: 15226 MB
xcl-smoke v1
commit: 291bf6ad68af81c03296d0cc84132d1043dace5b
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 298 (PresentX 298)
presents per 2 s (last 3): 19 16 15
device removals: 0
crashes: 0
peak commit: 15173 MB

Both runs are no-input and stop at the start screen, so they do not reach the dispatch this reports on, and they ran without XCL_GPU_CULPRIT.

Not tested

  • A real hang with the report on: a run reaching the story intro on the 3060 Ti with XCL_GPU_CULPRIT=1 XCL_GPU_CULPRIT_ARGS=a542b07e605c8fd7,777348c43857fdd2 is pending, so no count has been read yet. This stays a draft until that run is in.
  • ExecuteIndirect and console-recorded dispatches: they get culprit markers from D3D12.X: XCL_GPU_CULPRIT names the dispatches a stalled queue has not done #1323 but no kept arguments here.
  • AMD and other NVIDIA cards.

I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord

AI use

🤖 Generated with Claude Code

… done

When the GPU-wait watchdog releases a wait (xcl-dev#505), its lines say which
queues wait on which, but not what the GPU is running. With
XCL_GPU_CULPRIT=1 every dispatch XCL records (title lists,
console-recorded lists, ExecuteIndirect of a translated compute
pipeline) is wrapped in WriteBufferImmediate markers, in before and out
after, one pair of words per PC list in a readback buffer. At a release
the lists whose marker in is above their marker out are logged with the
dispatches between the two: console CS (fnv64 of the title's bytecode),
PC pipeline and groups.

On the retail title of xcl-dev#505 (RTX 5080) this named, at each stall, one
list with a run of 1-D dispatches of one CS whose first never finished;
not the same CS from run to run. DRED breadcrumbs were tried first: they
change the driver's pipeline cache keys, so every pipeline was built
again and the title never got past its start.

Off by default; without the variable nothing is recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tches

When the culprit report names a dispatch that started and did not finish,
the next question is what the title passed it. Two retail compute programs
(a542b07e605c8fd7, 777348c43857fdd2) loop over a count the title supplies
in a constant buffer and exit only on equality (xcl-dev#1452): a stale or garbage
count keeps the GPU inside one dispatch until the device is removed.

With XCL_GPU_CULPRIT_ARGS=<cs hash>[,...] the dispatches of those console
shaders keep their root arguments at record time: root constants, and the
first 16 words of each root buffer. A not-done dispatch in the report is
then logged with them and with each root buffer's words read again at
report time, so a count can be compared as recorded and as it is now.
Nothing changes without the variable.

Assisted-by: Claude Code (Claude Opus 5.5)
@DarkPanda69

DarkPanda69 commented Nov 25, 2026 •

Copy link
Copy Markdown

Update for head 291bf6a (tested as is; it no longer applies on current main): same result. gpu_markers_of_a_finished_list_match passes on the RX 9070 XT and the RTX 3060. Whole gpu:: filter: RX 9070 XT 584 passed, 2 failed (the #2115 fuzz seeds, same on main); RTX 3060 586 passed, 0 failed.


AMD run, plus an RTX 3060: the new GPU test passes on both, and nothing else in the GPU suite changes.

Head 7e197a7 applied on main 379725a, debug, Windows 11 Pro 26200, cargo test -p xcl --lib -- gpu:: --test-threads=4:

Not tested: a real hang with the report on (the run this PR is waiting for), ExecuteIndirect.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@Aniseto

Aniseto commented Nov 25, 2026

Copy link
Copy Markdown

Ran the culprit argument tests at 7e197a7:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 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.

XCL_ADAPTER=nvidia cargo test -p xcl --lib culprit -- --nocapture
5 passed; 0 failed; 0 ignored; 1124 filtered out      (exit 0)

All five pass here, including the two new ones (culprit_args_hashes_parse_as_printed and root_arguments_are_described_with_their_buffers) and the GPU marker test, which runs on the real adapter.

What this adds: the author ran this on an Ampere RTX 3060 Ti and an AMD card; the description lists other NVIDIA cards and AMD as not tested. This is a Blackwell wave32 part on driver 32.0.16.2124 with DXC 1.9.2609.5. It is a unit/GPU-marker run only: no title dispatch with XCL_GPU_CULPRIT_ARGS was exercised here.

Not tested: a real hung dispatch with XCL_GPU_CULPRIT_ARGS=a542b07e605c8fd7,777348c43857fdd2, ExecuteIndirect and console-recorded dispatches, AMD and Intel GPUs, Wine, release profile, native wave64.

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.

@Prime1997
Prime1997 force-pushed the contrib/culprit-dispatch-args branch from 7e197a7 to 291bf6a Compare November 25, 2026 16:28
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.

5 participants