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

Merged
marquezinii merged 1 commit from upstream-pr/1592 into main 2026-11-25 13:19:53 +00:00
marquezinii commented 2026-11-24 18:02:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T18:02:48Z.


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 #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.
<!-- greyfinch-sync:ivall/xcl:issue:6588214354 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T18:02:48Z. --- 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](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7142981379) 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 #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 commented 2026-11-24 18:08:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:06:29Z.

Review: COMMENTED


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

<!-- greyfinch-sync:ivall/xcl:review:6044730005 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#pullrequestreview-6044730005). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:06:29Z. **Review:** COMMENTED --- AI-assisted review (GPT-6): I verified command-list reset semantics against the D3D12 API contract and traced the label lookup by list pointer.
gut0to commented 2026-11-24 18:09:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T18:06:29Z.

Code review location: crates/xcl/src/hle/d3d12x/dred.rs; line 85

@@ -0,0 +1,163 @@
+//! `XCL_DRED=1`: which translated pipeline a command list had bound where the GPU faulted.
+//!
+//! DRED's breadcrumbs give the operations a list got through, not which pipeline was bound, so
+//! a page fault in a translated shader names no console shader. With `XCL_DRED=1` every
+//! `SetPipelineState` XCL records for the title is followed by a `SetMarker`, and XCL keeps the
+//! pipeline's label (its console shaders' hashes) in the list's order. The runtime kept no
+//! marker text here (breadcrumb contexts came back empty: Windows 26300, NVIDIA 621.40), but it
+//! records each marker as an operation, so the markers before the operation DRED stopped at
+//! give the label bound there. DRED's count can lag behind the GPU (NVIDIA: a fault in the
+//! second dispatch left the first one not done), so the labels bound after it are given too.
+//! The title's own markers are counted, unlabelled, to keep the count in step; DRED gave the
+//! list's name and not its pointer, so XCL names each list `xcl list 0x…` it marks.
+
+use std::collections::HashMap;
+use std::ffi::c_void;
+use std::sync::{Mutex, OnceLock};
+use windows::core::Interface;
+use windows::Win32::Graphics::Direct3D12::{ID3D12GraphicsCommandList, D3D12_AUTO_BREADCRUMB_OP_SETMARKER};
+
+/// translated pipeline → its label
+static LABELS: Mutex<Option<HashMap<usize, String>>> = Mutex::new(None);
+/// PC command list → the label of each marker recorded since its last Reset (`None`: the title's)
+static MARKS: Mutex<Option<HashMap<usize, Vec<Option<String>>>>> = Mutex::new(None);
+
+thread_local! {
+    /// XCL's own marker is being recorded: the list's SetMarker hook must not count it again
+    static OWN_MARKER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
+}
+
+pub fn on() -> bool {
+    static ON: OnceLock<bool> = OnceLock::new();
+    *ON.get_or_init(|| std::env::var_os("XCL_DRED").is_some())
+}
+
+/// Name a translated pipeline by its console shaders (`("ms", bytes)`, …).
+pub fn label(pso: usize, shaders: &[(&str, Option<&[u8]>)]) {
+    if !on() || pso == 0 {
+        return;
+    }
+    let text = shaders.iter().filter_map(|(k, b)| b.map(|b| format!("{k} {:016x}", crate::gpu::shader::fnv64(b)))).collect::<Vec<_>>().join(" ");
+    LABELS.lock().unwrap().get_or_insert_with(HashMap::new).insert(pso, text);
+}
+
+fn label_of(pso: usize) -> Option<String> {
+    LABELS.lock().unwrap().as_ref()?.get(&pso).cloned()
+}
+
+/// After `SetPipelineState(pso)` on `list`: a marker, and the label of what is bound now.
+/// `pso` is the title's object, `bound` what reached the PC list (a stand-in while it builds).
+pub unsafe fn mark_pipeline(list: *mut c_void, pso: usize, bound: usize) {
+    if !on() || list.is_null() {
+        return;
+    }
+    // nothing labelled: a stand-in still building, or a pipeline of PC shaders
+    let text = label_of(bound).unwrap_or_else(|| format!("pipeline {pso:#x} (a stand-in, or not translated)"));
+    let first = !MARKS.lock().unwrap().as_ref().and_then(|m| m.get(&(list as usize))).is_some_and(|v| v.iter().any(Option::is_some));
+    push(list as usize, Some(text));
+    if let Some(l) = ID3D12GraphicsCommandList::from_raw_borrowed(&list) {
+        // DRED's node may give the list's name and not its pointer (NVIDIA, Windows 26300)
+        if first {
+            let _ = l.SetName(&windows::core::HSTRING::from(format!("xcl list {:#x}", list as usize)));
+        }
+        let w: Vec<u16> = "xcl pipeline".encode_utf16().chain([0]).collect();
+        OWN_MARKER.with(|f| f.set(true));
+        l.SetMarker(0, Some(w.as_ptr() as *const c_void), (w.len() * 2) as u32);
+        OWN_MARKER.with(|f| f.set(false));
+    }
+}
+
+/// The title's own `SetMarker` on `list`: counted, so the labels after it stay in step.
+pub fn title_marker(list: *mut c_void) {
+    if on() && !OWN_MARKER.with(|f| f.get()) {
+        push(list as usize, None);
+    }
+}
+
+fn push(list: usize, mark: Option<String>) {
+    MARKS.lock().unwrap().get_or_insert_with(HashMap::new).entry(list).or_default().push(mark);
+}
+
+/// A list was Reset: DRED's history of it starts again too.
+pub fn reset(list: *mut c_void) {
+    if on() {
+        if let Some(m) = MARKS.lock().unwrap().as_mut() {
+            m.remove(&(list as usize));

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.

<!-- greyfinch-sync:ivall/xcl:review-comment:4684407886 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#discussion_r4684407886). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-24T18:06:29Z. **Code review location:** `crates/xcl/src/hle/d3d12x/dred.rs`; line 85 ~~~~diff @@ -0,0 +1,163 @@ +//! `XCL_DRED=1`: which translated pipeline a command list had bound where the GPU faulted. +//! +//! DRED's breadcrumbs give the operations a list got through, not which pipeline was bound, so +//! a page fault in a translated shader names no console shader. With `XCL_DRED=1` every +//! `SetPipelineState` XCL records for the title is followed by a `SetMarker`, and XCL keeps the +//! pipeline's label (its console shaders' hashes) in the list's order. The runtime kept no +//! marker text here (breadcrumb contexts came back empty: Windows 26300, NVIDIA 621.40), but it +//! records each marker as an operation, so the markers before the operation DRED stopped at +//! give the label bound there. DRED's count can lag behind the GPU (NVIDIA: a fault in the +//! second dispatch left the first one not done), so the labels bound after it are given too. +//! The title's own markers are counted, unlabelled, to keep the count in step; DRED gave the +//! list's name and not its pointer, so XCL names each list `xcl list 0x…` it marks. + +use std::collections::HashMap; +use std::ffi::c_void; +use std::sync::{Mutex, OnceLock}; +use windows::core::Interface; +use windows::Win32::Graphics::Direct3D12::{ID3D12GraphicsCommandList, D3D12_AUTO_BREADCRUMB_OP_SETMARKER}; + +/// translated pipeline → its label +static LABELS: Mutex<Option<HashMap<usize, String>>> = Mutex::new(None); +/// PC command list → the label of each marker recorded since its last Reset (`None`: the title's) +static MARKS: Mutex<Option<HashMap<usize, Vec<Option<String>>>>> = Mutex::new(None); + +thread_local! { + /// XCL's own marker is being recorded: the list's SetMarker hook must not count it again + static OWN_MARKER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) }; +} + +pub fn on() -> bool { + static ON: OnceLock<bool> = OnceLock::new(); + *ON.get_or_init(|| std::env::var_os("XCL_DRED").is_some()) +} + +/// Name a translated pipeline by its console shaders (`("ms", bytes)`, …). +pub fn label(pso: usize, shaders: &[(&str, Option<&[u8]>)]) { + if !on() || pso == 0 { + return; + } + let text = shaders.iter().filter_map(|(k, b)| b.map(|b| format!("{k} {:016x}", crate::gpu::shader::fnv64(b)))).collect::<Vec<_>>().join(" "); + LABELS.lock().unwrap().get_or_insert_with(HashMap::new).insert(pso, text); +} + +fn label_of(pso: usize) -> Option<String> { + LABELS.lock().unwrap().as_ref()?.get(&pso).cloned() +} + +/// After `SetPipelineState(pso)` on `list`: a marker, and the label of what is bound now. +/// `pso` is the title's object, `bound` what reached the PC list (a stand-in while it builds). +pub unsafe fn mark_pipeline(list: *mut c_void, pso: usize, bound: usize) { + if !on() || list.is_null() { + return; + } + // nothing labelled: a stand-in still building, or a pipeline of PC shaders + let text = label_of(bound).unwrap_or_else(|| format!("pipeline {pso:#x} (a stand-in, or not translated)")); + let first = !MARKS.lock().unwrap().as_ref().and_then(|m| m.get(&(list as usize))).is_some_and(|v| v.iter().any(Option::is_some)); + push(list as usize, Some(text)); + if let Some(l) = ID3D12GraphicsCommandList::from_raw_borrowed(&list) { + // DRED's node may give the list's name and not its pointer (NVIDIA, Windows 26300) + if first { + let _ = l.SetName(&windows::core::HSTRING::from(format!("xcl list {:#x}", list as usize))); + } + let w: Vec<u16> = "xcl pipeline".encode_utf16().chain([0]).collect(); + OWN_MARKER.with(|f| f.set(true)); + l.SetMarker(0, Some(w.as_ptr() as *const c_void), (w.len() * 2) as u32); + OWN_MARKER.with(|f| f.set(false)); + } +} + +/// The title's own `SetMarker` on `list`: counted, so the labels after it stay in step. +pub fn title_marker(list: *mut c_void) { + if on() && !OWN_MARKER.with(|f| f.get()) { + push(list as usize, None); + } +} + +fn push(list: usize, mark: Option<String>) { + MARKS.lock().unwrap().get_or_insert_with(HashMap::new).entry(list).or_default().push(mark); +} + +/// A list was Reset: DRED's history of it starts again too. +pub fn reset(list: *mut c_void) { + if on() { + if let Some(m) = MARKS.lock().unwrap().as_mut() { + m.remove(&(list as usize)); ~~~~ --- 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.
marquezinii commented 2026-11-24 19:06:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T18:33:30Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:ivall/xcl:review:6045116742 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#pullrequestreview-6045116742). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T18:33:30Z. **Review:** COMMENTED --- _No description provided._
eizispark commented 2026-11-24 19:07:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by eizispark on 2026-11-24T18:11:52Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7140297878 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7140297878). Originally posted by [eizispark](https://github.com/eizispark) on 2026-11-24T18:11:52Z. --- ### 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 commented 2026-11-24 19:07:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by IvyNotFound on 2026-11-24T18:14:12Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7140354767 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7140354767). Originally posted by [IvyNotFound](https://github.com/IvyNotFound) on 2026-11-24T18:14:12Z. --- 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 commented 2026-11-24 19:07:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MatyEjsr on 2026-11-24T18:25:30Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7140626153 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7140626153). Originally posted by [MatyEjsr](https://github.com/MatyEjsr) on 2026-11-24T18:25:30Z. --- 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 commented 2026-11-24 19:07:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by crosettiremi on 2026-11-24T18:31:23Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7140762365 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7140762365). Originally posted by [crosettiremi](https://github.com/crosettiremi) on 2026-11-24T18:31:23Z. --- 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 commented 2026-11-24 19:07:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T18:33:28Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7140811505 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7140811505). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T18:33:28Z. --- 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 #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 commented 2026-11-24 19:07:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T18:41:06Z.


@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.

<!-- greyfinch-sync:ivall/xcl:comment:7140998256 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7140998256). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T18:41:06Z. --- @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.
marquezinii commented 2026-11-24 19:08:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T18:33:30Z.

Code review location: crates/xcl/src/hle/d3d12x/dred.rs; line 85

@@ -0,0 +1,163 @@
+//! `XCL_DRED=1`: which translated pipeline a command list had bound where the GPU faulted.
+//!
+//! DRED's breadcrumbs give the operations a list got through, not which pipeline was bound, so
+//! a page fault in a translated shader names no console shader. With `XCL_DRED=1` every
+//! `SetPipelineState` XCL records for the title is followed by a `SetMarker`, and XCL keeps the
+//! pipeline's label (its console shaders' hashes) in the list's order. The runtime kept no
+//! marker text here (breadcrumb contexts came back empty: Windows 26300, NVIDIA 621.40), but it
+//! records each marker as an operation, so the markers before the operation DRED stopped at
+//! give the label bound there. DRED's count can lag behind the GPU (NVIDIA: a fault in the
+//! second dispatch left the first one not done), so the labels bound after it are given too.
+//! The title's own markers are counted, unlabelled, to keep the count in step; DRED gave the
+//! list's name and not its pointer, so XCL names each list `xcl list 0x…` it marks.
+
+use std::collections::HashMap;
+use std::ffi::c_void;
+use std::sync::{Mutex, OnceLock};
+use windows::core::Interface;
+use windows::Win32::Graphics::Direct3D12::{ID3D12GraphicsCommandList, D3D12_AUTO_BREADCRUMB_OP_SETMARKER};
+
+/// translated pipeline → its label
+static LABELS: Mutex<Option<HashMap<usize, String>>> = Mutex::new(None);
+/// PC command list → the label of each marker recorded since its last Reset (`None`: the title's)
+static MARKS: Mutex<Option<HashMap<usize, Vec<Option<String>>>>> = Mutex::new(None);
+
+thread_local! {
+    /// XCL's own marker is being recorded: the list's SetMarker hook must not count it again
+    static OWN_MARKER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
+}
+
+pub fn on() -> bool {
+    static ON: OnceLock<bool> = OnceLock::new();
+    *ON.get_or_init(|| std::env::var_os("XCL_DRED").is_some())
+}
+
+/// Name a translated pipeline by its console shaders (`("ms", bytes)`, …).
+pub fn label(pso: usize, shaders: &[(&str, Option<&[u8]>)]) {
+    if !on() || pso == 0 {
+        return;
+    }
+    let text = shaders.iter().filter_map(|(k, b)| b.map(|b| format!("{k} {:016x}", crate::gpu::shader::fnv64(b)))).collect::<Vec<_>>().join(" ");
+    LABELS.lock().unwrap().get_or_insert_with(HashMap::new).insert(pso, text);
+}
+
+fn label_of(pso: usize) -> Option<String> {
+    LABELS.lock().unwrap().as_ref()?.get(&pso).cloned()
+}
+
+/// After `SetPipelineState(pso)` on `list`: a marker, and the label of what is bound now.
+/// `pso` is the title's object, `bound` what reached the PC list (a stand-in while it builds).
+pub unsafe fn mark_pipeline(list: *mut c_void, pso: usize, bound: usize) {
+    if !on() || list.is_null() {
+        return;
+    }
+    // nothing labelled: a stand-in still building, or a pipeline of PC shaders
+    let text = label_of(bound).unwrap_or_else(|| format!("pipeline {pso:#x} (a stand-in, or not translated)"));
+    let first = !MARKS.lock().unwrap().as_ref().and_then(|m| m.get(&(list as usize))).is_some_and(|v| v.iter().any(Option::is_some));
+    push(list as usize, Some(text));
+    if let Some(l) = ID3D12GraphicsCommandList::from_raw_borrowed(&list) {
+        // DRED's node may give the list's name and not its pointer (NVIDIA, Windows 26300)
+        if first {
+            let _ = l.SetName(&windows::core::HSTRING::from(format!("xcl list {:#x}", list as usize)));
+        }
+        let w: Vec<u16> = "xcl pipeline".encode_utf16().chain([0]).collect();
+        OWN_MARKER.with(|f| f.set(true));
+        l.SetMarker(0, Some(w.as_ptr() as *const c_void), (w.len() * 2) as u32);
+        OWN_MARKER.with(|f| f.set(false));
+    }
+}
+
+/// The title's own `SetMarker` on `list`: counted, so the labels after it stay in step.
+pub fn title_marker(list: *mut c_void) {
+    if on() && !OWN_MARKER.with(|f| f.get()) {
+        push(list as usize, None);
+    }
+}
+
+fn push(list: usize, mark: Option<String>) {
+    MARKS.lock().unwrap().get_or_insert_with(HashMap::new).entry(list).or_default().push(mark);
+}
+
+/// A list was Reset: DRED's history of it starts again too.
+pub fn reset(list: *mut c_void) {
+    if on() {
+        if let Some(m) = MARKS.lock().unwrap().as_mut() {
+            m.remove(&(list as usize));

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.)

<!-- greyfinch-sync:ivall/xcl:review-comment:4684730529 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#discussion_r4684730529). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T18:33:30Z. **Code review location:** `crates/xcl/src/hle/d3d12x/dred.rs`; line 85 ~~~~diff @@ -0,0 +1,163 @@ +//! `XCL_DRED=1`: which translated pipeline a command list had bound where the GPU faulted. +//! +//! DRED's breadcrumbs give the operations a list got through, not which pipeline was bound, so +//! a page fault in a translated shader names no console shader. With `XCL_DRED=1` every +//! `SetPipelineState` XCL records for the title is followed by a `SetMarker`, and XCL keeps the +//! pipeline's label (its console shaders' hashes) in the list's order. The runtime kept no +//! marker text here (breadcrumb contexts came back empty: Windows 26300, NVIDIA 621.40), but it +//! records each marker as an operation, so the markers before the operation DRED stopped at +//! give the label bound there. DRED's count can lag behind the GPU (NVIDIA: a fault in the +//! second dispatch left the first one not done), so the labels bound after it are given too. +//! The title's own markers are counted, unlabelled, to keep the count in step; DRED gave the +//! list's name and not its pointer, so XCL names each list `xcl list 0x…` it marks. + +use std::collections::HashMap; +use std::ffi::c_void; +use std::sync::{Mutex, OnceLock}; +use windows::core::Interface; +use windows::Win32::Graphics::Direct3D12::{ID3D12GraphicsCommandList, D3D12_AUTO_BREADCRUMB_OP_SETMARKER}; + +/// translated pipeline → its label +static LABELS: Mutex<Option<HashMap<usize, String>>> = Mutex::new(None); +/// PC command list → the label of each marker recorded since its last Reset (`None`: the title's) +static MARKS: Mutex<Option<HashMap<usize, Vec<Option<String>>>>> = Mutex::new(None); + +thread_local! { + /// XCL's own marker is being recorded: the list's SetMarker hook must not count it again + static OWN_MARKER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) }; +} + +pub fn on() -> bool { + static ON: OnceLock<bool> = OnceLock::new(); + *ON.get_or_init(|| std::env::var_os("XCL_DRED").is_some()) +} + +/// Name a translated pipeline by its console shaders (`("ms", bytes)`, …). +pub fn label(pso: usize, shaders: &[(&str, Option<&[u8]>)]) { + if !on() || pso == 0 { + return; + } + let text = shaders.iter().filter_map(|(k, b)| b.map(|b| format!("{k} {:016x}", crate::gpu::shader::fnv64(b)))).collect::<Vec<_>>().join(" "); + LABELS.lock().unwrap().get_or_insert_with(HashMap::new).insert(pso, text); +} + +fn label_of(pso: usize) -> Option<String> { + LABELS.lock().unwrap().as_ref()?.get(&pso).cloned() +} + +/// After `SetPipelineState(pso)` on `list`: a marker, and the label of what is bound now. +/// `pso` is the title's object, `bound` what reached the PC list (a stand-in while it builds). +pub unsafe fn mark_pipeline(list: *mut c_void, pso: usize, bound: usize) { + if !on() || list.is_null() { + return; + } + // nothing labelled: a stand-in still building, or a pipeline of PC shaders + let text = label_of(bound).unwrap_or_else(|| format!("pipeline {pso:#x} (a stand-in, or not translated)")); + let first = !MARKS.lock().unwrap().as_ref().and_then(|m| m.get(&(list as usize))).is_some_and(|v| v.iter().any(Option::is_some)); + push(list as usize, Some(text)); + if let Some(l) = ID3D12GraphicsCommandList::from_raw_borrowed(&list) { + // DRED's node may give the list's name and not its pointer (NVIDIA, Windows 26300) + if first { + let _ = l.SetName(&windows::core::HSTRING::from(format!("xcl list {:#x}", list as usize))); + } + let w: Vec<u16> = "xcl pipeline".encode_utf16().chain([0]).collect(); + OWN_MARKER.with(|f| f.set(true)); + l.SetMarker(0, Some(w.as_ptr() as *const c_void), (w.len() * 2) as u32); + OWN_MARKER.with(|f| f.set(false)); + } +} + +/// The title's own `SetMarker` on `list`: counted, so the labels after it stay in step. +pub fn title_marker(list: *mut c_void) { + if on() && !OWN_MARKER.with(|f| f.get()) { + push(list as usize, None); + } +} + +fn push(list: usize, mark: Option<String>) { + MARKS.lock().unwrap().get_or_insert_with(HashMap::new).entry(list).or_default().push(mark); +} + +/// A list was Reset: DRED's history of it starts again too. +pub fn reset(list: *mut c_void) { + if on() { + if let Some(m) = MARKS.lock().unwrap().as_mut() { + m.remove(&(list as usize)); ~~~~ --- 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.)
LocranKing commented 2026-11-24 21:09:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by LocranKing on 2026-11-24T20:03:30Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7142981379 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7142981379). Originally posted by [LocranKing](https://github.com/LocranKing) on 2026-11-24T20:03:30Z. --- 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 commented 2026-11-24 21:09:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:12:10Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7143184002 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7143184002). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T20:12:10Z. --- 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 commented 2026-11-24 21:09:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T20:54:01Z.


@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.

<!-- greyfinch-sync:ivall/xcl:comment:7144205624 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7144205624). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T20:54:01Z. --- @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.
marquezinii commented 2026-11-24 22:06:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-24T22:00:45Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7145683854 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7145683854). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T22:00:45Z. --- 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.
upstream-sync closed this pull request 2026-11-25 14:08:39 +00:00
ivall commented 2026-11-25 14:09:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-25T13:20:05Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7163626361 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7163626361). Originally posted by [ivall](https://github.com/ivall) on 2026-11-25T13:20:05Z. --- 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`, #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.
DavidM1911 commented 2026-11-26 06:06:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:48:27Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7183822781 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1592#issuecomment-7183822781). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T05:48:27Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
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!1582
No description provided.