Skip to content

D3D12.X: XCL_DRED=1 names the pipeline bound where the GPU faulted - #1592

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
marquezinii:dred-pipeline-labels
Nov 25, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
marquezinii:dred-pipeline-labels

Conversation

@marquezinii

@marquezinii marquezinii commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The device removals reported when the newer retail title loads its world (the mesh shader page faults on #541: an Aftermath dump on an RTX 3070 Ti, DRED on an RX 7900 XT) don't say which translated pipeline faulted. XCL_DRED=1 logs how far each list got, but not what was bound there, and nobody could tell which console shader to look at. With this, the DRED lines name the pipeline by its console shaders' hashes, the same fnv64 hashes the translation log uses.

How it works, and why not in the simplest way: on this machine DRED kept no marker text (breadcrumb contexts came back empty), and gave the list's debug name but a null pCommandList. So each SetPipelineState XCL records for the title is followed by a SetMarker, XCL keeps the pipeline's label per list in order, and on a removal it counts the marker operations in DRED's history up to where the list stopped. The title's own markers are counted without a label (a SetMarker hook). Marked lists are named xcl list 0x… so a node can be matched without its pointer. DRED's count can also lag behind the GPU here: with a fault in the second of two dispatches, it left the first one not done. So the labels bound after that point are printed too. Nothing changes without XCL_DRED=1 except the SetMarker hook forwarding the call.

What is in it

  • crates/xcl/src/hle/d3d12x/dred.rs (new): labels per pipeline, markers per list (its last 4 recordings, a DRED node matched to the one with as many markers), bound_at / bound_after from a DRED history, node_list; unit tests for the counting (the title's markers skipped, ops after the stop point), the recording match and the name parsing.
  • crates/xcl/src/hle/d3d12x/real.rs: labels where translated compute, graphics, mesh and VS+GS pipelines are made; a marker in cl_set_pipeline_state, ClearState and after Reset with an initial state; a SetMarker hook; labels and marks dropped with a released pipeline or list; the pipeline in log_device_removed's DRED lines.
  • crates/xcl/src/hle/d3d12x/device_x.rs, list_x.rs: a list created with an initial pipeline, and the next segment of a Wait64 mid-list split, start a recording with it marked.
  • crates/xcl/src/hle/d3d12x/console_list.rs: a replay starts a recording of the PC list (its SetPipelineState is the adopted list's, so it is marked there).
  • README.md: what XCL_DRED=1 now logs.

What a line looks like (from the check below, shortened): DRED: list … 2 of 7 operations done, around: …; pipeline bound there: cs e42ba8a014b743b9; bound after it: cs 26e1b0c2aadbe056.

Tested

  • NVIDIA GeForce RTX 5070 12 GB, driver 621.40; Ryzen 5 5600X; Windows 11 Pro 26300; Rust 1.99.1 MSVC; DXC 1.9.2602.17; debug.
  • cargo test --workspace -- --test-threads=4 on c6067a6 (rebased onto main 1d027e5): 963 passed, 0 failed, 43 ignored. The same with XCL_DRED=1 set: 963 passed, 0 failed, 43 ignored. SKIPPED: the wave64 cases of lower / lower_dxil and gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), the f16 and conversion forms lower_dxil refuses in wave32, heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache). On 681e0ab, before the rebase: 780 passed, 0 failed, 41 ignored both ways.
  • A real page fault on this card, from a scratch test that is not in the PR: a compute pipeline bound and dispatched on a valid buffer, then the title's own SetMarker, then a second pipeline dispatched with a root UAV at an unmapped address. The device was removed (0x887A0006). From DRED's history bound_at gave the first pipeline's label and bound_after the faulting one's, with the title's marker skipped. DRED reported PageFaultVA 0 for that fault (the address was 0x700000000), so on NVIDIA a DRED page fault "at VA 0" doesn't by itself mean a null address.

Regression run
Needs a new pair for this head c6067a6. It is 681e0ab rebased onto main 1d027e5, because the PR no longer merged: the only conflict was the XCL_DRED lines in README.md, and the code is unchanged. The pair below was run on 681e0ab. Run by @LocranKing on an NVIDIA GeForce RTX 3060 Ti, 60 s each, XCL_NETWORK=0, release, copied from their comment as posted:

main:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1566 (PresentX 1566)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14715 MB

PR:

xcl-smoke v1
commit: 681e0abeb8627439b3035c5bd5e7e492420efdc7
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1571 (PresentX 1571)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15224 MB

Not tested

  • A retail title with XCL_DRED=1 on this head: I did not run one; the smoke pair above is a regression run of the title, not a fault capture. crosettiremi's run on an RX 7900 XT during world loading (a device hang, on an earlier head with local changes) got labels on 18 of 20 unfinished lists, see the comments. Whether it names the mesh pipeline behind the faults on D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541 is not shown yet.
  • AMD and Intel DRED (whether they fill pCommandList or breadcrumb contexts there; the name and the marker count are used either way); Wine / vkd3d-proton.
  • A list Reset and recorded again while an earlier submission of it runs: the right recording is found when the two have different marker counts; with the same count the newer one is reported.

AI use

  • Claude Code (Claude Opus 5.5): wrote the change, the tests and this description, and ran the tests and the scratch fault check on the hardware above.

@gut0to gut0to left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted review (GPT-6): I verified command-list reset semantics against the D3D12 API contract and traced the label lookup by list pointer.

pub fn reset(list: *mut c_void) {
if on() {
if let Some(m) = MARKS.lock().unwrap().as_mut() {
m.remove(&(list as usize));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could labels be retained per recording generation until the corresponding submission completes? D3D12 allows Reset while a command list is still executing. If the old submission faults after this removes its labels and the same pointer has new labels, DRED looks up the old node by that pointer and can report the pipeline from the newer recording. Please retain the old labels until in-flight submissions can no longer reference them. AI-assisted review: I checked the Reset contract and traced the pointer-based DRED lookup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 681e0ab: a Reset starts a new recording instead of dropping the old one; a list keeps its last 4, and a DRED node is matched to the newest recording with as many markers as its history. When the old and new recordings have the same marker count it still picks the newer one, so it is a heuristic. The unit test a_fault_in_an_earlier_recording_finds_that_recording covers both cases. (Claude Code with Claude Opus 5.5 made the change.)

@eizispark

Copy link
Copy Markdown

Hardware test report — commit 5883e44

Verified 5883e441fe421bd5da96d3c3676ffaca2a0ed42d (clean merge with main 9e3831e1f570d3646e53ab753b19ec07eb8f1485): pass.

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 779 passed, 0 failed, 41 ignored (1 skipped: heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows), including all three new hle::d3d12x::dred::tests (node_list_takes_the_pointer_or_the_name_xcl_gave, markers_before_counts_only_markers_ahead_of_the_failing_op, bound_at_skips_the_titles_markers), hle::d3d12x::real::dred_tests::a_late_partially_executed_list_is_reported_before_unstarted_lists, and the native-wave64 tests (gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware, console_wave64_compute_through_the_pso_hook_dispatch_and_read_back)

Regression run
main (9e3831e1f570d3646e53ab753b19ec07eb8f1485):

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14728 MB

PR (5883e441fe421bd5da96d3c3676ffaca2a0ed42d):

xcl-smoke v1
commit: 5883e441fe421bd5da96d3c3676ffaca2a0ed42d
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1678 (PresentX 1678)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14857 MB

Not tested

  • an actual XCL_DRED=1 GPU page-fault / device-removal run, NVIDIA/Intel GPUs, Wine/vkd3d-proton, XCL_SAMPLE_*

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) — ran the workspace test suite and 60 s retail smoke run on this commit and formatted the report.

@IvyNotFound

Copy link
Copy Markdown

A data point for using this on the retail title, and a related PR.

On an RTX 5080 (driver 621.24, Windows), XCL_DRED=1 changed what the driver accepts from its pipeline cache. With DRED's auto-breadcrumbs and page-fault reports forced on, none of the cached driver blobs were taken. The title's first big compute pipeline (1.99 MB of DXIL) was built again in 153 s, and the run never got past the title's start (2 frames in 160 s; main presents ~1 300 in that time). That run was on an earlier main with a local marker patch. It was one run, and I have not checked which DRED setting causes it. If the same holds on other NVIDIA cards, a world-load run with this PR on needs a warm-up run with XCL_DRED=1 first, or a long wait at the start.

#1323 names what is in flight without DRED, for stalls rather than device removals. XCL_GPU_CULPRIT=1 wraps each recorded dispatch in WriteBufferImmediate markers. When the GPU-wait watchdog fires, it logs the console CS hashes (fnv64, as here) of the dispatches that started and did not finish. The two could share the per-pipeline hash bookkeeping if both land.

AI use: Claude Code (Claude Opus 5.5) wrote this note from runs on my machine.

@MatyEjsr

Copy link
Copy Markdown

Verified PR #1592 at commit 5883e441fe421bd5da96d3c3676ffaca2a0ed42d on NVIDIA RTX 3090 (Ampere) with both default settings and XCL_DRED=1, plus a code review of the DRED tracking hooks.

Tested

  • System: Windows 11 Pro for Workstations 10.0.26200 (Build 26200), AMD Ryzen 7 7800X3D, NVIDIA GeForce RTX 3090 (driver 617.42), 31.4 GB RAM, Rust 1.100.0 MSVC (debug), DXC dxcompiler 1.9.2602.17 / dxil 1.9.2602.17
  • cargo build --workspace -j 8: succeeded in 5.72s (0 errors, 2 pre-existing fetch_update deprecation warnings)
  • cargo test --workspace -j 8 -- --test-threads=4 (default env): 779 reported passed (774 executed + 5 SKIPPED), 0 failed, 41 ignored (xcl lib 15.03s)
  • XCL_DRED=1 cargo test -p xcl --lib dred: 4 passed, 0 failed, 0 ignored (0.00s)
  • XCL_DRED=1 cargo test --workspace -j 8 -- --test-threads=4: 779 reported passed (774 executed + 5 SKIPPED), 0 failed, 41 ignored (xcl lib 15.10s)
  • Note on --test-threads=8: both default and XCL_DRED=1 runs hit a concurrency failure in gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem (assertion left == right failed: submit 1 lane 0 mismatch; 729 passed, 1 failed, 21 ignored in xcl --lib), while standalone (0.39s) and --test-threads=4 runs passed cleanly.
  • SKIPPED tests (5 in both --test-threads=4 runs, not counted as coverage):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64)
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)
    • test_title_draws_with_a_root_signature_under_the_debug_layer (no d3d12SDKLayers.dll)
    • heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
    • uploads_start_from_each_subresources_state (no D3D12 debug layer, 0x887A002D)

Review notes (confirmed in source)

  1. Duplicate marker on console_list.rs:857-858: st.pc comes from real::dev_create_command_list (real.rs:2413), which adopts Kind::CommandList (including the SetPipelineState hook cl_set_pipeline_state). Calling list.SetPipelineState(pc) on line 857 already invokes dred::mark_pipeline, so the second explicit call to dred::mark_pipeline on line 858 records two back-to-back SetMarker ops and two MARKS entries per replayed dispatch (causing bound_after to repeat each pipeline label twice).
  2. Untracked initial/cleared/split PSO bindings: cl_reset marks a non-null initial_state, but device_x::create_list (device_x.rs:98-103, when a list is created with a non-null initial PSO and records before its first Reset), cl_clear_state (real.rs:5131-5137, ClearState(pso)), and mid-list split segments (list_x.rs:2484-2505) do not call dred::reset / dred::mark_pipeline.
  3. Cleanup on release: forget_pso (real.rs:1722) clears every other address-keyed PSO map to avoid stale metadata on address reuse, and cl_release (real.rs:5169) clears list_x / bind; pruning dred::LABELS in forget_pso and dred::MARKS in cl_release would prevent stale labels or stale marks if an address is reused.

Not tested

  • AMD / Intel GPUs and native wave64 hardware
  • D3D12 debug layer tests and heap-window tests
  • Live GPU page fault / device removal capture or retail title smoke run (scripts/smoke.ps1)
  • Linux / Wine / vkd3d-proton

AI use

  • agy with gemini-4-neon-high: checked out commit 5883e441, ran the build and workspace test suites (default and XCL_DRED=1), audited the DRED hook paths, and wrote this report.

@crosettiremi

Copy link
Copy Markdown

Tested the pipeline labels on an RX 7900 XT with DRED enabled during retail world loading. At 189.36 s the driver reported DXGI_ERROR_DEVICE_HUNG. Of 20 reported unfinished lists, one had made progress (14/112 operations), and 18 had pipeline labels. The partially completed list reported CS hash 4401d482ef24797c, which the title shader index identifies as meshlet_culling:CS_BatchCullInitArgs. The first outstanding operation was ClearDepthStencilView. A compute PSO being bound at that point does not establish that its dispatch caused the hang. DRED reported GPU VA 0 and no allocation names. The same run recorded an actual 33-list ExecuteCommandLists call about ten seconds earlier. Local diagnostic changes also prioritized partially completed DRED nodes in the output. This confirms the labels are usable on this AMD path.

@marquezinii

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews. All of these are in the new head (squashed into the one commit):

  • @MatyEjsr 1: right, the PC list behind a console list is adopted, so its SetPipelineState already marks. The explicit call in console_list.rs is gone, and there is one marker per replayed dispatch now.
  • 2: ClearState(pso) marks what it binds. A list created with an initial pipeline starts a recording and marks it (device_x::create_list). The next segment of a Wait64 mid-list split does the same (list_x), since it is reset or made without cl_reset.
  • 3: forget_pso drops the pipeline's label, and the list's last release drops its recordings.
  • @gut0to (inline): a Reset no longer drops anything. Each list keeps its last 4 recordings, and a DRED node is matched to the newest recording with as many markers as its history. A fault in a submission that was Reset and recorded again finds its own recording when the two differ in marker count. With the same count it reports the newer one, so it is a heuristic, not exact. A unit test covers both cases.
  • @IvyNotFound: thanks, that's worth knowing before anyone tries this on the title. I haven't checked it here, so I left it out of the README rather than state it from one run. A warm-up run with XCL_DRED=1 sounds like the way to do a world-load run. And yes, if D3D12.X: XCL_GPU_CULPRIT names the dispatches a stalled queue has not done #1323 lands, the per-pipeline hash bookkeeping could be shared.

Tested (new head, same machine as in the description: RTX 5070, driver 621.40, Windows 11 Pro 26300, Rust 1.99.1, debug)

  • cargo test --workspace -- --test-threads=4: 780 passed, 0 failed, 41 ignored (681e0ab)
  • The same with XCL_DRED=1: 780 passed, 0 failed, 41 ignored; SKIPPED in both: the two no-wave64 tests and heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)

AI use: Claude Code (Claude Opus 5.5) made the changes, ran the tests and drafted this reply.

@marquezinii

Copy link
Copy Markdown
Contributor Author

@crosettiremi thanks, that's the first run of this with the title, and the case it was made for: a list stopped part way with a labelled compute pipeline. As you say, the CS bound there doesn't prove its dispatch hung the GPU. It narrows down which shader to look at first, which is what the line is for. I've added a pointer to your run under Not tested in the description, so it's clear that run was yours, on AMD, and not on this head.

AI use: Claude Code (Claude Opus 5.5) drafted this reply.

@LocranKing

Copy link
Copy Markdown

Independent GPU workspace tests and a paired 60 s retail xcl-smoke v1 regression run on NVIDIA RTX 3060 Ti (681e0abeb8627439b3035c5bd5e7e492420efdc7 vs its base main 9e3831e1f570d3646e53ab753b19ec07eb8f1485).

Setup

  • GPU: NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, wave32), driver 32.0.16.2101
  • CPU / RAM: AMD Ryzen 5 5500 (6C/12T), 31.8 GB RAM
  • OS: Windows 11 Home Single Language, build 26200
  • Toolchain: rustc 1.100.0, DXC 1.9.2602.17, --release

Workspace tests (cargo test --workspace --release --no-fail-fast -- --test-threads=4)

  • Exit 0: 780 passed, 0 failed, 41 ignored across 20 result blocks (SKIPPED: 2 no wave64, 2 no D3D12 debug layer, heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).

Regression run (scripts/smoke.ps1, 60 s, XCL_NETWORK=0, title folder name redacted)

  • PR head vs base main: 1571 / 1566 frames (100.3%), 15224 / 14715 MB peak commit (103.5%), 0 device removals, 0 crashes.

Base (main 9e3831e):

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1566 (PresentX 1566)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14715 MB

PR head (681e0ab):

xcl-smoke v1
commit: 681e0abeb8627439b3035c5bd5e7e492420efdc7
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1571 (PresentX 1571)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15224 MB

Not tested: triggering an actual GPU fault with XCL_DRED=1 on a retail title, debug build, AMD / wave64 hardware.

AI use: Antigravity (Gemini 4 Neon) built and ran the test suite and smoke pair on this hardware and drafted this report from the captured outputs; reviewed before posting. No game files attached.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@marquezinii

Copy link
Copy Markdown
Contributor Author

@LocranKing thank you, that's the smoke pair this PR was missing. I've copied both blocks into Regression run as you posted them, credited to you. 9e3831e is on main and the PR block names the current head 681e0ab.

AI use: Claude Code (Claude Opus 5.5) drafted this reply.

DRED's breadcrumbs give the operations a list got through but not which
pipeline was bound, so a page fault in a translated shader (the mesh
shader faults reported on xcl-dev#541) names no console shader.

With XCL_DRED=1, each SetPipelineState XCL records for the title (and
ClearState, a list's initial pipeline, a mid-list split's next segment)
is followed by a SetMarker, and the pipeline's label (the fnv64 hashes
of its console shaders, as in the translation log) is kept per list in
order. On an RTX 5070 (driver 621.40, Windows 26300) DRED kept no marker
text (breadcrumb contexts empty) and gave the list's debug name but a
null pointer, so the markers are counted in the list's operation history
and each marked list is named "xcl list 0x...". The title's own markers
are counted without a label. DRED's count lagged the GPU there (a fault
in the second dispatch left the first one not done), so the labels bound
after that operation are logged too.

A list may be Reset while an earlier submission of it still runs, so
the last 4 recordings of a list are kept and a DRED node is matched to
the newest one with as many markers as its history. Labels and marks go
with the released pipeline or list.
@marquezinii

Copy link
Copy Markdown
Contributor Author

Rebased onto main 1d027e5, because the PR no longer merged. The only conflict was the XCL_DRED paragraph in README.md, next to the new DirectStorage lines; the code is unchanged. The new head is c6067a6. Here, cargo test --workspace -- --test-threads=4 gives 963 passed, 0 failed, 43 ignored, and the same with XCL_DRED=1.

That leaves @LocranKing's smoke pair on the old head 681e0ab, so the description check needs a new one for c6067a6. @LocranKing, or anyone with a title: a scripts/smoke.ps1 pair on main and c6067a6 would put it back where it was. I'll copy it in as before.

AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the tests and drafted this comment.

@ivall

ivall commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Merged as 379725a, thanks. It merged cleanly with main 1a0bbe3.

  • Tested: AMD RDNA4, Windows, DXC 1.8.2502.11, debug. cargo test --workspace --no-fail-fast -- --test-threads=4 on the merged tree (with one other commit, the newer list layout's DispatchMesh slot): 1252 passed, 2 failed (fuzz_validate_and_gpu_1 / _3, DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115, as on main), 46 ignored. The four tests of dred.rs are among the passed.
  • Read before the merge: the whole diff. Without XCL_DRED=1 the only change on the path is the SetMarker hook.
  • Not tested: a device removal with it on; a title run with it is next here.

AI use: Claude Code (Claude Opus 5.5) read it, ran the tests and wrote this on the maintainer's behalf.

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.

10 participants