A book of who has and had the card's memory; a check of every view slot

With device-removed data on, every buffer, texture and texture block stands in
a book with its address (a texture's is the base in its first descriptor) and
stays with the time it went. A device loss prints who has and had the faulting
address, newest first, and every slot of the view heap whose descriptor
reaches it, with what our books say of the slot. VICTORY_BOOK=0: not kept.

VICTORY_SLOT_CHECK=1 walks the view heap (2^22 slots, 3.8 s a round) and says
which slots name memory that is gone. Run crash-5 (opening, -Walk, 260 s): 1.7
million descriptors a round, 105,352 things alive, 27,342 gone, none of the
slots named anything gone or unknown in any round.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 06:53:10 -06:00
1 parent 7d51f42418
commit a8943a8c86
6 files changed
+805 -1

No files matched your search

+40 -1
View File
@@ -269,6 +269,8 @@ fn sweep() {
{
return;
}
#[cfg(feature = "diagnostics")]
crate::book::check();
crate::pool::room(host().and_then(|h| h.video_memory()));
crate::pipeline::trim_library();
crate::shadow::let_go_idle();
@@ -619,10 +621,17 @@ pub(crate) fn fail(what: std::fmt::Arguments) -> ! {
}
}
static HOST: OnceLock<Option<Host>> = OnceLock::new();
/// The host GPU if it is made already.
#[cfg(feature = "diagnostics")]
pub(crate) fn made_host() -> Option<&'static Host> {
HOST.get()?.as_ref()
}
/// The host GPU, created on first use; `None` without one (a run then
/// behaves as before: nothing executes).
pub(crate) fn host() -> Option<&'static Host> {
static HOST: OnceLock<Option<Host>> = OnceLock::new();
HOST.get_or_init(|| match create() {
Ok(host) => Some(host),
Err(e) => {
@@ -1520,6 +1529,18 @@ fn timing() -> bool {
/// allocations a page fault hit (only with device-removed data on), or for
/// the frame recorder (`VICTORY_RECORD`).
pub(crate) fn name(object: &impl Interface, text: impl FnOnce() -> String) {
#[cfg(feature = "diagnostics")]
if crate::book::on()
&& let Ok(resource) = object.cast::<ID3D12Resource>()
{
let text = text();
crate::book::made(&resource, || text.clone());
return name_it(object, || text);
}
name_it(object, text);
}
fn name_it(object: &impl Interface, text: impl FnOnce() -> String) {
#[cfg(feature = "diagnostics")]
if crate::replay::record::on() {
let text = text();
@@ -5341,6 +5362,8 @@ impl Host {
}
text.push_str(&crate::shadow::near(va));
text.push_str(&crate::descriptor::host::near_heaps(va));
#[cfg(feature = "diagnostics")]
text.push_str(&crate::book::at_loss(va));
}
// The plain output: the extended one (with marker texts) came
// back without stopped lists on this host.
@@ -7586,6 +7609,12 @@ impl Host {
b.Map(0, None, Some(&mut data))
})
};
#[cfg(feature = "diagnostics")]
if made.is_ok()
&& let Some(b) = &buffer
{
crate::book::made(b, || "an upload buffer".into());
}
match made {
Ok(()) => Some((buffer?, data.cast())),
Err(e) => {
@@ -8281,6 +8310,12 @@ impl Host {
b.Map(0, None, Some(&mut data))
})
};
#[cfg(feature = "diagnostics")]
if made.is_ok()
&& let Some(b) = &buffer
{
crate::book::made(b, || "a shared buffer".into());
}
match made {
Ok(()) => Some((buffer?, data.cast())),
Err(e) => {
@@ -8406,6 +8441,10 @@ impl Host {
&mut buffer,
)
};
#[cfg(feature = "diagnostics")]
if let Some(b) = &buffer {
crate::book::made(b, || "an unordered access buffer".into());
}
match made {
Ok(()) => buffer,
Err(e) => {