From 7675ea39fcf5bf1fb33f59fc824188f92070ccce Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 9 Nov 2026 17:51:33 -0800 Subject: [PATCH] Reclaim bench: each pool's blocks kept ahead at a phase's end, and whether it grows The phase report names the pools that keep blocks made ahead at its end, with their bytes and whether each grows or is near its next block (Memory::growing): which pool's reserve the sweep frees unused in the next phase. On the Radeon 780M's small-blocks arms (job 12627, 16 MiB blocks): at each quiet phase's end the textures' pool (Images, 2) keeps 48 MiB ahead and grows, and the host copies' pool (Images, 5) 64 MiB and does not; the three blocks (48 MiB) freed unused in each pressed phase are (Images, 2)'s. (cherry picked from commit a0f47d9827798373e2f8bb2a213a9a3dc19ee340) --- .../src/tests/reclaim_submit_bench.rs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs b/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs index a3a33ed65..0c984f0ad 100644 --- a/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs +++ b/crates/metal2vulkan-runtime/src/tests/reclaim_submit_bench.rs @@ -632,11 +632,19 @@ fn phase( memory.turnover_bytes(), ) }; - let placements: Vec = (crate::device::lock(&device.shared().memory) - .image_placements - .iter()) - .map(|(&(bytes, align), count)| format!("{count} of {bytes} bytes at {align}")) - .collect(); + let (placements, ahead) = { + let mut memory = crate::device::lock(&device.shared().memory); + let placements: Vec = (memory.image_placements.iter()) + .map(|(&(bytes, align), count)| format!("{count} of {bytes} bytes at {align}")) + .collect(); + let ahead: Vec = (memory.ahead_by_pool().into_iter()) + .map(|(pool, bytes)| { + let grows = memory.grows(pool); + format!("{pool:?} {} MiB, grows {grows}", bytes >> 20) + }) + .collect(); + (placements, ahead) + }; let over = |times: &[(Duration, f64)], bound: f64| { (times.iter()) .filter(|&&(took, _)| took.as_secs_f64() * 1e3 >= bound) @@ -709,8 +717,10 @@ fn phase( frees.kept_for_room - earlier_frees.kept_for_room, ); eprintln!( - "RECLAIM-SUBMIT {arm}, {name}: images placed by bytes and alignment [{}]", - placements.join(", ") + "RECLAIM-SUBMIT {arm}, {name}: images placed by bytes and alignment [{}]; kept ahead at \ + the phase's end by pool [{}]", + placements.join(", "), + ahead.join(", ") ); eprintln!("RECLAIM-SUBMIT {arm}, {name}: slowest submissions {slow}"); eprintln!("RECLAIM-SUBMIT {arm}, {name}: slowest turnarounds {slow_turns}");