Crash report names the indirect executions a list stopped at; constant buffer slots hold their scratch memory

Both device losses of 2026-11-25 (play-1125-0203, n02) stopped at the same
place, found by the run of three indirect executions between barriers in the
captures: compute 0452fc2d2e2fc4c3 (meshlet culling), behind fc5e66f8f873d3bb.

- With device-removed data on (DRED=light too) each list keeps, per indirect
  execution, the pipeline and the first 16 dwords of user data; the report
  says them for the stopped commands, and what the heap slots they name hold.
- A dynamic slot that shows a constant buffer in a list's scratch chunk holds
  that chunk (n02: the fault was in the memory of three freed chunks).
  VICTORY_SLOT_HOLDS=0: not held, as before.
- A slot's resource is let go after its descriptor is written over, not
  before; the same resource again is not retired.
- indirect::tests::raw_loads_past_views (ignored, a measurement): on the RX
  7900 XTX raw loads through typed, structured and constant buffer views have
  no end: they read whatever lies after the view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 02:34:49 -06:00
1 parent ad30f2cb1f
commit ac34b4d409
7 files changed
+411 -15

No files matched your search

+82 -3
View File
@@ -889,6 +889,9 @@ pub(crate) struct HostList {
prelude: OnceLock<Option<Prelude>>,
/// The pipelines the list binds, for reports of slow submissions.
pipelines: std::sync::Arc<Mutex<std::collections::BTreeSet<String>>>,
/// What its indirect executions ran, for the report of a removed device.
#[cfg(feature = "diagnostics")]
indirects: indirects::Shared,
/// The work its indirect executions may still do (`indirect`): a
/// shader-writable word, zeroed when the list is submitted, and after
/// it what the clamp notes about mesh records. In memory the CPU maps.
@@ -1404,7 +1407,14 @@ pub(crate) fn dred_faults() -> bool {
#[cfg(feature = "diagnostics")]
#[allow(clippy::type_complexity)]
static LIST_NOTES: Mutex<
std::collections::BTreeMap<u32, (std::sync::Weak<Mutex<Vec<Note>>>, std::sync::Weak<Mutex<std::collections::BTreeSet<String>>>)>,
std::collections::BTreeMap<
u32,
(
std::sync::Weak<Mutex<Vec<Note>>>,
std::sync::Weak<Mutex<std::collections::BTreeSet<String>>>,
std::sync::Weak<Mutex<indirects::Indirects>>,
),
>,
> = Mutex::new(std::collections::BTreeMap::new());
/// The number in the name of a list of ours ("victory host list 7", which the
@@ -3155,6 +3165,7 @@ fn late_line(frames: f64) {
}
mod card_steps;
pub(crate) mod indirects;
mod place;
mod send;
mod torn;
@@ -3522,6 +3533,8 @@ impl Host {
let notes = std::sync::Arc::<Mutex<Vec<Note>>>::default();
let pipelines = std::sync::Arc::<Mutex<std::collections::BTreeSet<String>>>::default();
#[cfg(feature = "diagnostics")]
let indirects = indirects::Shared::default();
#[cfg(feature = "diagnostics")]
if dred_on() || dred_light() {
static NUMBER: AtomicU32 = AtomicU32::new(0);
let number = NUMBER.fetch_add(1, Ordering::Relaxed);
@@ -3530,7 +3543,14 @@ impl Host {
if number.is_multiple_of(256) {
all.retain(|_, l| l.0.strong_count() > 0);
}
all.insert(number, (std::sync::Arc::downgrade(&notes), std::sync::Arc::downgrade(&pipelines)));
all.insert(
number,
(
std::sync::Arc::downgrade(&notes),
std::sync::Arc::downgrade(&pipelines),
std::sync::Arc::downgrade(&indirects),
),
);
}
Ok(HostList {
allocator,
@@ -3541,6 +3561,8 @@ impl Host {
twins: Mutex::default(),
prelude,
pipelines,
#[cfg(feature = "diagnostics")]
indirects,
budget: OnceLock::new(),
card_budget: OnceLock::new(),
indirect_args: Mutex::default(),
@@ -5271,7 +5293,12 @@ impl Host {
#[cfg(feature = "diagnostics")]
let by_name = list_number(&named).and_then(|n| {
let all = LIST_NOTES.lock().unwrap_or_else(|e| e.into_inner());
all.get(&n).map(|(notes, pipelines)| (notes.upgrade(), pipelines.upgrade()))
all.get(&n).map(|(notes, pipelines, _)| (notes.upgrade(), pipelines.upgrade()))
});
#[cfg(feature = "diagnostics")]
let indirects = run.map(|r| r.indirects.clone()).or_else(|| {
let n = list_number(&named)?;
LIST_NOTES.lock().unwrap_or_else(|e| e.into_inner()).get(&n)?.2.upgrade()
});
#[cfg(not(feature = "diagnostics"))]
#[allow(clippy::type_complexity)]
@@ -5301,6 +5328,10 @@ impl Host {
if done > 0 {
text.push_str(&in_flight(history, &markers, done as usize));
}
#[cfg(feature = "diagnostics")]
if let Some(indirects) = indirects {
text.push_str(&indirects_around(history, done as usize, &indirects));
}
// (Without markers a list that stopped midway says what
// it may have been at only by what it binds.)
if (done == 0 || markers.is_empty())
@@ -5498,6 +5529,8 @@ impl HostList {
self.twins.lock().unwrap_or_else(|e| e.into_inner()).clear();
self.pipelines.lock().unwrap_or_else(|e| e.into_inner()).clear();
#[cfg(feature = "diagnostics")]
self.indirects.lock().unwrap_or_else(|e| e.into_inner()).clear();
#[cfg(feature = "diagnostics")]
self.notes.lock().unwrap_or_else(|e| e.into_inner()).clear();
{
let mut scratch = self.scratch.lock().unwrap_or_else(|e| e.into_inner());
@@ -5904,6 +5937,15 @@ impl HostList {
&& self.twins.lock().unwrap_or_else(|e| e.into_inner()).is_empty()
}
/// Notes an indirect execution, while device-removed data is kept
/// ([`indirects`]).
#[cfg(feature = "diagnostics")]
pub(crate) fn ran_indirect(&self, pipeline: usize, name: &str, kind: u32, count: u32, user: &[u32]) {
if dred_on() || dred_light() {
self.indirects.lock().unwrap_or_else(|e| e.into_inner()).note(pipeline, name, kind, count, user);
}
}
/// Notes a pipeline the list binds.
pub(crate) fn used_pipeline(&self, name: &str) {
let mut pipelines = self.pipelines.lock().unwrap_or_else(|e| e.into_inner());
@@ -6025,6 +6067,15 @@ impl HostList {
Some((unsafe { buffer.GetGPUVirtualAddress() } + at, data))
}
/// [`HostList::scratch`] and the buffer it lies in, for a descriptor
/// slot to hold: the slot outlives the list's use of it.
pub(crate) fn scratch_held(&self, len: u64) -> Option<(ID3D12Resource, u64, *mut u8)> {
let (buffer, at, data) = self.scratch_at(len)?;
// SAFETY: a live buffer.
let gpu = unsafe { buffer.GetGPUVirtualAddress() } + at;
Some((buffer, gpu, data))
}
/// [`HostList::scratch`]: the buffer, the offset in it and the CPU
/// pointer.
fn scratch_at(&self, len: u64) -> Option<(ID3D12Resource, u64, *mut u8)> {
@@ -7977,6 +8028,34 @@ fn fault_in(va: u64, (start, bytes): (u64, u64)) -> String {
/// barriers overlaps on the GPU), by kind, and what the markers just
/// before them say (`HostList::note_op`: diagnostics builds with
/// device-removed data on).
/// For a list that stopped at command `done`: what the indirect executions
/// there ran, from the one before it to the next barrier (four at most), and
/// what the heap slots their user data names hold now.
#[cfg(feature = "diagnostics")]
fn indirects_around(history: &[D3D12_AUTO_BREADCRUMB_OP], done: usize, all: &indirects::Shared) -> String {
let indirect = |op: &D3D12_AUTO_BREADCRUMB_OP| *op == D3D12_AUTO_BREADCRUMB_OP_EXECUTEINDIRECT;
let all = all.lock().unwrap_or_else(|e| e.into_inner());
let mut text = String::new();
let mut shown = 0;
for (at, op) in history.iter().enumerate().skip(done.saturating_sub(1)) {
if shown == 4 || (at > done && *op == D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER) {
break;
}
if !indirect(op) {
continue;
}
shown += 1;
let Some((what, words)) = all.nth(indirects::before(history, at, indirect)) else {
continue;
};
text.push_str(&format!("; command {at} ran {what}"));
for (word, slot, what) in crate::descriptor::host::describe_slots(words) {
text.push_str(&format!(", word {word} slot {slot}: {what}"));
}
}
text
}
fn in_flight(history: &[D3D12_AUTO_BREADCRUMB_OP], markers: &[(u32, String)], done: usize) -> String {
let barrier = |op: &D3D12_AUTO_BREADCRUMB_OP| *op == D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER;
let from = history[..done].iter().rposition(barrier).map_or(0, |b| b + 1);