From 73d706151e9682dbffc6c38795ac77475ed91317 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 11 Nov 2026 20:01:00 -0800 Subject: [PATCH] host_ab: hold a call's driver makings as its own thread's, with blocks it waited for The per-call gate failed on the M3 Max once (buffer_texture_256: 0.0625 memory allocations a call, held to 0). The allocation was a 64 MiB block of the images' pool made ahead on the device's ready thread: texture_1024_target's first creation call found its pool short (room 62.9 MB of a 64 MiB block, the pool grown 1.1 s before) and asked for one; its making waited for a pause in the queue uses (up to 50 ms) and landed in the next group's windows. No call waited for it. The process-wide counts the gate read took it whenever it fell inside an at-call window, so the row failed by timing alone. ObjectChurn now also counts each driver making for the thread that made it, and a pooled block made ahead for the thread of the call that waited for it (the ready thread records what the block's making made; add_ready counts it on the taking thread where the making was waited for). host_ab reads these and HELD holds the `_this_thread` at-call counts; the process counts stay printed. Tests: churn_counts::a_thread_s_makings_are_its_own_and_those_it_waited_for (unit); blocks_ahead's growth test checks the blocks made ahead are not the calling thread's, and the hurried test that the call that waited for its block counts the block's memory as its own. --- .../examples/host_ab/percall.rs | 121 ++++++++++++++---- .../examples/host_ab/runtime.rs | 24 ++++ .../metal2vulkan-runtime/src/churn_counts.rs | 104 ++++++++++++++- crates/metal2vulkan-runtime/src/memory.rs | 5 + .../metal2vulkan-runtime/src/memory/ready.rs | 8 ++ .../src/tests/blocks_ahead.rs | 32 ++++- crates/metal2vulkan/tests/api_signatures.tsv | 6 + 7 files changed, 267 insertions(+), 33 deletions(-) diff --git a/crates/metal2vulkan-runtime/examples/host_ab/percall.rs b/crates/metal2vulkan-runtime/examples/host_ab/percall.rs index 01e77fea3..a5a4c7fa7 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/percall.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/percall.rs @@ -406,14 +406,25 @@ pub fn group( /// its image is linear because the device's optimal image takes none of the heap's memory types; /// on macOS the first lock of each of its mutexes allocates too (std's). A path that inherently /// makes more of a count is held to its own measure there ([`HELD_ON_PATH`]). +/// +/// A driver making (`rt_vk__this_thread`) is held as the calling thread's: what the call +/// made, and a block of the runtime's memory pool it waited for, which the pool's thread made +/// (`ObjectChurn`'s `_this_thread` counts). A block that thread makes ahead while no call waits +/// for it is no call's making: it waits for a pause in the device's queue uses, at most 50 ms +/// (`memory/ready.rs`), and lands in whichever group's window runs then, where the process's +/// count (`rt_vk_`) shows it. const HELD: [(&str, &str, f64); 47] = [ // A draw records exactly one draw command, at the call, and makes no driver object: the cost // it pays there is planning and recording, which is settled work and nothing a driver // charges for. ("draw_strip", "rt_draws_at_call", 1.0), - ("draw_strip", "rt_vk_images_made_at_call", 0.0), - ("draw_strip", "rt_vk_buffers_made_at_call", 0.0), - ("draw_strip", "rt_vk_memory_allocations_at_call", 0.0), + ("draw_strip", "rt_vk_images_made_this_thread_at_call", 0.0), + ("draw_strip", "rt_vk_buffers_made_this_thread_at_call", 0.0), + ( + "draw_strip", + "rt_vk_memory_allocations_this_thread_at_call", + 0.0, + ), ("draw_triangles", "rt_draws_at_call", 1.0), ("draw_indexed", "rt_recorded_cmd_draw_indexed_at_call", 1.0), // And it allocates about once in twenty draws (0.049 measured), nothing a draw of its own. @@ -428,7 +439,7 @@ const HELD: [(&str, &str, f64); 47] = [ // Ending the encoding begins its render pass once, at the call, and makes no driver object. // Its 24 allocations are the largest counted quantity on the path. ("end_render", "rt_render_passes_begun_at_call", 1.0), - ("end_render", "rt_vk_images_made_at_call", 0.0), + ("end_render", "rt_vk_images_made_this_thread_at_call", 0.0), ("end_render", "allocs", 24.0), ("end_compute", "allocs", 7.0), ("end_blit", "allocs", 7.0), @@ -438,18 +449,38 @@ const HELD: [(&str, &str, f64); 47] = [ ("dispatch", "allocs", 6.2), // A heap texture's image takes its storage from the heap: one image and one binding, and no // allocation of memory of its own. - ("heap_texture_256", "rt_vk_images_made_at_call", 1.0), - ("heap_texture_256", "rt_vk_image_bindings_at_call", 1.0), - ("heap_texture_256", "rt_vk_memory_allocations_at_call", 0.0), + ( + "heap_texture_256", + "rt_vk_images_made_this_thread_at_call", + 1.0, + ), + ( + "heap_texture_256", + "rt_vk_image_bindings_this_thread_at_call", + 1.0, + ), + ( + "heap_texture_256", + "rt_vk_memory_allocations_this_thread_at_call", + 0.0, + ), ("heap_texture_256", "allocs", 17.25), // A Shared texture likewise, and it starts its image on the host once; or it takes one parked // image, made and bound before, where the device stages its copies. - ("texture_256_shared", "rt_vk_images_made_at_call", 1.0), - ("texture_256_shared", "rt_images_recycled_at_call", 1.0), - ("texture_256_shared", "rt_vk_image_bindings_at_call", 1.0), ( "texture_256_shared", - "rt_vk_memory_allocations_at_call", + "rt_vk_images_made_this_thread_at_call", + 1.0, + ), + ("texture_256_shared", "rt_images_recycled_at_call", 1.0), + ( + "texture_256_shared", + "rt_vk_image_bindings_this_thread_at_call", + 1.0, + ), + ( + "texture_256_shared", + "rt_vk_memory_allocations_this_thread_at_call", 0.0, ), ( @@ -461,35 +492,75 @@ const HELD: [(&str, &str, f64); 47] = [ // A render target of a shape the runtime has seen takes a parked image: it makes no image at // all, which is why it costs what Metal's does. Losing the recycler here would cost 20 us a // call and this row is what would say so. - ("texture_1024_target", "rt_vk_images_made_at_call", 0.0), ( "texture_1024_target", - "rt_vk_memory_allocations_at_call", + "rt_vk_images_made_this_thread_at_call", + 0.0, + ), + ( + "texture_1024_target", + "rt_vk_memory_allocations_this_thread_at_call", 0.0, ), // A texture over a buffer's bytes makes its image at the call, bound in the buffer's memory: // one image and one binding, no memory of its own, and no view at the call. - ("buffer_texture_256", "rt_vk_images_made_at_call", 1.0), - ("buffer_texture_256", "rt_vk_image_bindings_at_call", 1.0), ( "buffer_texture_256", - "rt_vk_memory_allocations_at_call", + "rt_vk_images_made_this_thread_at_call", + 1.0, + ), + ( + "buffer_texture_256", + "rt_vk_image_bindings_this_thread_at_call", + 1.0, + ), + ( + "buffer_texture_256", + "rt_vk_memory_allocations_this_thread_at_call", + 0.0, + ), + ( + "buffer_texture_256", + "rt_vk_image_views_made_this_thread_at_call", 0.0, ), - ("buffer_texture_256", "rt_vk_image_views_made_at_call", 0.0), // A buffer comes out of the runtime's memory pool: no `vkCreateBuffer`, no `vkAllocateMemory`. - ("buffer_4k", "rt_vk_buffers_made_at_call", 0.0), - ("buffer_4k", "rt_vk_memory_allocations_at_call", 0.0), - ("buffer_1m", "rt_vk_buffers_made_at_call", 0.0), - ("buffer_1m", "rt_vk_memory_allocations_at_call", 0.0), + ("buffer_4k", "rt_vk_buffers_made_this_thread_at_call", 0.0), + ( + "buffer_4k", + "rt_vk_memory_allocations_this_thread_at_call", + 0.0, + ), + ("buffer_1m", "rt_vk_buffers_made_this_thread_at_call", 0.0), + ( + "buffer_1m", + "rt_vk_memory_allocations_this_thread_at_call", + 0.0, + ), // A no-copy buffer imports its pages once: one buffer, one import, one binding. A walk of the // memory types that tried several would read as more than one allocation here. - ("buffer_no_copy_1m", "rt_vk_buffers_made_at_call", 1.0), - ("buffer_no_copy_1m", "rt_vk_memory_allocations_at_call", 1.0), - ("buffer_no_copy_1m", "rt_vk_buffer_bindings_at_call", 1.0), + ( + "buffer_no_copy_1m", + "rt_vk_buffers_made_this_thread_at_call", + 1.0, + ), + ( + "buffer_no_copy_1m", + "rt_vk_memory_allocations_this_thread_at_call", + 1.0, + ), + ( + "buffer_no_copy_1m", + "rt_vk_buffer_bindings_this_thread_at_call", + 1.0, + ), // Residency is our own bookkeeping: no driver call, and no allocation a resource (16 for 256 // of them). - ("use_resources_read_256", "rt_vk_buffers_made_at_call", 0.0), + ( + "use_resources_read_256", + "rt_vk_buffers_made_this_thread_at_call", + 0.0, + ), ("use_resources_read_256", "allocs", 16.0), // One Metal command buffer carrying one dispatch is submitted as two of Vulkan's. ( diff --git a/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs b/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs index df295e66b..84f32665d 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs @@ -2144,6 +2144,30 @@ impl Gpu for Runtime { ), ("vk_image_bindings", c.object_churn.vk_image_bindings), ("vk_buffer_bindings", c.object_churn.vk_buffer_bindings), + ( + "vk_images_made_this_thread", + c.object_churn.vk_images_made_this_thread, + ), + ( + "vk_buffers_made_this_thread", + c.object_churn.vk_buffers_made_this_thread, + ), + ( + "vk_image_views_made_this_thread", + c.object_churn.vk_image_views_made_this_thread, + ), + ( + "vk_memory_allocations_this_thread", + c.object_churn.vk_memory_allocations_this_thread, + ), + ( + "vk_image_bindings_this_thread", + c.object_churn.vk_image_bindings_this_thread, + ), + ( + "vk_buffer_bindings_this_thread", + c.object_churn.vk_buffer_bindings_this_thread, + ), ("churn_images_in_buffers", c.object_churn.images_in_buffers), ("churn_images_in_heaps", c.object_churn.images_in_heaps), ("churn_images_other", c.object_churn.images_other), diff --git a/crates/metal2vulkan-runtime/src/churn_counts.rs b/crates/metal2vulkan-runtime/src/churn_counts.rs index 571ae5da2..49f9be469 100644 --- a/crates/metal2vulkan-runtime/src/churn_counts.rs +++ b/crates/metal2vulkan-runtime/src/churn_counts.rs @@ -15,13 +15,19 @@ //! `vkBindBufferMemory` calls of the whole process, by entry point and by the place in the //! runtime that asked for one (`creation.rs`, their one door). What a texture or buffer //! creation made the driver do is then a count of that call's own work, not an inference from a -//! driver floor timed apart, and a count holds under any load where a time does not. +//! driver floor timed apart, and a count holds under any load where a time does not. Each is +//! also counted for the thread that made it, and a pooled block made ahead for the thread of +//! the call that waited for it, where one did (`ObjectChurn`'s `_this_thread` counts): the +//! device's thread that makes blocks ahead (`memory/ready.rs`) makes them when the device's +//! queue uses pause, so the process's counts over a call take whatever such making fell +//! within it. //! - **Shadow keeps.** The keeps of merged-back shadows (`shadow_merge.rs`) by the encoder that //! planned them (a render pass's attachments, a compute dispatch's bindings, a blit), cut to a //! rectangle or of every texel, and the texels they copy. use crate::step_aside::counted_apart; use crate::work_counts::{CopySite, CopySites, COPY_SITES}; +use std::cell::Cell; use std::panic::Location; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::LazyLock; @@ -85,6 +91,12 @@ pub(crate) fn vk_released(what: VkRelease, at: &Location<'static>) { RELEASE_SITES.count(command, at, 0); } +thread_local! { + /// Of [`VK_MAKINGS`], those this thread made, and those another thread made for a call of + /// this thread that waited for them ([`count_on_this_thread`]). + static THIS_THREAD: [Cell; 6] = const { [const { Cell::new(0) }; 6] }; +} + /// A making of `what` (`creation.rs`), called `at`: a check's where a device's check made it /// ([`CHECK_MAKINGS`]). pub(crate) fn vk_made(what: VkMaking, at: &Location<'static>) { @@ -93,9 +105,28 @@ pub(crate) fn vk_made(what: VkMaking, at: &Location<'static>) { return; } VK_MAKINGS[what as usize].fetch_add(1, Ordering::Relaxed); + THIS_THREAD.with(|counts| { + let count = &counts[what as usize]; + count.set(count.get() + 1); + }); MAKING_SITES.count(what.command(), at, 0); } +/// This thread's makings so far, by [`VkMaking`] ([`THIS_THREAD`]). +pub(crate) fn this_thread_makings() -> [u64; 6] { + THIS_THREAD.with(|counts| counts.each_ref().map(Cell::get)) +} + +/// Count `makings` (by [`VkMaking`]), which another thread made while a call of this one waited +/// for them (a pooled block made ahead, `memory/ready.rs`), as this thread's. +pub(crate) fn count_on_this_thread(makings: [u64; 6]) { + THIS_THREAD.with(|counts| { + for (count, made) in counts.iter().zip(makings) { + count.set(count.get() + made); + } + }); +} + /// The process's devices' checks' makings of `what` so far. pub(crate) fn checks_made(what: VkMaking) -> u64 { CHECK_MAKINGS[what as usize].load(Ordering::Relaxed) @@ -233,6 +264,8 @@ impl ChurnCounters { let owned = |o: Owned| self.owned[o as usize].load(Ordering::Relaxed); let vk = |r: VkRelease| VK_RELEASES[r as usize].load(Ordering::Relaxed); let made = |m: VkMaking| VK_MAKINGS[m as usize].load(Ordering::Relaxed); + let this_thread = this_thread_makings(); + let mine = |m: VkMaking| this_thread[m as usize]; let keep = |by: KeepBy, at: usize| self.keeps[by as usize][at].load(Ordering::Relaxed); let recycled = |what: Recycled, at: usize| self.recycled[what as usize][at].load(Ordering::Relaxed); @@ -248,6 +281,12 @@ impl ChurnCounters { vk_memory_allocations: made(VkMaking::Memory), vk_image_bindings: made(VkMaking::ImageBinding), vk_buffer_bindings: made(VkMaking::BufferBinding), + vk_images_made_this_thread: mine(VkMaking::Image), + vk_buffers_made_this_thread: mine(VkMaking::Buffer), + vk_image_views_made_this_thread: mine(VkMaking::ImageView), + vk_memory_allocations_this_thread: mine(VkMaking::Memory), + vk_image_bindings_this_thread: mine(VkMaking::ImageBinding), + vk_buffer_bindings_this_thread: mine(VkMaking::BufferBinding), making_sites: MAKING_SITES.read(), making_sites_dropped: MAKING_SITES.dropped(), images_own_memory: owned(Owned::ImageOwnMemory), @@ -322,6 +361,24 @@ pub struct ObjectChurn { pub vk_image_bindings: u64, /// `vkBindBufferMemory` calls of the process. pub vk_buffer_bindings: u64, + /// Of `vk_images_made`, those of the thread that read these counts: its own calls', and + /// those another thread made while a call of it waited for them (a pooled block made ahead + /// that a creation call found none of and waited for, `memory/ready.rs`), counted on the + /// thread that took the block. What that thread's calls had the driver make, without what + /// the device's other threads made meanwhile, such as a block made ahead for a pool that + /// grew, which no call waited for. Each thread reads its own. + pub vk_images_made_this_thread: u64, + /// As `vk_images_made_this_thread`, of `vk_buffers_made` (a block of buffers made ahead + /// carries one where its buffers take device addresses). + pub vk_buffers_made_this_thread: u64, + /// As `vk_images_made_this_thread`, of `vk_image_views_made`. + pub vk_image_views_made_this_thread: u64, + /// As `vk_images_made_this_thread`, of `vk_memory_allocations` (a block made ahead is one). + pub vk_memory_allocations_this_thread: u64, + /// As `vk_images_made_this_thread`, of `vk_image_bindings`. + pub vk_image_bindings_this_thread: u64, + /// As `vk_images_made_this_thread`, of `vk_buffer_bindings`. + pub vk_buffer_bindings_this_thread: u64, /// The device's images that went, of memory of their own. pub images_own_memory: u64, /// Linear images in buffers' memory. @@ -484,4 +541,49 @@ mod tests { "the checks' counts took the device's work" ); } + + /// A thread's makings are counted for it alone: another thread's, such as a block the ready + /// thread makes ahead while a call runs, move the process's counts and not the call's + /// thread's; and a making counted on this thread for a call that waited for it moves this + /// thread's alone, the process having counted it where it was made. + #[test] + fn a_thread_s_makings_are_its_own_and_those_it_waited_for() { + let snapshot = || ChurnCounters::default().snapshot().0; + let process = |c: &ObjectChurn| c.vk_memory_allocations; + let mine = |c: &ObjectChurn| { + ( + c.vk_memory_allocations_this_thread, + c.vk_buffers_made_this_thread, + c.vk_buffer_bindings_this_thread, + ) + }; + let start = snapshot(); + std::thread::spawn(|| { + vk_made(VkMaking::Memory, Location::caller()); + vk_made(VkMaking::Buffer, Location::caller()); + }) + .join() + .unwrap(); + let other = snapshot(); + assert_eq!(process(&other), process(&start) + 1, "the process's count"); + assert_eq!(mine(&other), mine(&start), "another thread's making"); + + vk_made(VkMaking::Memory, Location::caller()); + let own = snapshot(); + assert_eq!(process(&own), process(&other) + 1); + assert_eq!(mine(&own).0, mine(&other).0 + 1, "this thread's making"); + + let mut waited = [0; 6]; + waited[VkMaking::Memory as usize] = 1; + waited[VkMaking::Buffer as usize] = 1; + waited[VkMaking::BufferBinding as usize] = 1; + count_on_this_thread(waited); + let after = snapshot(); + assert_eq!(process(&after), process(&own), "counted where it was made"); + assert_eq!( + mine(&after), + (mine(&own).0 + 1, mine(&own).1 + 1, mine(&own).2 + 1), + "a making a call of this thread waited for" + ); + } } diff --git a/crates/metal2vulkan-runtime/src/memory.rs b/crates/metal2vulkan-runtime/src/memory.rs index e89a5a012..3ab2421f9 100644 --- a/crates/metal2vulkan-runtime/src/memory.rs +++ b/crates/metal2vulkan-runtime/src/memory.rs @@ -3057,6 +3057,11 @@ impl Memory { let bytes = made.block.size; self.add_block(pool, made.block, bytes, false, 0); self.ahead.made_ahead(pool.0, made.waited_for, made.waited); + // A block a call waited for is that call's making, on its thread (`ObjectChurn`'s + // `_this_thread` counts); one made ahead of the call is the ready thread's alone. + if made.waited_for { + crate::churn_counts::count_on_this_thread(made.makings); + } #[cfg(test)] if made.waited_for { self.ahead.waited_making += made.making; diff --git a/crates/metal2vulkan-runtime/src/memory/ready.rs b/crates/metal2vulkan-runtime/src/memory/ready.rs index 64944f62a..a78a487c9 100644 --- a/crates/metal2vulkan-runtime/src/memory/ready.rs +++ b/crates/metal2vulkan-runtime/src/memory/ready.rs @@ -204,6 +204,11 @@ pub(super) struct Made { pub(super) waited: Option, /// A call waited for a block as it was made. pub(super) waited_for: bool, + /// What its making had the driver make, by `churn_counts::VkMaking` (its memory, and where + /// its buffers take device addresses a buffer of them and its binding): counted on the + /// thread of the call that waited for it, where one did (`ObjectChurn`'s `_this_thread` + /// counts). + pub(super) makings: [u64; 6], /// How long its making took once its wait for a burst's end was over (its allocation, and /// the reads of its pages until a call waited), for the crate's tests. #[cfg(test)] @@ -467,6 +472,7 @@ fn spawn( }; #[cfg(test)] let began = Instant::now(); + let before = crate::churn_counts::this_thread_makings(); let block = ready( &maker, &functions, @@ -475,6 +481,7 @@ fn spawn( (&shared.reading, &wanted), ); let waited_for = shared.waiting.load(Ordering::SeqCst) > 0; + let after = crate::churn_counts::this_thread_makings(); let mut state = lock(&shared.state); state.making = None; let Some(block) = block else { @@ -484,6 +491,7 @@ fn spawn( block, waited: waited.take(), waited_for, + makings: std::array::from_fn(|at| after[at] - before[at]), #[cfg(test)] making: began.elapsed(), }); diff --git a/crates/metal2vulkan-runtime/src/tests/blocks_ahead.rs b/crates/metal2vulkan-runtime/src/tests/blocks_ahead.rs index 2fc74244d..171e1b9a7 100644 --- a/crates/metal2vulkan-runtime/src/tests/blocks_ahead.rs +++ b/crates/metal2vulkan-runtime/src/tests/blocks_ahead.rs @@ -155,6 +155,16 @@ fn a_growing_pool_s_new_blocks_its_first_growth_s_among_them_are_made_ahead_and_ "only {ahead} of the blocks were made ahead" ); assert_eq!(waited_for, 0, "a call waited for a making that had ended"); + // The blocks made ahead are the ready thread's makings and no call's: the process's count of + // memory allocations has them, and this thread's, whose calls waited for none, does not. + let churn = (&counts.object_churn, &before.object_churn); + let process = churn.0.vk_memory_allocations - churn.1.vk_memory_allocations; + let mine = + churn.0.vk_memory_allocations_this_thread - churn.1.vk_memory_allocations_this_thread; + assert!( + process - mine >= ahead, + "of {process} allocations, {mine} this thread's: the {ahead} blocks made ahead among them" + ); } /// The pool of exportable buffers grows as the runtime's own pools do: once it grew, each new @@ -440,19 +450,21 @@ fn a_creation_that_needs_a_block_whose_making_waits_for_quiet_waits_for_its_allo .ahead_blocks() .waited_making }; - // A creation call: its time, and the time of the makings it waited for (their own work, once - // their waits for quiet were over). + let mine = || (device.work_counts().object_churn).vk_memory_allocations_this_thread; + // A creation call: its time, the time of the makings it waited for (their own work, once + // their waits for quiet were over), and the memory allocations counted as this thread's. let new_buffer = |held: &mut Vec| { assert!( held.len() < MOST, "the pool never needed its block made ahead" ); - let making = waited_making(); + let (making, allocated) = (waited_making(), mine()); let made = Instant::now(); let buffer = device.new_buffer(BUFFER_BYTES, ResourceOptions::private()); let took = made.elapsed(); held.push(buffer.unwrap()); - (took, waited_making().saturating_sub(making)) + let making = waited_making().saturating_sub(making); + (took, making, mine() - allocated) }; // The buffers' pool's first growth, made for the creation call that needs it; the next // creation starts its next block's making, which waits for a pause the held use never leaves. @@ -486,9 +498,9 @@ fn a_creation_that_needs_a_block_whose_making_waits_for_quiet_waits_for_its_allo if hurries(&counts) > 0 || past(&counts) > attempt { break; } - let (took, making) = new_buffer(&mut held); + let (took, making, allocated) = new_buffer(&mut held); match hurries(&device.work_counts()) > hurries(&counts) { - true => hurrying = Some((took, making)), + true => hurrying = Some((took, making, allocated)), false => longest = longest.max(took), } } @@ -496,7 +508,7 @@ fn a_creation_that_needs_a_block_whose_making_waits_for_quiet_waits_for_its_allo let after = device.work_counts(); drop(in_use); let hurried = after.blocks_ahead_hurried - before.blocks_ahead_hurried; - let (hurrying, making) = hurrying.unwrap_or_default(); + let (hurrying, making, allocated) = hurrying.unwrap_or_default(); let beside = hurrying.saturating_sub(making); println!( "BLOCKS-AHEAD {}: with a use of the queues held open, the creation call that hurried a \ @@ -510,6 +522,12 @@ fn a_creation_that_needs_a_block_whose_making_waits_for_quiet_waits_for_its_allo after.buffer_blocks_made_in_place - before.buffer_blocks_made_in_place, ); assert_eq!(hurried, 1, "no making a call waited for was cut short"); + // The block the call waited for is its making, made on the ready thread: its memory counted + // as this thread's (`ObjectChurn`'s `_this_thread` counts). + assert!( + allocated >= 1, + "the creation call that waited for its block counted none of the block's memory as its own" + ); assert!( beside < QUIET_MOST / 2, "the creation call that hurried a making waited {beside:?} beside the making's own \ diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 4a697b5a0..c6d8cdb00 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -2308,14 +2308,20 @@ field metal2vulkan-runtime::ObjectChurn.textures_in_heaps pub textures_in_heaps: field metal2vulkan-runtime::ObjectChurn.textures_shadow pub textures_shadow: u64 field metal2vulkan-runtime::ObjectChurn.textures_texels pub textures_texels: u64 field metal2vulkan-runtime::ObjectChurn.vk_buffer_bindings pub vk_buffer_bindings: u64 +field metal2vulkan-runtime::ObjectChurn.vk_buffer_bindings_this_thread pub vk_buffer_bindings_this_thread: u64 field metal2vulkan-runtime::ObjectChurn.vk_buffer_views_destroyed pub vk_buffer_views_destroyed: u64 field metal2vulkan-runtime::ObjectChurn.vk_buffers_destroyed pub vk_buffers_destroyed: u64 field metal2vulkan-runtime::ObjectChurn.vk_buffers_made pub vk_buffers_made: u64 +field metal2vulkan-runtime::ObjectChurn.vk_buffers_made_this_thread pub vk_buffers_made_this_thread: u64 field metal2vulkan-runtime::ObjectChurn.vk_image_bindings pub vk_image_bindings: u64 +field metal2vulkan-runtime::ObjectChurn.vk_image_bindings_this_thread pub vk_image_bindings_this_thread: u64 field metal2vulkan-runtime::ObjectChurn.vk_image_views_made pub vk_image_views_made: u64 +field metal2vulkan-runtime::ObjectChurn.vk_image_views_made_this_thread pub vk_image_views_made_this_thread: u64 field metal2vulkan-runtime::ObjectChurn.vk_images_destroyed pub vk_images_destroyed: u64 field metal2vulkan-runtime::ObjectChurn.vk_images_made pub vk_images_made: u64 +field metal2vulkan-runtime::ObjectChurn.vk_images_made_this_thread pub vk_images_made_this_thread: u64 field metal2vulkan-runtime::ObjectChurn.vk_memory_allocations pub vk_memory_allocations: u64 +field metal2vulkan-runtime::ObjectChurn.vk_memory_allocations_this_thread pub vk_memory_allocations_this_thread: u64 field metal2vulkan-runtime::ObjectChurn.vk_memory_freed pub vk_memory_freed: u64 field metal2vulkan-runtime::Origin.x pub x: u64 field metal2vulkan-runtime::Origin.y pub y: u64