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

+35 -5
View File
@@ -866,6 +866,20 @@ fn view_home(
crate::shadow::exact(start, len).unwrap_or(shadow)
}
/// For device-removed reports: what the slots of the title's view heap that
/// the words of user data may name hold now ([`crate::host::indirects`]).
#[cfg(feature = "diagnostics")]
pub(crate) fn describe_slots(words: &[u32]) -> Vec<(usize, u32, String)> {
super::with_view_heap(|host| {
crate::host::indirects::slots(words, host.count, 6)
.into_iter()
.take(24)
.map(|(word, slot)| (word, slot, host.describe_slot(slot).unwrap_or_default()))
.collect()
})
.unwrap_or_default()
}
/// Host heaps' GPU ranges (start, bytes, bytes per slot, sampler), for
/// device-removed reports: a shader indexing a heap past its end faults.
static GPU_RANGES: Mutex<Vec<(u64, u64, u64, bool)>> = Mutex::new(Vec::new());
@@ -1859,6 +1873,11 @@ impl HostHeap {
fn keep(&self, index: u32, resource: Option<ID3D12Resource>) {
let mut kept = self.kept.lock().unwrap_or_else(|e| e.into_inner());
if let Some(slot) = kept.get_mut(index as usize) {
use windows::core::Interface;
// The same again: nothing to retire.
if slot.as_ref().map(Interface::as_raw) == resource.as_ref().map(Interface::as_raw) {
return;
}
// A running submission may still read the old resource through
// this slot.
if let Some(old) = std::mem::replace(slot, resource) {
@@ -1937,7 +1956,6 @@ impl HostHeap {
/// Makes slot `index` (a dynamic one) a raw unordered access view of
/// nothing: reads give zeros, writes are dropped.
pub(crate) fn null_raw_uav_at(&self, index: u32) {
self.keep(index, None);
let Some(host) = host() else { return };
let desc = D3D12_UNORDERED_ACCESS_VIEW_DESC {
Format: DXGI_FORMAT_R32_TYPELESS,
@@ -1959,6 +1977,7 @@ impl HostHeap {
self.cpu(index),
)
};
self.keep(index, None);
}
/// The shader-visible handle of slot `index`.
@@ -1971,9 +1990,17 @@ impl HostHeap {
}
/// Makes slot `index` (a dynamic one) a constant buffer view of host
/// memory (the list's own, which it holds).
pub(crate) fn constant_at(&self, index: u32, gpu: u64, size: u32) {
self.keep(index, None);
/// memory, `size` bytes at `gpu` of `buffer`, which the slot holds.
///
/// The list holds it too, until it is reset; the slot shows it until it
/// is made again, and a shader that picks the slot by an index it
/// computes from wrong data reads it through there. The list's scratch
/// chunks go back to the pool and are freed past its limit: session n02
/// lost the device to a page fault in the memory of three freed ones.
/// `VICTORY_SLOT_HOLDS=0`: only the list holds it, as before.
pub(crate) fn constant_at(&self, index: u32, buffer: &ID3D12Resource, gpu: u64, size: u32) {
static HOLDS: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
let holds = *HOLDS.get_or_init(|| std::env::var_os("VICTORY_SLOT_HOLDS").is_none_or(|v| v != "0"));
let Some(host) = host() else { return };
let desc = D3D12_CONSTANT_BUFFER_VIEW_DESC {
BufferLocation: gpu,
@@ -1984,6 +2011,9 @@ impl HostHeap {
host.device
.CreateConstantBufferView(Some(&desc), self.cpu(index))
};
// After the descriptor: what it showed is let go when nothing shows
// it any more.
self.keep(index, holds.then(|| buffer.clone()));
}
fn cpu(&self, index: u32) -> D3D12_CPU_DESCRIPTOR_HANDLE {
@@ -3297,7 +3327,7 @@ mod tests {
assert!(alive(), "a view of {size} bytes");
}
// SAFETY: a live upload buffer.
heap.constant_at(1, unsafe { buffer.GetGPUVirtualAddress() }, 969_472);
heap.constant_at(1, &buffer, unsafe { buffer.GetGPUVirtualAddress() }, 969_472);
assert!(alive(), "a view of the list's own memory");
assert_eq!(constant_bytes(480), 512);
assert_eq!(constant_bytes(64 << 10), 64 << 10);