From 7096fa7de3408355e35189ff7fe56e53d69f55a4 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 19 Nov 2026 23:41:25 -0800 Subject: [PATCH] rt counters: a take's allocation counted at its class's site, and the takes the units made ahead served The keep-or-go test for the block-maker thread's unit made ahead (a class's next 16 MiB allocation while it holds no wholly free one) reads reims's 3090 take table: 23 Shared growth pieces of 9 to 20 ms held no guest call, and two Private 16 MiB takes, of 5.6 and 7.6 ms, each held one. A walk with the unit made ahead must show those two saved. The counters could not say it: one take site counted both classes' allocations, with no size past the bytes in total, and nothing counted a take the unit made ahead served. Now: - the consumer's takes count at their class's site: Metrics::shared_take_allocations and private_take_allocations replace take_allocations (texture blocks, Private, keep theirs); - SiteAllocations::longest_bytes is the longest allocation's bytes, from the same call as longest_nanos; - SiteAllocations::takes_ahead and takes_ahead_bytes count, at the three sites of takes from the pool, the takes that landed in an allocation the block-maker thread made while the class held no wholly free unit, each the first take to land in it: no allocation made before it had room, so each is a take that would otherwise have allocated at the site on the consumer's thread. A class's first allocation, made in Device::new, is not one of them. An allocation the block-maker thread makes in run() is marked ahead until the first take lands in it (State::fit answers it and clears the mark); the take counts at its own site. Test: every_device_makes_a_class_s_next_allocation_once_it_holds_no_wholly_free_unit runs for both classes: a byte's take lands in the class's first allocation and counts nothing; once the next unit is made, the 16 MiB take counts one take landed ahead of 16 MiB at its class's site and no allocation. The sites test names the two take sites and compares allocations alone. README and the API signature table follow. Verified: see the check job named in the landing. --- crates/metal2vulkan-rt/README.md | 11 ++- crates/metal2vulkan-rt/src/counters.rs | 96 +++++++++++++++---- crates/metal2vulkan-rt/src/device.rs | 2 +- crates/metal2vulkan-rt/src/memory.rs | 24 ++++- crates/metal2vulkan-rt/src/tests/memory.rs | 97 ++++++++++++-------- crates/metal2vulkan-rt/src/tests/sites.rs | 35 ++++--- crates/metal2vulkan/tests/api_signatures.tsv | 6 +- 7 files changed, 196 insertions(+), 75 deletions(-) diff --git a/crates/metal2vulkan-rt/README.md b/crates/metal2vulkan-rt/README.md index ac67b2c31..2aee3769d 100644 --- a/crates/metal2vulkan-rt/README.md +++ b/crates/metal2vulkan-rt/README.md @@ -204,12 +204,15 @@ in its memory. pipeline's creation waited out the whole 3.4 ms of a 16 MiB Shared allocation made beside it. `Metrics::consumer_allocation_nanos` and `consumer_allocation_max_nanos` count the time of allocations made on the consumer's threads, and `maker_allocation_nanos` those of the - block-maker thread. Seven of the consumer's sites are - counted apart, each as a `SiteAllocations` (calls, bytes and the longest call): + block-maker thread. Eight of the consumer's sites are + counted apart, each as a `SiteAllocations` (calls, bytes, the longest call and its bytes): `texture_allocations` (a texture's allocation of its own), `texture_block_allocations`, `ring_block_allocations`, `staging_region_allocations`, `staging_buffer_allocations` (a copy - larger than the staging region), `zero_source_allocations` and `take_allocations` (a take that - no free range fits). A take's parts are timed apart, each as a `Timed` (calls, bytes, total + larger than the staging region), `zero_source_allocations`, and `shared_take_allocations` and + `private_take_allocations` (a take of each class that no free range fits). At the three sites + of takes from the pool, `SiteAllocations::takes_ahead` and `takes_ahead_bytes` count the takes + that landed instead in a unit the block-maker thread made ahead, each the first to land in it: + takes that would otherwise have allocated there. A take's parts are timed apart, each as a `Timed` (calls, bytes, total and longest time, the longest call's bytes and whether it made an allocation of its own, and the calls over 1, 5 and 20 ms): `Metrics::takes` (each take whole, a texture block's among them), `take_lock_waits` (its wait for the pool's lock), `take_makes` diff --git a/crates/metal2vulkan-rt/src/counters.rs b/crates/metal2vulkan-rt/src/counters.rs index a09e422df..de215f655 100644 --- a/crates/metal2vulkan-rt/src/counters.rs +++ b/crates/metal2vulkan-rt/src/counters.rs @@ -72,7 +72,8 @@ pub(crate) enum FirstUse { } /// A [`Part`]'s longest call: its nanoseconds, its bytes, and whether it made an allocation of -/// its own ([`Timed::longest_made`]). +/// its own ([`Timed::longest_made`]); a [`Site`]'s longest allocation, its nanoseconds and bytes +/// ([`SiteAllocations::longest_bytes`]). #[derive(Clone, Copy, Default)] struct Longest { nanos: u64, @@ -321,12 +322,24 @@ pub(crate) enum Site { StagingBuffer, /// [`Metrics::zero_source_allocations`]. ZeroSource, - /// [`Metrics::take_allocations`]. - Take, + /// [`Metrics::shared_take_allocations`]. + SharedTake, + /// [`Metrics::private_take_allocations`]. + PrivateTake, +} + +impl Site { + /// The site of the consumer's takes of `class` ([`Device::take_block`](crate::Device::take_block)). + pub(crate) fn take(class: crate::MemoryClass) -> Site { + match class { + crate::MemoryClass::Shared => Site::SharedTake, + crate::MemoryClass::Private => Site::PrivateTake, + } + } } /// The number of [`Site`]s. -const SITES: usize = Site::Take as usize + 1; +const SITES: usize = Site::PrivateTake as usize + 1; /// No Metal counterpart: a device's counters ([`Device::counters`](crate::Device::counters)). /// @@ -370,8 +383,10 @@ struct Atomics { consumer_allocation_max_nanos: AtomicU64, maker_allocation_nanos: AtomicU64, /// Each [`Site`]'s allocations, at its index: their count, their bytes and the longest's - /// nanoseconds. - sites: [[AtomicU64; 3]; SITES], + /// nanoseconds; then its takes that landed in an allocation made ahead, their count and bytes. + sites: [[AtomicU64; 5]; SITES], + /// Each [`Site`]'s longest allocation, at its index, set whole by the call that passes it. + site_longest: [Mutex; SITES], maker_waits: AtomicU64, maker_wait_max_nanos: AtomicU64, dispatches_without_effects: AtomicU64, @@ -735,10 +750,30 @@ impl Counters { /// A `vkAllocateMemory` of `bytes` that took `nanos` nanoseconds at `site`, on a thread of the /// consumer's ([`Metrics::texture_allocations`] and the other sites'). pub(crate) fn site_allocation(&self, site: Site, bytes: u64, nanos: u64) { - let [count, total, longest] = &self.atomics.sites[site as usize]; + let [count, total, longest, ..] = &self.atomics.sites[site as usize]; count.fetch_add(1, Relaxed); total.fetch_add(bytes, Relaxed); - longest.fetch_max(nanos, Relaxed); + // As a part's longest call ([`Counters::timed`]): only a call past the longest so far + // takes the lock. + if nanos > longest.fetch_max(nanos, Relaxed) { + let record = &self.atomics.site_longest[site as usize]; + let mut record = record.lock().unwrap_or_else(PoisonError::into_inner); + if nanos > record.nanos { + *record = Longest { + nanos, + bytes, + made: true, + }; + } + } + } + + /// A take of `bytes` at `site` that landed in an allocation the block-maker thread made ahead + /// of need, the first take to land in it ([`SiteAllocations::takes_ahead`]). + pub(crate) fn site_take_ahead(&self, site: Site, bytes: u64) { + let [.., ahead, ahead_bytes] = &self.atomics.sites[site as usize]; + ahead.fetch_add(1, Relaxed); + ahead_bytes.fetch_add(bytes, Relaxed); } /// `bytes` more copied for a call ([`Metrics::bytes_copied`]). @@ -962,11 +997,16 @@ impl Counters { pub fn metrics(&self) -> Metrics { let a = &self.atomics; let site = |site: Site| { - let [count, bytes, longest] = &a.sites[site as usize]; + let [count, bytes, longest, ahead, ahead_bytes] = &a.sites[site as usize]; + let record = + *(a.site_longest[site as usize].lock()).unwrap_or_else(PoisonError::into_inner); SiteAllocations { count: count.load(Relaxed), bytes: bytes.load(Relaxed), longest_nanos: longest.load(Relaxed), + longest_bytes: record.bytes, + takes_ahead: ahead.load(Relaxed), + takes_ahead_bytes: ahead_bytes.load(Relaxed), } }; let first_use = @@ -1030,7 +1070,8 @@ impl Counters { staging_region_allocations: site(Site::StagingRegion), staging_buffer_allocations: site(Site::StagingBuffer), zero_source_allocations: site(Site::ZeroSource), - take_allocations: site(Site::Take), + shared_take_allocations: site(Site::SharedTake), + private_take_allocations: site(Site::PrivateTake), maker_waits: a.maker_waits.load(Relaxed), maker_wait_max_nanos: a.maker_wait_max_nanos.load(Relaxed), shared_long_reuses: a.shared_long_reuses.load(Relaxed), @@ -1304,7 +1345,9 @@ pub struct Metrics { pub texture_allocations: SiteAllocations, /// Those of texture blocks: a texture's place that no texture block had room for took a /// Private block, and no free range of the pool, which the block-maker thread keeps a wholly - /// free 16 MiB unit of ahead per class, fit it, so the take allocated. + /// free 16 MiB unit of ahead per class, fit it, so the take allocated. Its + /// [`takes_ahead`](SiteAllocations::takes_ahead) are the texture blocks that landed in such a + /// unit instead. pub texture_block_allocations: SiteAllocations, /// Those of the parameter ring's 2 MiB blocks: a write into the ring that found no chunk free /// where the block-maker thread, which makes each block ahead of need, made none (its make @@ -1321,10 +1364,15 @@ pub struct Metrics { /// textures copy from, which the block-maker thread makes as its first work: made by the /// first such fill or texture only where that make failed. pub zero_source_allocations: SiteAllocations, - /// Those of takes from the pool that no free range fit: the consumer's - /// ([`Device::take_block`](crate::Device::take_block)). Texture blocks' are + /// Those of the consumer's takes of Shared blocks + /// ([`Device::take_block`](crate::Device::take_block)) that no free range fit; its + /// [`takes_ahead`](SiteAllocations::takes_ahead) are those that landed in a unit the + /// block-maker thread made ahead instead. + pub shared_take_allocations: SiteAllocations, + /// As [`shared_take_allocations`](Self::shared_take_allocations), of the consumer's takes of + /// Private blocks. Texture blocks' are /// [`texture_block_allocations`](Self::texture_block_allocations). - pub take_allocations: SiteAllocations, + pub private_take_allocations: SiteAllocations, /// Calls that waited for the block-maker thread's make of one of the runtime's fixed-size /// internals they need, which it makes off every caller's thread: the zero source, a /// parameter ring block or the staging region (the sites above). Such a @@ -1561,7 +1609,9 @@ pub struct Metrics { /// Allocations a take made for itself on the consumer's thread, where no free range fit it: /// `vkCreateBuffer`, `vkAllocateMemory`, `vkBindBufferMemory`, the buffer's address and, for a /// Shared one, `vkMapMemory`, together; their bytes the allocations'. The `vkAllocateMemory` - /// calls alone are [`take_allocations`](Self::take_allocations). + /// calls alone are [`shared_take_allocations`](Self::shared_take_allocations), + /// [`private_take_allocations`](Self::private_take_allocations) and + /// [`texture_block_allocations`](Self::texture_block_allocations). pub take_makes: Timed, /// The consumer's [`BlockMappings::map`](crate::BlockMappings::map) of those allocations, on /// the take's thread; their bytes the allocations'. @@ -1633,7 +1683,8 @@ pub struct Timed { /// No Metal counterpart: the `vkAllocateMemory` calls one site of the runtime made on the /// consumer's threads, inside its calls ([`Metrics::texture_allocations`] and the other /// sites'): each call, whether it succeeded or not, timed alone with -/// [`host_time`](crate::host_time). +/// [`host_time`](crate::host_time). At a site of takes from the pool, also the takes that memory +/// made ahead of need served instead ([`takes_ahead`](Self::takes_ahead)). #[non_exhaustive] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct SiteAllocations { @@ -1644,6 +1695,19 @@ pub struct SiteAllocations { /// The longest call, in nanoseconds; a maximum since the device was made, so the difference /// of two reads does not apply to it. pub longest_nanos: u64, + /// The bytes the longest call asked for; with [`longest_nanos`](Self::longest_nanos), from + /// the same call. + pub longest_bytes: u64, + /// At a site of takes from the pool ([`Metrics::shared_take_allocations`], + /// [`Metrics::private_take_allocations`], [`Metrics::texture_block_allocations`]): the takes + /// that landed in an allocation the block-maker thread made ahead of need while the class + /// held no wholly free unit, each the first take to land in it, so that no allocation made + /// before it had room for the take. Each is a take that would otherwise have allocated at + /// the site, on the consumer's thread. A take landing in a class's first allocation, made in + /// the device's making, is not among them. 0 at the other sites. + pub takes_ahead: u64, + /// Those takes' bytes, each the block's length. + pub takes_ahead_bytes: u64, } /// A thread's slot in [`Gauges::threads`], given back as it drops. diff --git a/crates/metal2vulkan-rt/src/device.rs b/crates/metal2vulkan-rt/src/device.rs index 9eb6b0fa7..bd96ffc12 100644 --- a/crates/metal2vulkan-rt/src/device.rs +++ b/crates/metal2vulkan-rt/src/device.rs @@ -910,7 +910,7 @@ impl Device { if core.closed() { return Err(Error::Quiesced); } - let memory = core.take_memory(class, len, Site::Take)?; + let memory = core.take_memory(class, len, Site::take(class))?; let info = memory.info(); let block = memory::Block::new(memory, Arc::clone(core)); Ok(Block::claim(core, info, block)) diff --git a/crates/metal2vulkan-rt/src/memory.rs b/crates/metal2vulkan-rt/src/memory.rs index cea992266..2a92cfb6f 100644 --- a/crates/metal2vulkan-rt/src/memory.rs +++ b/crates/metal2vulkan-rt/src/memory.rs @@ -496,6 +496,10 @@ struct Allocation { /// one it was made for, until it is idle again /// ([`Gauges::shared_long_reused_bytes`](crate::Gauges::shared_long_reused_bytes)). reused: bool, + /// Made by the block-maker thread while its class held no wholly free unit ([`run`]), and no + /// take has landed in it yet: the first take that does is counted at its site + /// ([`SiteAllocations::takes_ahead`](crate::SiteAllocations::takes_ahead)). + ahead: bool, } impl Allocation { @@ -857,7 +861,10 @@ impl Pool { if state.stop { return Err(Error::Quiesced); } - if let Some((carve, idle_since, long)) = state.fit(class, len, align) { + if let Some((carve, idle_since, long, ahead)) = state.fit(class, len, align) { + if ahead { + self.counters.site_take_ahead(site, len); + } if let Some(since) = idle_since { (self.counters).reused_idle(crate::host_time().saturating_sub(since)); } @@ -1137,13 +1144,14 @@ impl State { /// Reserves `len` bytes at a multiple of `align` in the class's allocations that serve a take /// of `len` ([`Allocation::serves`]), counting a block live there: the first such free range, /// in the order the allocations were made. With the range, when the allocation became idle - /// where it was, and whether it is a long allocation. + /// where it was, whether it is a long allocation, and whether it is the first take to land + /// in a unit the block-maker thread made ahead ([`Allocation::ahead`]). fn fit( &mut self, class: MemoryClass, len: u64, align: u64, - ) -> Option<(Carve, Option, bool)> { + ) -> Option<(Carve, Option, bool, bool)> { let (allocation, base) = (self.allocations[class.index()].iter_mut()) .filter(|allocation| allocation.serves(len)) .find_map(|allocation| { @@ -1156,7 +1164,9 @@ impl State { if long { allocation.reused = true; } - Some((allocation.carve(base), idle_since, long)) + let ahead = allocation.ahead; + allocation.ahead = false; + Some((allocation.carve(base), idle_since, long, ahead)) } /// The class's idle allocations the idle rule weighs, as when each became idle and its memory, @@ -1355,7 +1365,10 @@ pub(crate) fn run(core: Arc) { state = pool.lock(); match made { // Idle from now: the reserve, which the idle rule does not weigh. - Some(allocation) => state.allocations[class.index()].push(allocation), + Some(mut allocation) => { + allocation.ahead = true; + state.allocations[class.index()].push(allocation); + } None => state.failed[class.index()] = true, } pool.settle(&mut state, class); @@ -1561,6 +1574,7 @@ fn make_allocation( idle_since: crate::host_time(), retiring: false, reused: false, + ahead: false, }; core.counters.count(Metric::BlocksMade); core.counters.allocated(len); diff --git a/crates/metal2vulkan-rt/src/tests/memory.rs b/crates/metal2vulkan-rt/src/tests/memory.rs index 1f9f17a19..91f440204 100644 --- a/crates/metal2vulkan-rt/src/tests/memory.rs +++ b/crates/metal2vulkan-rt/src/tests/memory.rs @@ -719,12 +719,14 @@ mod on_device { } /// The device's making makes one allocation of each class before it returns, before the - /// block-maker thread started, each wholly free, so the thread makes none. A Shared take of a - /// byte, a range of the first, leaves the class no wholly free unit: the block-maker thread - /// makes the next, off the taker's thread. Once it has, a take of a whole unit, 16 MiB, lands - /// in it and allocates nothing on this thread, and the block-maker thread makes the next in - /// turn. Under a rule that made an allocation only once the class's free bytes ran low, the - /// small take would set nothing off and the 16 MiB take would allocate on its own thread. + /// block-maker thread started, each wholly free, so the thread makes none. In each class, a + /// take of a byte, a range of the first, leaves the class no wholly free unit: the block-maker + /// thread makes the next, off the taker's thread. Once it has, a take of a whole unit, 16 MiB, + /// lands in it and allocates nothing on this thread, counted at its class's take site as one + /// take landed ahead of its 16 MiB and no allocation, and the block-maker thread makes the + /// next in turn. The small take, in the class's first allocation, is not counted landed ahead. + /// Under a rule that made an allocation only once the class's free bytes ran low, the small + /// take would set nothing off and the 16 MiB take would allocate on its own thread. #[test] fn every_device_makes_a_class_s_next_allocation_once_it_holds_no_wholly_free_unit() { let instance = crate::tests::validation::instance(&[]); @@ -753,48 +755,71 @@ mod on_device { (INTERNALS + 2, len, len), "{name}: the internals and the first allocations" ); - let small = (device.take_block(MemoryClass::Shared, 1)) - .unwrap_or_else(|error| panic!("{name}: a small block: {error}")); - // The block-maker thread makes the next unit. The wait is bounded and asserts - // nothing, so a rule that makes none fails at the whole take below, which then - // allocates on this thread. - let deadline = Instant::now() + Duration::from_secs(10); - while !core.pool.stocked(MemoryClass::Shared) && Instant::now() < deadline { - thread::sleep(Duration::from_millis(1)); + // Each class's take site, whose allocations and takes landed ahead count apart. + let site = |metrics: &Metrics, class: MemoryClass| match class { + MemoryClass::Shared => metrics.shared_take_allocations, + MemoryClass::Private => metrics.private_take_allocations, + }; + let mut held = Vec::new(); + for (at, class) in [MemoryClass::Shared, MemoryClass::Private] + .into_iter() + .enumerate() + { + let start = counters.metrics(); + let small = (device.take_block(class, 1)) + .unwrap_or_else(|error| panic!("{name}: a small {class:?} block: {error}")); + // The class's first allocation, made in the device's making, is not one the + // block-maker thread made ahead while the class held no wholly free unit. + assert_eq!( + site(&counters.metrics(), class), + site(&start, class), + "{name}: the small {class:?} take landed in the class's first allocation" + ); + // The block-maker thread makes the next unit. The wait is bounded and asserts + // nothing, so a rule that makes none fails at the whole take below, which then + // allocates on this thread. + let deadline = Instant::now() + Duration::from_secs(10); + while !core.pool.stocked(class) && Instant::now() < deadline { + thread::sleep(Duration::from_millis(1)); + } + let ahead = counters.metrics(); + let whole = (device.take_block(class, len)) + .unwrap_or_else(|error| panic!("{name}: a {class:?} block of 16 MiB: {error}")); + let taken = counters.metrics(); + let (was, now) = (site(&ahead, class), site(&taken, class)); + assert_eq!( + ( + taken.consumer_allocations - ahead.consumer_allocations, + now.count - was.count, + now.takes_ahead - was.takes_ahead, + now.takes_ahead_bytes - was.takes_ahead_bytes, + ), + (0, 0, 1, len), + "{name}: the 16 MiB {class:?} take did not land in the unit made ahead, \ + {} allocations made ahead after the small take", + ahead.blocks_made - start.blocks_made + ); + assert_eq!(whole.offset, 0, "{name}: a wholly free {class:?} unit"); + let next = made + 2 * (at as u64 + 1); + wait_until("the class's next allocation", || { + counters.metrics().blocks_made == next && core.pool.stocked(class) + }); + held.push((small, whole)); } - let ahead = counters.metrics(); - let whole = (device.take_block(MemoryClass::Shared, len)) - .unwrap_or_else(|error| panic!("{name}: a block of 16 MiB: {error}")); - let taken = counters.metrics(); - let site = |metrics: &Metrics| metrics.take_allocations.count; - assert_eq!( - ( - taken.consumer_allocations - ahead.consumer_allocations, - site(&taken) - site(&ahead) - ), - (0, 0), - "{name}: the 16 MiB take allocated on this thread, {} allocations made ahead \ - after the small take", - ahead.blocks_made - made - ); - assert_eq!(whole.offset, 0, "{name}: a wholly free unit"); - wait_until("the next Shared allocation", || { - counters.metrics().blocks_made == made + 2 && core.pool.stocked(MemoryClass::Shared) - }); let metrics = counters.metrics(); assert_eq!( ( metrics.block_bytes_made - before.block_bytes_made, metrics.consumer_allocations ), - (2 * len, before.consumer_allocations), - "{name}: two allocations of 16 MiB, both off this thread" + (4 * len, before.consumer_allocations), + "{name}: two allocations of 16 MiB a class, all off this thread" ); assert!( metrics.maker_allocation_nanos > before.maker_allocation_nanos, "{name}: the block-maker thread's allocation time" ); - drop((small, whole)); + drop(held); drop(device); assert_eq!( counters.gauges(), diff --git a/crates/metal2vulkan-rt/src/tests/sites.rs b/crates/metal2vulkan-rt/src/tests/sites.rs index 9d4c7d8e5..fc674c0a7 100644 --- a/crates/metal2vulkan-rt/src/tests/sites.rs +++ b/crates/metal2vulkan-rt/src/tests/sites.rs @@ -18,7 +18,7 @@ mod on_device { use std::sync::atomic::Ordering::Relaxed; /// Each site's counter in `metrics`, by name. - fn sites(metrics: &Metrics) -> [(&'static str, SiteAllocations); 7] { + fn sites(metrics: &Metrics) -> [(&'static str, SiteAllocations); 8] { [ ("texture", metrics.texture_allocations), ("texture block", metrics.texture_block_allocations), @@ -26,12 +26,14 @@ mod on_device { ("staging region", metrics.staging_region_allocations), ("staging buffer", metrics.staging_buffer_allocations), ("zero source", metrics.zero_source_allocations), - ("take", metrics.take_allocations), + ("shared take", metrics.shared_take_allocations), + ("private take", metrics.private_take_allocations), ] } - /// The sites whose counters moved from `before` to `after`, each with the calls and bytes it - /// added and its longest call after; a longest call never falls. + /// The sites whose allocations moved from `before` to `after`, each with the calls and bytes + /// it added and its longest call after; a longest call never falls. A take that landed in a + /// unit made ahead allocated nothing, so it moves no site here. fn moved(before: &Metrics, after: &Metrics) -> Vec<(&'static str, u64, u64, u64)> { (sites(before).into_iter()) .zip(sites(after)) @@ -41,7 +43,10 @@ mod on_device { "{name}: a longest call fell" ); }) - .filter(|((_, was), (_, now))| was != now) + .filter(|((_, was), (_, now))| { + (was.count, was.bytes, was.longest_nanos) + != (now.count, now.bytes, now.longest_nanos) + }) .map(|((name, was), (_, now))| { ( name, @@ -253,13 +258,19 @@ mod on_device { // A take longer than any free range allocates; a short one fits a free range. let mut taken = Vec::new(); - step(name, device, "a 64 MiB take", &[("take", 64 * MIB)], || { - taken.push( - device - .take_block(MemoryClass::Shared, 64 * MIB) - .expect("a take"), - ); - }); + step( + name, + device, + "a 64 MiB take", + &[("shared take", 64 * MIB)], + || { + taken.push( + device + .take_block(MemoryClass::Shared, 64 * MIB) + .expect("a take"), + ); + }, + ); step(name, device, "a 4 KiB take", &[], || { taken.push( device diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index f1fc95aa9..70ba3ebaa 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -2438,6 +2438,7 @@ field metal2vulkan-rt::Metrics.pipeline_cache_lock_waits pub pipeline_cache_lock field metal2vulkan-rt::Metrics.pipeline_cache_looks_skipped pub pipeline_cache_looks_skipped: u64 field metal2vulkan-rt::Metrics.pipelines_created pub pipelines_created: u64 field metal2vulkan-rt::Metrics.private_long_reuses pub private_long_reuses: u64 +field metal2vulkan-rt::Metrics.private_take_allocations pub private_take_allocations: SiteAllocations field metal2vulkan-rt::Metrics.push_bytes pub push_bytes: u64 field metal2vulkan-rt::Metrics.pushes pub pushes: u64 field metal2vulkan-rt::Metrics.pushes_held pub pushes_held: u64 @@ -2446,6 +2447,7 @@ field metal2vulkan-rt::Metrics.ring_block_allocations pub ring_block_allocations field metal2vulkan-rt::Metrics.ring_writes pub ring_writes: u64 field metal2vulkan-rt::Metrics.sampler_element_writes pub sampler_element_writes: u64 field metal2vulkan-rt::Metrics.shared_long_reuses pub shared_long_reuses: u64 +field metal2vulkan-rt::Metrics.shared_take_allocations pub shared_take_allocations: SiteAllocations field metal2vulkan-rt::Metrics.sparse_binds pub sparse_binds: u64 field metal2vulkan-rt::Metrics.staging_buffer_allocations pub staging_buffer_allocations: SiteAllocations field metal2vulkan-rt::Metrics.staging_region_allocations pub staging_region_allocations: SiteAllocations @@ -2461,7 +2463,6 @@ field metal2vulkan-rt::Metrics.surface_waits pub surface_waits: u64 field metal2vulkan-rt::Metrics.surfaces_copied pub surfaces_copied: u64 field metal2vulkan-rt::Metrics.surfaces_in_place pub surfaces_in_place: u64 field metal2vulkan-rt::Metrics.synchronizations pub synchronizations: u64 -field metal2vulkan-rt::Metrics.take_allocations pub take_allocations: SiteAllocations field metal2vulkan-rt::Metrics.take_lock_waits pub take_lock_waits: Timed field metal2vulkan-rt::Metrics.take_makes pub take_makes: Timed field metal2vulkan-rt::Metrics.take_maps pub take_maps: Timed @@ -2577,7 +2578,10 @@ field metal2vulkan-rt::ScissorRect.x pub x: u64 field metal2vulkan-rt::ScissorRect.y pub y: u64 field metal2vulkan-rt::SiteAllocations.bytes pub bytes: u64 field metal2vulkan-rt::SiteAllocations.count pub count: u64 +field metal2vulkan-rt::SiteAllocations.longest_bytes pub longest_bytes: u64 field metal2vulkan-rt::SiteAllocations.longest_nanos pub longest_nanos: u64 +field metal2vulkan-rt::SiteAllocations.takes_ahead pub takes_ahead: u64 +field metal2vulkan-rt::SiteAllocations.takes_ahead_bytes pub takes_ahead_bytes: u64 field metal2vulkan-rt::SizeAndAlign.align pub align: u64 field metal2vulkan-rt::SizeAndAlign.size pub size: u64 field metal2vulkan-rt::StencilDescriptor.depth_failure_operation pub depth_failure_operation: StencilOperation