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

Open
Prime1997 wants to merge 2 commits from upstream-pr/2205 into main
Prime1997 commented 2026-11-25 09:35:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-25T09:35:01Z.


Requested by Prime.

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 #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

  • Claude Code (Claude Opus 5.5) wrote the change and its tests, rebased #1323, ran the tests and smoke runs, wrote this description and opened this PR on Prime1997's behalf.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5488742797 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-25T09:35:01Z. --- <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime.**_ 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](https://github.com/xcl-dev/xcl/issues/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 #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](https://discord.gg/gK3y7WRRY) **AI use** - Claude Code (Claude Opus 5.5) wrote the change and its tests, rebased #1323, ran the tests and smoke runs, wrote this description and opened this PR on Prime1997's behalf. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DarkPanda69 commented 2026-11-25 14:10:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T13:41:46Z.


Correction: gpu_markers_of_a_finished_list_match creates its device with D3D12CreateDevice(None, ..), so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whatever XCL_ADAPTER says. All runs of that test below (both heads) were on the RX 9070 XT: the AMD result stands, but the RTX 3060 lines for this test are not RTX 3060 results. The per-card gpu:: counts are unaffected.


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:

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010): gpu_markers_of_a_finished_list_match ok. 629 passed, 2 failed, 22 ignored; the 2 failures are the AMD fuzz seeds tracked in #2115, the same on main.
  • RTX 3060 (driver 32.0.16.1088): the new test ok; 631 passed, 0 failed, 22 ignored.

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.

<!-- greyfinch-sync:ivall/xcl:comment:7164153761 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205#issuecomment-7164153761). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-25T13:41:46Z. --- **Correction:** `gpu_markers_of_a_finished_list_match` creates its device with `D3D12CreateDevice(None, ..)`, so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whatever `XCL_ADAPTER` says. All runs of that test below (both heads) were on the RX 9070 XT: the AMD result stands, but the RTX 3060 lines for this test are not RTX 3060 results. The per-card `gpu::` counts are unaffected. --- **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`: - **RX 9070 XT** (RDNA4, driver 32.0.32029.2010): `gpu_markers_of_a_finished_list_match` ok. 629 passed, 2 failed, 22 ignored; the 2 failures are the AMD fuzz seeds tracked in #2115, the same on `main`. - **RTX 3060** (driver 32.0.16.1088): the new test ok; 631 passed, 0 failed, 22 ignored. 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 commented 2026-11-25 16:12:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T15:54:30Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7167419386 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205#issuecomment-7167419386). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T15:54:30Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Aniseto commented 2026-11-25 17:07:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-25T16:14:56Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7167722191 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205#issuecomment-7167722191). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-25T16:14:56Z. --- 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.
DavidM1911 commented 2026-11-26 09:07:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T08:15:18Z.


Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7186373312 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205#issuecomment-7186373312). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T08:15:18Z. --- Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
bmjask commented 2026-11-29 22:46:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:46:05Z.

Review: COMMENTED


Critical review of current head 291bf6ad. Watchdog work is unbounded by the retention limit: not_done iterates every integer from out + 1 through in_, even though what retains at most 2^20 dispatches. A large marker gap makes the watchdog spend time traversing IDs it can no longer describe while diagnosing a stall. Iterate the retained entries/order for that list within (out, in_] instead and test a gap far larger than REMEMBERED. Also state that one marker wraps an entire indirect ExecuteIndirect, so this mode cannot isolate its individual dispatch/root arguments. The branch conflicts with main; no local Windows run.

<!-- greyfinch-sync:ivall/xcl:review:6105201085 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205#pullrequestreview-6105201085). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T22:46:05Z. **Review:** COMMENTED --- Critical review of current head `291bf6ad`. **Watchdog work is unbounded by the retention limit:** `not_done` iterates every integer from `out + 1` through `in_`, even though `what` retains at most 2^20 dispatches. A large marker gap makes the watchdog spend time traversing IDs it can no longer describe while diagnosing a stall. Iterate the retained entries/order for that list within `(out, in_]` instead and test a gap far larger than `REMEMBERED`. Also state that one marker wraps an entire indirect ExecuteIndirect, so this mode cannot isolate its individual dispatch/root arguments. The branch conflicts with main; no local Windows run.
Foniass commented 2026-12-01 06:17:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:17:52Z.


Review (head 291bf6ad, diff read, not a merge-check; it conflicts with main, so not built or run). Stacked on #1323; this covers the top commit.

  • Blocked on #1323 (open and conflicting), so it can't merge first. When both are rebased: main's translated_dispatch (bind.rs ~4986) now handles folding, the exact-remap path and the dispatch chain (real::dispatch_chain::dispatch), so #1323's markers and note_args need to wrap that whole path; and main already maps a pipeline to its console CS hash (real::pso_shaders, the same fnv64), which #1323's CS map duplicates.
  • The kept values may not be what the GPU read. "Recorded" is the CPU view when the dispatch is recorded and "now" the CPU view at report time; the GPU read the buffer somewhere in between, and main keeps GPU copies of some windows, so neither is guaranteed to be the count the GPU used. The log line should say so.
  • Minor: note_args runs under the bind STATES mutex (VirtualQuery, pso_async::resolve); copying the layout and arguments out first would keep that lock short. Only with the variable set.

Fine: off by default (only when XCL_GPU_CULPRIT=1 gives a marker), the kept arguments are capped at 4096, and describe_args and the hash parser have unit tests.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7302712133 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2205#issuecomment-7302712133). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:17:52Z. --- Review (head 291bf6ad, diff read, not a merge-check; it conflicts with main, so not built or run). Stacked on #1323; this covers the top commit. - **Blocked on #1323** (open and conflicting), so it can't merge first. When both are rebased: main's `translated_dispatch` (`bind.rs` ~4986) now handles folding, the exact-remap path and the dispatch chain (`real::dispatch_chain::dispatch`), so #1323's markers and `note_args` need to wrap that whole path; and main already maps a pipeline to its console CS hash (`real::pso_shaders`, the same fnv64), which #1323's `CS` map duplicates. - **The kept values may not be what the GPU read.** "Recorded" is the CPU view when the dispatch is recorded and "now" the CPU view at report time; the GPU read the buffer somewhere in between, and main keeps GPU copies of some windows, so neither is guaranteed to be the count the GPU used. The log line should say so. - Minor: `note_args` runs under the bind `STATES` mutex (`VirtualQuery`, `pso_async::resolve`); copying the layout and arguments out first would keep that lock short. Only with the variable set. Fine: off by default (only when `XCL_GPU_CULPRIT=1` gives a marker), the kept arguments are capped at 4096, and `describe_args` and the hash parser have unit tests. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2205:upstream-pr/2205'
git switch 'upstream-pr/2205'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2205'
git switch 'upstream-pr/2205'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2205'
git switch 'upstream-pr/2205'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2205'
git switch 'main'
git merge --squash 'upstream-pr/2205'
git switch 'main'
git merge --ff-only 'upstream-pr/2205'
git switch 'main'
git merge 'upstream-pr/2205'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2195
No description provided.