d3d12_xs: name the group counts of each Dispatch in the TOMBOX_DRED=2 report #273

Closed
GDAgent wants to merge 1 commit from upstream-pr/273 into main
GDAgent commented 2026-11-23 10:39:59 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by GDAgent on 2026-11-23T10:39:59Z.


Library / area: d3d12_xs (dred_marks.rs, two log strings in dred.rs)

Exports changed (exports.txt rows): none

Why: with TOMBOX_DRED=2, a device-removal report names the PSO (the Xbox shader hashes) of every op around the first unfinished one, but not the size of a dispatch. When a compute shader hangs the GPU, the group count is the first thing needed to tell a runaway loop from a dispatch that is simply too large. This came up while chasing a DXGI_ERROR_DEVICE_HUNG in a Niagara compute shader in The Matrix Awakens, where the report showed which dispatch hung but not how big it was.

Changes:

  • With PSO markers on (TOMBOX_DRED=2), Dispatch (Xbox slot 14) and DispatchX (slot 78) also write a SetMarker tbdispatch XxYxZ before forwarding to the previous slot entry. They chain like the other hooks on those slots (for example TOMBOX_PASSCAP).
  • The removal report appends groups=XxYxZ to a DISPATCH op when the latest dispatch marker before it has no other draw or dispatch in between. Dispatch markers are not shown as title markers and do not count as PSO markers.
  • The TOMBOX_DRED log lines say that mode 2 also adds Dispatch markers.
  • Without TOMBOX_DRED=2 nothing changes: no hook is installed.

Tests:

  • dred_marks::tests::dispatch_markers_give_the_group_counts_of_the_dispatch_they_precede: done, first-unfinished and queued dispatches get their own counts; a dispatch with no marker since the previous work op gets none; a draw never does; marker text format.
  • cargo test -p d3d12_xs --lib -- --test-threads=1 (with TOMBOX_REMOVED_EXIT_MS=off): 660 passed, 4 failed, 71 ignored; the same 4 fail on main here (alias::tests::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement, placed_offset::tests::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap, title_shadow::tests::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes, xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs).
  • Native Windows 11; not run under Proton.

Not verified in a title: the markers were added on a test branch for the Matrix hang above, but no removal has been captured with them yet, so a real report with groups= has not been seen.

  • Tests pass
  • No game or console files and no binaries included
  • No fake success; anything not possible is left missing with a note
<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6557440143 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/273). Originally posted by [GDAgent](https://github.com/GDAgent) on 2026-11-23T10:39:59Z. --- **Library / area:** `d3d12_xs` (`dred_marks.rs`, two log strings in `dred.rs`) **Exports changed (exports.txt rows):** none **Why:** with `TOMBOX_DRED=2`, a device-removal report names the PSO (the Xbox shader hashes) of every op around the first unfinished one, but not the size of a dispatch. When a compute shader hangs the GPU, the group count is the first thing needed to tell a runaway loop from a dispatch that is simply too large. This came up while chasing a `DXGI_ERROR_DEVICE_HUNG` in a Niagara compute shader in The Matrix Awakens, where the report showed which dispatch hung but not how big it was. Changes: - With PSO markers on (`TOMBOX_DRED=2`), `Dispatch` (Xbox slot 14) and `DispatchX` (slot 78) also write a `SetMarker` `tbdispatch XxYxZ` before forwarding to the previous slot entry. They chain like the other hooks on those slots (for example `TOMBOX_PASSCAP`). - The removal report appends `groups=XxYxZ` to a `DISPATCH` op when the latest dispatch marker before it has no other draw or dispatch in between. Dispatch markers are not shown as title markers and do not count as PSO markers. - The `TOMBOX_DRED` log lines say that mode 2 also adds Dispatch markers. - Without `TOMBOX_DRED=2` nothing changes: no hook is installed. Tests: - `dred_marks::tests::dispatch_markers_give_the_group_counts_of_the_dispatch_they_precede`: done, first-unfinished and queued dispatches get their own counts; a dispatch with no marker since the previous work op gets none; a draw never does; marker text format. - `cargo test -p d3d12_xs --lib -- --test-threads=1` (with `TOMBOX_REMOVED_EXIT_MS=off`): 660 passed, 4 failed, 71 ignored; the same 4 fail on `main` here (`alias::tests::msaa_depth_with_a_larger_pc_layout_never_overlaps_the_next_title_placement`, `placed_offset::tests::uneven_views_get_exact_helpers_and_msaa_shares_the_alias_heap`, `title_shadow::tests::buffer_then_texture_migrates_to_one_local_heap_and_keeps_bytes`, `xs_exports::console_fixed_tests::fixed_result_dxgix_exports_match_every_console_d3d12_xs`). - Native Windows 11; not run under Proton. **Not verified in a title:** the markers were added on a test branch for the Matrix hang above, but no removal has been captured with them yet, so a real report with `groups=` has not been seen. - [x] Tests pass - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
omonkeyz commented 2026-11-23 13:45:28 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T13:45:28Z.


Applied locally on main with your authorship kept (cherry-picked, 89d07c1); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7102984973 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/273#issuecomment-7102984973). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-23T13:45:28Z. --- Applied locally on main with your authorship kept (cherry-picked, 89d07c1); tests pass in a sandbox. It ships in the next release; this PR will be closed when that is pushed. Thanks.
omonkeyz commented 2026-11-25 13:09:37 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:09:37Z.


Applied on main in 89d07c1 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7163375923 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/273#issuecomment-7163375923). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:09:37Z. --- Applied on main in 89d07c1 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

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
omonkeyz/xbox-emulator!273
No description provided.