rt tests: the pending-upload test counts the allocations in use in the pool, not from the gauges

every_device_bounds_the_pending_upload failed now and then on the Iris (ms01 jobs 44922 and
44970; passed in 44962): "copy 0: 4 allocations live, at most 3 expected". Its count of the
allocations in use was the Blocks gauge less the idle gauges' allocations. The Blocks gauge
rises in allocate() before vkAllocateMemory, and the allocation joins the pool (and the idle
gauge) only once make_allocation returns; and it falls in free_allocation after vkFreeMemory,
where the idle rule took the allocation out of the pool (and the idle gauge) before. So while
the block-maker thread makes or frees an idle allocation, that count is one more than the
allocations with a block in use.

The test now counts the allocations with a block in use where the pool keeps them
(Pool::in_use, test-only), which neither window touches. The bound itself is unchanged.
This commit is contained in:
Anees Iqbal committed 2026-11-18 01:04:47 -08:00
1 parent 366ff410a3
commit 871c54fc5f
2 files changed
+16 -6

No files matched your search

+12
View File
@@ -566,6 +566,18 @@ impl Pool {
self.lock().free(class) >= MAKE_BELOW
}
/// For the device tests: the allocations of both classes with a block in use, counted where
/// the pool keeps them. An allocation the block-maker thread is making or freeing is not
/// among them, where the `Blocks` gauge counts it: the gauge rises before the allocation joins
/// the pool and falls after it left.
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
pub(crate) fn in_use(&self) -> usize {
let state = self.lock();
(state.allocations.iter().flatten())
.filter(|allocation| allocation.live > 0)
.count()
}
/// For the device tests: the class's blocks given back and kept.
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
pub(crate) fn kept(&self, class: MemoryClass) -> usize {
+4 -6
View File
@@ -80,12 +80,10 @@ mod on_device {
});
// The allocations in use: the idle ones are the pool's, kept for its window. A texture
// made while earlier ones are still being freed can take a second texture block, which
// goes back to the pool once empty and stays there idle.
let in_use = || {
let gauges = counters.gauges();
let idle = gauges.private_idle_bytes + gauges.shared_idle_bytes;
gauges.blocks - idle / MemoryClass::Private.block_len()
};
// goes back to the pool once empty and stays there idle. Counted in the pool, not from
// the gauges, which also count an allocation the block-maker thread is making or
// freeing at the time.
let in_use = || core.pool.in_use() as u64;
let base = in_use();
// Textures made and released: nothing holds them, and nothing is submitted.