Carry tests: the lost generation's blocks, not bytes allocated; the lane test lets go of its raw handles

The rest probe (m3-max-11599, a print of the rest check's inputs, never
landed) showed every lost generation coming to rest in both failing tests,
and releasing its carried parts. Both failures were in the tests.

- WorkCounts::device_memory_allocated counts bytes allocated so far, freed
  since or not, so it never falls. The carry test now checks the lost
  generation's live blocks (with a placement, or kept empty). The probe
  showed 2 before the loss and 1 at rest. The test also requires that the
  rest freed some (memory_frees.teardown).
- The lane test's device was made through creation_checked, whose
  creation_kinds reads the driver's pipeline cache through Device::raw. Those
  handles keep the first generation's VkDevice until a later raw() call, as
  the neighbouring test there says. The test now makes that call before it
  waits for one live VkDevice.

(cherry picked from commit 44a5fc55c935bf8c000884487f3561c5551e6734)
This commit is contained in:
Anees Iqbal committed 2026-11-09 04:26:06 -08:00
1 parent 3e14cb62dc
commit ec101631cf
2 files changed
+20 -13

No files matched your search

@@ -213,22 +213,24 @@ fn a_recovery_carries_events_private_and_fresh_page_buffers() {
// It holds the lost `VkDevice`, which keeps no memory for work.
assert_eq!(live_vk_devices(&device, 2), 2);
let after = pooled.device().work_counts_now();
let blocks =
|counts: &crate::WorkCounts| counts.memory_blocks_live + counts.empty_memory_blocks_live;
eprintln!(
"CARRY-LOST-MEMORY: {}: the lost generation held {} blocks before the loss, {} at rest, \
{} freed as it came to rest",
device.name(),
blocks(&before),
blocks(&after),
after.memory_frees.teardown - before.memory_frees.teardown
);
assert_eq!(after.empty_memory_blocks_live, 0, "{after:?}");
assert!(
after.device_memory_allocated + REUSED <= before.device_memory_allocated,
"the lost generation holds {} bytes, {} before the loss",
after.device_memory_allocated,
before.device_memory_allocated
);
eprintln!(
"CARRY-LOST-MEMORY: {}: the lost generation held {} bytes in {} blocks before the loss, \
{} in {} at rest",
device.name(),
before.device_memory_allocated,
before.memory_blocks_live,
after.device_memory_allocated,
after.memory_blocks_live
blocks(&after) < blocks(&before),
"the lost generation holds {} blocks, {} before the loss",
blocks(&after),
blocks(&before)
);
assert!(after.memory_frees.teardown > before.memory_frees.teardown);
drop(pooled);
assert_eq!(live_vk_devices(&device, 1), 1);
}
@@ -329,6 +329,11 @@ fn carried_objects_serve_on_the_new_vk_device() {
let bytes = unsafe { std::slice::from_raw_parts(contents.as_ptr(), 4096) };
assert!(bytes.iter().all(|&byte| byte == round));
}
// The handles `Device::raw` answered as the lane checked the device's making
// (`creation_kinds` reads the driver's pipeline cache through them) keep the first
// generation's `VkDevice` until a later call answers the serving one's.
// SAFETY: the handles are read and not used.
let _ = unsafe { device.raw() };
let began = Instant::now();
while device.work_counts().vk_devices_live > 1 && began.elapsed() < Duration::from_secs(60)
{