diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 480bcd5fe..d4c66ea35 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -183,7 +183,7 @@ Vulkan-side choices Metal has no counterpart for: | `optional_device_extensions` | Device extensions each device enables only where it can (it lists one, the instance has what it requires, and the device has its features), never refused for one; `Device::enables_extension` says which. A listed extension's feature structure is enabled with it where the runtime knows one (`VK_KHR_video_maintenance1` and `2`'s, `VK_KHR_unified_image_layouts`' with `unifiedImageLayoutsVideo` where the device has it), here and for `device_extensions`. | | `extra_queues` | Queues each device makes for the consumer beside its own, one per `VkQueueFlags` entry (a video decode queue, for example), of the first family whose flags contain the entry's; `DeviceHandles::extra_queues` returns them. A device with no queue for an entry is made all the same, says so (`metal2vulkan-extra-queues-absent`), and leaves it out. The runtime never submits to them. Empty by default. | | `reserved_queues` | How many queues of its own queue families each device reserves for the consumer out of the round robin its command queues share, which shrinks by each (on an RTX 5080, 13 `VkQueue`s rather than 14); `DeviceHandles::reserved_queues` returns them. The round robin keeps its first four and presenting its two, so a device with none to spare past those (MoltenVK's four families of one queue, lavapipe's one queue) reserves fewer, is made all the same, and says so (`metal2vulkan-reserved-queues-absent`). No command queue, presenting or not, and no internal copy ever submits to them. 0 by default. | -| `queue_limits` | Fewer `VkQueue`s for each device than its queue plan takes (`QueueLimits`: the most for the round robin its command queues share, at least one, and for presenting queues), so making and dropping a device costs less: on an RTX 5080, whose plan takes 17 queues, a device took 445 ms to make and 110 ms to drop, and one limited to one round-robin queue and none for presenting (2 queues) 145 ms and 44 ms. Past the limits command queues share `VkQueue`s (one waits behind another's whole command buffer), and presenting and unshared ones may share. Where the limits change a placement from what the plan gives, the device says so in an informational message (`metal2vulkan-queue-limits-reached`). A device with no queue to spare (RADV's, lavapipe's one graphics queue) takes its plan. `None` (the default) is the plan. For tests and tools that make many devices. | +| `queue_limits` | Fewer `VkQueue`s for each device than its queue plan takes (`QueueLimits`: the most for the round robin its command queues share, at least one, and for presenting queues), so making and dropping a device costs less: on an RTX 5080, whose plan takes 17 queues, a device took 445 ms to make and 110 ms to drop, and one limited to one round-robin queue and none for presenting (2 queues) 145 ms and 44 ms. Past the limits command queues share `VkQueue`s (one waits behind another's whole command buffer), and presenting and unshared ones may share. Where the limits change a placement from what the plan gives, the device says so in an informational message (`metal2vulkan-queue-limits-reached`), at the first such change alone, and counts each later one (`WorkCounts::queue_limits_reached_withheld`). A device with no queue to spare (RADV's, lavapipe's one graphics queue) takes its plan. `None` (the default) is the plan. For tests and tools that make many devices. | | `instance_api_version` | The instance's `apiVersion` (1.2 when unset); a version outside 1.2 to the loader's is refused, never clamped. | | `withheld_features`, `withheld_extensions`, `withhold_generated_commands`, `withhold_view_reinterpretation` | Parts of the recommended enables to leave off; the device then compiles for what is enabled. | | `messages` | A `MessageSink` for the validation layer's messages and the runtime's notices; without one, notices go to stderr. `MessageSink::with_least_severity` skips messages below a severity (never a degrade notice), and the runtime then formats none of its own lines it would skip. | diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index 68de0f7f0..1630d5d38 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -2892,11 +2892,13 @@ impl DegradeNotice { const WORDS: usize = Degradation::ALL.len().div_ceil(64); /// The kinds a device announced, a bit each, and those it announces at every occurrence -/// (`DeviceOptions::announce_each`), a bit each. +/// (`DeviceOptions::announce_each`), a bit each; and the kinds of the messages it says once +/// that are no degradation ([`Told`]) it said, a bit each. #[derive(Debug, Default)] pub(super) struct Announced { seen: [AtomicU64; WORDS], each: [u64; WORDS], + told: AtomicU64, } impl Announced { @@ -2910,9 +2912,18 @@ impl Announced { Announced { seen: Default::default(), each: words, + told: AtomicU64::new(0), } } + /// Whether a message of kind `told` is said now: for the first time on the device, once per + /// kind, whatever `DeviceOptions::announce_each` says (which names degradations alone). + fn first(&self, told: Told) -> bool { + let bit = 1 << told as u32; + let said = &self.told; + said.load(Ordering::Relaxed) & bit == 0 && said.fetch_or(bit, Ordering::Relaxed) & bit == 0 + } + /// Whether `degradation` is announced now: at each occurrence of a kind the device announces /// at each (met at every occurrence, [`EachWatch`]), else for the first time, once per kind. /// Never on a warm pass's threads, which count nothing announced (`warm/pass.rs`): what it @@ -2969,6 +2980,30 @@ impl Announced { } } +/// A message the runtime says that is no degradation (a refusal Metal makes silently, a failure +/// of the runtime's own work, a call Metal ignores, a change the device's options made), said once +/// per device and kind as a degradation is: the first occurrence of its kind on the device is +/// said ([`Device::tell`]), and each later one is counted in the kind's `WorkCounts` field +/// instead, never said. The message itself (its id name, severity and text) is the call site's. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum Told { + /// A placement heap's texture it does not make at an offset inside it + /// (`metal2vulkan-heap-texture-refused`, `Device::new_heap_texture`): + /// `WorkCounts::heap_texture_refused_withheld`. + HeapTextureRefused, + /// A decoded twin's CPU decode that failed (`metal2vulkan-twin-decode-failed`, + /// `texture/decoded_twin.rs`): `WorkCounts::twin_decode_failed_withheld`. + TwinDecodeFailed, + /// A reservation of resource IDs made too late, which is ignored + /// (`metal2vulkan-late-reservation`, `resource_ids.rs`): + /// `WorkCounts::late_reservation_withheld`. + LateReservation, + /// A placement, or a read of the queue sharing, that the device's queue limits changed from + /// its queue plan's (`metal2vulkan-queue-limits-reached`, `DeviceOptions::queue_limits`): + /// `WorkCounts::queue_limits_reached_withheld`. + QueueLimitsReached, +} + thread_local! { /// The command buffer whose work this thread does now, and its generation ([`NoticesFor`]). static NOTICES_FOR: Cell = const { @@ -3439,6 +3474,22 @@ impl super::encoder::EncoderCore { } impl Device { + /// Say the message `message` makes, of kind `told`, unless the device said one of that kind + /// before: through the device's message sink, else on stderr, on the calling thread. A later + /// one is counted ([`Told`]) and not made. + pub(crate) fn tell(&self, told: Told, message: impl FnOnce() -> DebugMessage) { + let shared = self.shared(); + if !shared.announced.first(told) { + shared.counts.told_withheld(told); + return; + } + let message = message(); + match shared.instance.sink() { + Some(sink) => sink.deliver(&message), + None => eprintln!("{}", message.text), + } + } + /// Announce `degradation` unless the device announced it before (but a kind its options ask /// for at each occurrence, `DeviceOptions::announce_each`), `describe` giving the object and /// the reason: through the device's message sink, else on stderr, on the calling thread (the diff --git a/crates/metal2vulkan-runtime/src/device/create.rs b/crates/metal2vulkan-runtime/src/device/create.rs index bb1f4bb6d..ef4e573f6 100644 --- a/crates/metal2vulkan-runtime/src/device/create.rs +++ b/crates/metal2vulkan-runtime/src/device/create.rs @@ -34,7 +34,7 @@ use super::keeper::keep_drivers_loaded; use super::line::{Line, Recipe}; use super::properties::{DeviceKind, PhysicalDeviceIdentity}; use super::{device_error, holds, lock, Device, InstanceShared, Parts}; -use crate::degradation::{Degradation, DegradeNotice}; +use crate::degradation::{Degradation, DegradeNotice, Told}; use crate::enables::{host_image_copy_names, listed_reported, listed_structures, Enables}; use crate::error::{vulkan, Error, InstanceApiVersion, LoaderNotFound}; use crate::exit_guard; @@ -330,7 +330,9 @@ pub struct DeviceOptions { /// (`shared-present-queue`) or with an earlier presenting queue. The reserved and extra /// queues take the queues the limits leave. Wherever the limits change a placement from what /// the plan gives, the device says so in an informational message - /// (`metal2vulkan-queue-limits-reached`, through [`messages`](Self::messages) or on stderr): + /// (`metal2vulkan-queue-limits-reached`, through [`messages`](Self::messages) or on stderr), + /// at the first such change alone, each later one counted + /// (`WorkCounts::queue_limits_reached_withheld`): /// a command queue the program makes, unshared or not, that takes a `VkQueue` another took /// where the plan gives it one of its own (counted among the program's queues: the runtime's /// own, its in-place check's, shares as it does on a device of one queue); a presenting queue past the limit's where the plan reserves it one; @@ -2219,26 +2221,24 @@ pub(super) fn create_on( } if let Some(planned) = &planned { if planned.reserved != reserved_places { - let what = format!( - "the queues reserved for the caller are {reserved_places:?} (family, index), \ - where the plan reserves {:?}", - planned.reserved - ); - device.inform( - QUEUE_LIMITS_REACHED, - queue_limits_reached(device.name(), &what), - ); + device.inform_once(Told::QueueLimitsReached, QUEUE_LIMITS_REACHED, || { + let what = format!( + "the queues reserved for the caller are {reserved_places:?} (family, index), \ + where the plan reserves {:?}", + planned.reserved + ); + queue_limits_reached(device.name(), &what) + }); } if planned.extra != extra_places { - let what = format!( - "the extra queues are at {extra_places:?} (family, index), where the plan places \ - them at {:?}", - planned.extra - ); - device.inform( - QUEUE_LIMITS_REACHED, - queue_limits_reached(device.name(), &what), - ); + device.inform_once(Told::QueueLimitsReached, QUEUE_LIMITS_REACHED, || { + let what = format!( + "the extra queues are at {extra_places:?} (family, index), where the plan \ + places them at {:?}", + planned.extra + ); + queue_limits_reached(device.name(), &what) + }); } } if let Some(why) = cache_kept { diff --git a/crates/metal2vulkan-runtime/src/device/mod.rs b/crates/metal2vulkan-runtime/src/device/mod.rs index cb4fe4588..422c142b0 100644 --- a/crates/metal2vulkan-runtime/src/device/mod.rs +++ b/crates/metal2vulkan-runtime/src/device/mod.rs @@ -52,7 +52,7 @@ use super::color_resolve::ColorResolveObjects; use super::command_buffer::fences::Fences; use super::command_buffer::{Completion, Item}; use super::contexts::{Contexts, THREADS}; -use super::degradation::{Announced, Degradation}; +use super::degradation::{Announced, Degradation, Told}; use super::depth_copy::DepthCopyObjects; use super::depth_stencil_resolve::DepthStencilResolveObjects; use super::draw_source::{sized_index_bind, SizedIndexBind}; @@ -1607,7 +1607,8 @@ impl Device { /// robin (`DeviceOptions::queue_limits`) and this is a queue the program made, `noted` naming /// it (`None` for the runtime's own and for a presenting queue's, which /// `Device::next_presenting_queue` notes), the device says so where the program's queues - /// made so far reach past the limits' `VkQueue`s and the plan gives this one its own. + /// made so far reach past the limits' `VkQueue`s and the plan gives this one its own: once + /// per device ([`Told::QueueLimitsReached`]). pub(super) fn next_queue(&self, noted: Option<&str>) -> (u64, usize) { let id = self.shared().contexts.fresh(); let made = self @@ -1621,16 +1622,19 @@ impl Device { if let (Some(queue), Some((planned, _))) = (noted, self.shared().planned) { let program = (self.shared().program_queues_made).fetch_add(1, Ordering::Relaxed); if create::shares_past_limit(program, self.shared().round_robin, planned) { - let what = format!( - "{queue}, the program's command queue {} on a round robin of {} VkQueue(s), \ - took VkQueue {vk_queue}, which another took, where the plan's {planned} give \ - it one of its own", - program + 1, - self.shared().round_robin - ); - self.inform( + self.inform_once( + Told::QueueLimitsReached, create::QUEUE_LIMITS_REACHED, - create::queue_limits_reached(self.name(), &what), + || { + let what = format!( + "{queue}, the program's command queue {} on a round robin of {} \ + VkQueue(s), took VkQueue {vk_queue}, which another took, where the \ + plan's {planned} give it one of its own", + program + 1, + self.shared().round_robin + ); + create::queue_limits_reached(self.name(), &what) + }, ); } } @@ -1650,14 +1654,18 @@ impl Device { if let Some((_, planned)) = self.shared().planned { let asked = (self.shared().presenting_asked).fetch_add(1, Ordering::Relaxed); if create::shares_past_limit(asked, reserved, planned) { - let what = format!( - "presenting queue {} shares a VkQueue, the device's queue limits reserving \ - {reserved} for presenting queues, where the plan reserves {planned}", - asked + 1 - ); - self.inform( + self.inform_once( + Told::QueueLimitsReached, create::QUEUE_LIMITS_REACHED, - create::queue_limits_reached(self.name(), &what), + || { + let what = format!( + "presenting queue {} shares a VkQueue, the device's queue limits \ + reserving {reserved} for presenting queues, where the plan reserves \ + {planned}", + asked + 1 + ); + create::queue_limits_reached(self.name(), &what) + }, ); } } diff --git a/crates/metal2vulkan-runtime/src/driver_facts.rs b/crates/metal2vulkan-runtime/src/driver_facts.rs index 9817ff668..ae9ac4aeb 100644 --- a/crates/metal2vulkan-runtime/src/driver_facts.rs +++ b/crates/metal2vulkan-runtime/src/driver_facts.rs @@ -19,6 +19,17 @@ impl super::Device { pub(crate) fn inform(&self, id_name: &str, text: String) { inform_through(self.shared().instance.sink(), id_name, text); } + + /// [`inform`](Self::inform) the message `text` gives, of kind `told`, unless the device said + /// one of that kind before: then it is counted, not said (`Device::tell`). + pub(crate) fn inform_once( + &self, + told: crate::degradation::Told, + id_name: &str, + text: impl FnOnce() -> String, + ) { + self.tell(told, || informational(id_name, text())); + } } /// [`Device::inform`](crate::Device::inform) through `sink`, else on stderr, where the device is diff --git a/crates/metal2vulkan-runtime/src/queue_share.rs b/crates/metal2vulkan-runtime/src/queue_share.rs index 0720a3024..e56e224a5 100644 --- a/crates/metal2vulkan-runtime/src/queue_share.rs +++ b/crates/metal2vulkan-runtime/src/queue_share.rs @@ -869,15 +869,15 @@ impl Device { let Some((taken, planned)) = self.shared().queues_limited() else { return; }; - let what = format!( - "its queue sharing was read ({call}) with {} VkQueue(s) for the round robin and {} \ - for presenting queues, where the plan gives {} and {}", - taken.0, taken.1, planned.0, planned.1 - ); - self.inform( - crate::device::QUEUE_LIMITS_REACHED, - crate::device::queue_limits_reached(self.name(), &what), - ); + let told = crate::degradation::Told::QueueLimitsReached; + self.inform_once(told, crate::device::QUEUE_LIMITS_REACHED, || { + let what = format!( + "its queue sharing was read ({call}) with {} VkQueue(s) for the round robin and \ + {} for presenting queues, where the plan gives {} and {}", + taken.0, taken.1, planned.0, planned.1 + ); + crate::device::queue_limits_reached(self.name(), &what) + }); } /// [`Device::queue_switch_check_report`] on the generation that serves (`device/line.rs`). diff --git a/crates/metal2vulkan-runtime/src/resource_ids.rs b/crates/metal2vulkan-runtime/src/resource_ids.rs index 444f6b65f..a1c69c5a7 100644 --- a/crates/metal2vulkan-runtime/src/resource_ids.rs +++ b/crates/metal2vulkan-runtime/src/resource_ids.rs @@ -99,10 +99,11 @@ //! 4 and 5) keep IDs from plain allocation for good, whether a resource placed at one lives or //! not. Only a space's first call with an ID counts: one once the space handed out an ID, //! placed or plain, or took a reservation is ignored whatever it holds, with a diagnostic -//! line, as Metal's is (its pool logs "reserve() must be called before any allocation takes -//! place" for both; an M3 Max, macOS 27.0.1, so ignored IDs of 2^31, 2^32 - 1, 2^32 + 5 and -//! 0 alone of indirect command buffers, and 2^28 + 5 of textures, each refused or dropped in -//! a first call). A +//! line for the device's first such call (each later one counted, +//! `WorkCounts::late_reservation_withheld`), as Metal's is (its pool logs "reserve() must be +//! called before any allocation takes place" for both; an M3 Max, macOS 27.0.1, so ignored +//! IDs of 2^31, 2^32 - 1, 2^32 + 5 and 0 alone of indirect command buffers, and 2^28 + 5 of +//! textures, each refused or dropped in a first call). A //! call of no ID changes nothing, and 0 beside other IDs is no ID (0 and 5 reserve 5). A call //! of 0 alone reserves nothing, but leaves the pool made, as a texture pool is by the device's //! first queue ([`Pool::make`]): a later reservation keeps the pool's first range beside the @@ -199,6 +200,7 @@ //! of the runtime's own work. A making on a thread inside one does not wait for it, and a //! making waits holding none of the runtime's locks. +use super::degradation::Told; use super::device::{lock, DebugMessage, Device, MessageKind, MessageSeverity, MessageSink}; use super::error::{invalid, Error, Problem}; use super::exit_guard; @@ -1336,7 +1338,9 @@ impl Device { /// call of `kind` with an ID counts: a later one, or one once the device handed out an ID of /// `kind`, is ignored whatever it holds (an ID of 2^32 or more, 0 alone, or one refused /// below), as Metal's is, and the device says so in one diagnostic line (through its message - /// sink, else on stderr), as Metal logs it. A call of no ID changes nothing. + /// sink, else on stderr), as Metal logs it: for the device's first such call alone, each + /// later one counted (`WorkCounts::late_reservation_withheld`). A call of no ID changes + /// nothing. /// /// Before that, a call holding an ID of 2^32 or more is dropped whole, silently, and leaves /// the kind's reservation to a later call, as Metal's is; 0, the null handle, reserves nothing. A call @@ -1431,16 +1435,11 @@ impl Device { } } - /// Say that a late reservation call of `count` IDs of `kind` is ignored, as Metal logs it. + /// Say that a late reservation call of `count` IDs of `kind` is ignored, as Metal logs it: + /// the device's first such call, each later one counted + /// (`WorkCounts::late_reservation_withheld`). fn ignore_late_reservation(&self, kind: ResourceIdKind, count: usize) { - const CALL: &str = "reserve_resource_ids"; - self.diagnose( - "metal2vulkan-late-reservation", - format!( - "metal2vulkan: {CALL}: reserve() must be called before any allocation takes \ - place; the reservation of {count} {kind:?} IDs is ignored, as Metal ignores it" - ), - ); + self.tell(Told::LateReservation, || late_reservation(kind, count)); } /// How many sampler IDs the device holds now: one for each holder of one (the module docs' @@ -1560,25 +1559,26 @@ impl Device { pub(super) fn sampler_array(&self) -> u32 { metal2vulkan::pipeline::heap_sampler_capacity(self.compile_device().profile()) } +} - /// Say `text`, a general warning `code` names: through the device's message sink, else on - /// stderr. Not a degradation: the answer is Metal's, and Metal says it too. - fn diagnose(&self, code: &str, text: String) { - let message = DebugMessage { - severity: MessageSeverity::Warning, - kind: MessageKind { - general: true, - ..MessageKind::default() - }, - id_name: code.to_owned(), - id: 0, - text, - degradation: None, - }; - match self.shared().instance.sink() { - Some(sink) => sink.deliver(&message), - None => eprintln!("{}", message.text), - } +/// The general warning that a late reservation call of `count` IDs of `kind` is ignored +/// (`metal2vulkan-late-reservation`). Not a degradation: the answer is Metal's, and Metal says it +/// too. +fn late_reservation(kind: ResourceIdKind, count: usize) -> DebugMessage { + const CALL: &str = "reserve_resource_ids"; + DebugMessage { + severity: MessageSeverity::Warning, + kind: MessageKind { + general: true, + ..MessageKind::default() + }, + id_name: "metal2vulkan-late-reservation".to_owned(), + id: 0, + text: format!( + "metal2vulkan: {CALL}: reserve() must be called before any allocation takes place; \ + the reservation of {count} {kind:?} IDs is ignored, as Metal ignores it" + ), + degradation: None, } } diff --git a/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs b/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs index 78bd283d1..82969d773 100644 --- a/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs +++ b/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs @@ -1,15 +1,17 @@ //! A placement heap's `new_texture_at_offset` that makes no texture at an offset inside the heap -//! names it in an informational message (`metal2vulkan-heap-texture-refused`): one off the size -//! query's alignment, and one at an aligned offset whose bytes run past the heap's end. One at the -//! heap's end, outside it, is not named, nor is one the heap makes. +//! names it in an informational message (`metal2vulkan-heap-texture-refused`), the device's first +//! such refusal alone: one off the size query's alignment, or one at an aligned offset whose bytes +//! run past the heap's end. Each later one is counted +//! (`WorkCounts::heap_texture_refused_withheld`), not named. One at the heap's end, outside it, is +//! neither named nor counted, nor is one the heap makes. //! //! A device test: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`, //! `m2v_cpu_icd`), on the kind of device the cfg selects. Nothing runs on the GPU. use crate::device::lock; use crate::{ - DebugMessage, Device, DeviceKind, DeviceOptions, Error, HeapDescriptor, HeapType, - MessageSeverity, MessageSink, ResourceOptions, TextureDescriptor, + DebugMessage, Device, DeviceKind, DeviceOptions, Error, Heap, HeapDescriptor, HeapType, + MessageSeverity, MessageSink, ResourceOptions, SizeAndAlign, TextureDescriptor, }; use metal2vulkan::metal::{PixelFormat, TextureUsage}; use std::sync::{Arc, Mutex}; @@ -42,13 +44,10 @@ fn listening() -> (Device, Heard) { (Device::system_default_with(&options).unwrap(), heard) } -#[test] -fn a_placement_heap_names_a_texture_it_does_not_make_inside_it() { - let (device, heard) = listening(); - let mut d = TextureDescriptor::texture_2d(PixelFormat::R16Float, 383, 152, false); - d.usage = TextureUsage::SHADER_READ; - d.resource_options = ResourceOptions::shared(); - let answer = device.heap_texture_size_and_align(&d).unwrap(); +/// A heap of room for `d` and its alignment again on `device`, with the size query's answer for +/// `d` and the last offset at the alignment inside the heap, whose bytes run past its end. +fn placement_heap(device: &Device, d: &TextureDescriptor) -> (Heap, SizeAndAlign, u64) { + let answer = device.heap_texture_size_and_align(d).unwrap(); let hd = HeapDescriptor::new( HeapType::Placement, answer.size + answer.align, @@ -56,19 +55,58 @@ fn a_placement_heap_names_a_texture_it_does_not_make_inside_it() { ); let heap = device.new_heap(&hd).unwrap(); let size = heap.size(); - // The last offset at the alignment inside the heap, whose bytes run past its end. let last = (size - 1) / answer.align * answer.align; assert!(last + answer.size > size, "{answer:?} in {size:#x}"); + (heap, answer, last) +} + +/// The descriptor each test places. +fn descriptor() -> TextureDescriptor { + let mut d = TextureDescriptor::texture_2d(PixelFormat::R16Float, 383, 152, false); + d.usage = TextureUsage::SHADER_READ; + d.resource_options = ResourceOptions::shared(); + d +} + +/// Ask `heap` for a texture of `d` at `offset`, which it refuses, `Nil`. +fn refused(heap: &Heap, d: &TextureDescriptor, offset: u64) { + let Err(e) = heap.new_texture_at_offset(d, offset) else { + panic!("a texture at {offset:#x}"); + }; + assert!(matches!(e, Error::Nil(_)), "{offset:#x}: {e}"); +} + +/// The texts of the refusals each device names first, and that a later one on the same device is +/// counted and not named: on one device, the refusal off the alignment is named, the one at the +/// last aligned offset counted; on another, the one at the last aligned offset is named. +#[test] +fn a_placement_heap_names_a_texture_it_does_not_make_inside_it() { + let d = descriptor(); + let withheld = |device: &Device| device.work_counts().heap_texture_refused_withheld; + let (device, heard) = listening(); + let (heap, answer, last) = placement_heap(&device, &d); + let size = heap.size(); // Made at the heap's start: nothing said. assert!(heap.new_texture_at_offset(&d, 0).is_ok()); - for offset in [1, last, size] { - let Err(e) = heap.new_texture_at_offset(&d, offset) else { - panic!("a texture at {offset:#x}"); - }; - assert!(matches!(e, Error::Nil(_)), "{offset:#x}: {e}"); - } - let heard = lock(&heard).clone(); + refused(&heap, &d, 1); + assert_eq!(lock(&heard).len(), 1, "{:?}", lock(&heard)); + assert_eq!(withheld(&device), 0); + // A second refusal: counted, not named. + refused(&heap, &d, last); + assert_eq!(lock(&heard).len(), 1, "{:?}", lock(&heard)); + assert_eq!(withheld(&device), 1); + // Outside the heap: neither. + refused(&heap, &d, size); + assert_eq!(withheld(&device), 1); + let mut heard = lock(&heard).clone(); + // Another device names the one at the last aligned offset, its first. + let (other, other_heard) = listening(); + let (other_heap, _, other_last) = placement_heap(&other, &d); + assert_eq!((other_heap.size(), other_last), (size, last)); + refused(&other_heap, &d, last); + heard.extend(lock(&other_heard).iter().cloned()); assert_eq!(heard.len(), 2, "{heard:?}"); + assert_eq!(withheld(&other), 0); for ((severity, text), (offset, against)) in heard.iter().zip([ ( 1, diff --git a/crates/metal2vulkan-runtime/src/tests/mod.rs b/crates/metal2vulkan-runtime/src/tests/mod.rs index 208ec606c..a41286097 100644 --- a/crates/metal2vulkan-runtime/src/tests/mod.rs +++ b/crates/metal2vulkan-runtime/src/tests/mod.rs @@ -530,6 +530,8 @@ mod tile_pending; mod tile_rebind_making_wait; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod tiled_texture_device; +#[cfg(any(m2v_gpu, m2v_cpu_icd))] +mod told_once; mod tracker; mod trails; #[cfg(any(m2v_gpu, m2v_cpu_icd))] diff --git a/crates/metal2vulkan-runtime/src/tests/queue_limits_device.rs b/crates/metal2vulkan-runtime/src/tests/queue_limits_device.rs index ab45c2ead..7c355c866 100644 --- a/crates/metal2vulkan-runtime/src/tests/queue_limits_device.rs +++ b/crates/metal2vulkan-runtime/src/tests/queue_limits_device.rs @@ -1,9 +1,11 @@ -//! A device's queue limits (`DeviceOptions::queue_limits`) on a device: it sends its -//! informational message (`metal2vulkan-queue-limits-reached`) exactly where the limits change a -//! placement from what the queue plan gives, each case as many times as the plan of the device's -//! own families says (`queue_limits.rs`): the reserved and the extra queues as it is made, a -//! command queue, an unshared one, a presenting one, and a read of its queue sharing; and without -//! limits it sends none, whatever it makes. +//! A device's queue limits (`DeviceOptions::queue_limits`) on a device: it meets its +//! informational message's case (`metal2vulkan-queue-limits-reached`) exactly where the limits +//! change a placement from what the queue plan gives, each case as many times as the plan of the +//! device's own families says (`queue_limits.rs`): the reserved and the extra queues as it is +//! made, a command queue, an unshared one, a presenting one, and a read of its queue sharing. It +//! sends the first it meets alone and counts each later one +//! (`WorkCounts::queue_limits_reached_withheld`); without limits it sends none and counts none, +//! whatever it makes. //! //! On a device whose families have no queue to spare (RADV's and lavapipe's one graphics queue) //! the limits change nothing and none is expected; on one with queues to spare (NVIDIA's graphics @@ -96,6 +98,29 @@ struct Cases { } impl Cases { + /// How many messages of every case. + fn total(&self) -> usize { + self.reserved + self.extra + self.command + self.unshared + self.presenting + self.read + } + + /// The first case met, in the order the runs meet them, once: what the device sends. + fn first(&self) -> Cases { + let mut met = false; + let mut once = |count: usize| { + let first = usize::from(count > 0 && !met); + met |= count > 0; + first + }; + Cases { + reserved: once(self.reserved), + extra: once(self.extra), + command: once(self.command), + unshared: once(self.unshared), + presenting: once(self.presenting), + read: once(self.read), + } + } + /// `texts` counted by case, by the words each case's message says. fn of(texts: &[String]) -> Cases { let count = |words: &str| texts.iter().filter(|text| text.contains(words)).count(); @@ -166,9 +191,11 @@ fn run(device: &Device) -> Vec { queues } -/// Under the lane's limits, the device sends the message exactly where its own families' plan -/// says the limits changed a placement: each case as many times as expected, none for the staging -/// queue, which it keeps where the plan reserves one. +/// Under the lane's limits, the device meets the message's cases exactly where its own families' +/// plan says the limits changed a placement, each as many times as expected, none for the staging +/// queue, which it keeps where the plan reserves one: it sends the first case it meets, and counts +/// every later one. A second read of its queue sharing, where the limits changed it, sends nothing +/// and counts one more. #[test] fn each_placement_the_limits_change_is_noted_and_no_other() { let scratch = Scratch::new("queue-limits"); @@ -182,9 +209,11 @@ fn each_placement_the_limits_change_is_noted_and_no_other() { let _queues = run(&device); let texts = noted.lock().unwrap().clone(); let got = Cases::of(&texts); + let withheld = device.work_counts().queue_limits_reached_withheld; eprintln!( "QUEUE-LIMITS: {}: families {:?}; host-cached texture memory {cached}, staging queue {:?} \ - (the plan's {:?}); expected {expected:?}, got {got:?}; {} message(s): {texts:#?}", + (the plan's {:?}); expected {expected:?}, got {got:?}; {} message(s), {withheld} \ + withheld: {texts:#?}", device.name(), (families.iter()) .map(|f| (f.queue_flags.as_raw(), f.queue_count)) @@ -198,17 +227,18 @@ fn each_placement_the_limits_change_is_noted_and_no_other() { plan.staging.is_some(), "the limits keep the plan's staging queue" ); - assert_eq!(got, expected); + assert_eq!(got, expected.first()); assert_eq!( texts.len(), - expected.reserved - + expected.extra - + expected.command - + expected.unshared - + expected.presenting - + expected.read, + expected.total().min(1), "every message is one of the cases" ); + assert_eq!(withheld as usize, expected.total().saturating_sub(1)); + // A second read of the queue sharing: the case met again, counted, not sent. + device.queue_switch_check_report(); + assert_eq!(noted.lock().unwrap().len(), texts.len()); + let again = device.work_counts().queue_limits_reached_withheld; + assert_eq!(again, withheld + u64::from(expected.read > 0)); } /// Without limits the device sends none, whatever it makes and reads. @@ -219,10 +249,12 @@ fn without_limits_nothing_is_noted() { let device = device(&scratch.0, None, ¬ed); let _queues = run(&device); let texts = noted.lock().unwrap().clone(); + let withheld = device.work_counts().queue_limits_reached_withheld; eprintln!( - "QUEUE-LIMITS: {}: no limits, {} message(s)", + "QUEUE-LIMITS: {}: no limits, {} message(s), {withheld} withheld", device.name(), texts.len() ); assert!(texts.is_empty(), "{texts:#?}"); + assert_eq!(withheld, 0); } diff --git a/crates/metal2vulkan-runtime/src/tests/told_once.rs b/crates/metal2vulkan-runtime/src/tests/told_once.rs new file mode 100644 index 000000000..5bdf0a588 --- /dev/null +++ b/crates/metal2vulkan-runtime/src/tests/told_once.rs @@ -0,0 +1,141 @@ +//! The messages the runtime says once per device that are no degradation +//! (`degradation::Told`): each kind's first occurrence on a device is said, and each later one is +//! counted in the kind's `WorkCounts` field, its message not even made; another device says its +//! own first. A late reservation of resource IDs, met through its own call, does so too. +//! +//! Device tests: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`, +//! `m2v_cpu_icd`), on the kind of device the cfg selects. Nothing runs on the GPU. + +use crate::degradation::Told; +use crate::device::lock; +use crate::texture::decoded_twin::twin_decode_failed; +use crate::{ + DebugMessage, Device, DeviceKind, DeviceOptions, MessageKind, MessageSeverity, MessageSink, + ResourceId, ResourceIdKind, WorkCounts, +}; +use metal2vulkan::metal::PixelFormat; +use std::sync::{Arc, Mutex}; + +/// The id names of the kinds' messages, in [`KINDS`]' order. +const KINDS: [(Told, &str); 4] = [ + ( + Told::HeapTextureRefused, + "metal2vulkan-heap-texture-refused", + ), + (Told::TwinDecodeFailed, "metal2vulkan-twin-decode-failed"), + (Told::LateReservation, "metal2vulkan-late-reservation"), + ( + Told::QueueLimitsReached, + "metal2vulkan-queue-limits-reached", + ), +]; + +/// What the device's sink heard of the kinds' messages: each one's id name. +type Heard = Arc>>; + +/// The device the cfg selects, with a sink that keeps the id name of every message of a kind of +/// [`KINDS`]. +fn listening() -> (Device, Heard) { + let heard: Heard = Arc::default(); + let kept = Arc::clone(&heard); + let sink = MessageSink::new(move |message: &DebugMessage| { + if KINDS.iter().any(|(_, name)| *name == message.id_name) { + lock(&kept).push(message.id_name.clone()); + } + }); + let options = DeviceOptions { + kinds: match cfg!(m2v_cpu_icd) { + true => vec![DeviceKind::Cpu], + false => vec![ + DeviceKind::Discrete, + DeviceKind::Integrated, + DeviceKind::Virtual, + ], + }, + messages: Some(sink), + ..DeviceOptions::default() + }; + (Device::system_default_with(&options).unwrap(), heard) +} + +/// The `WorkCounts` field that counts `told`'s withheld messages. +fn withheld(counts: &WorkCounts, told: Told) -> u64 { + match told { + Told::HeapTextureRefused => counts.heap_texture_refused_withheld, + Told::TwinDecodeFailed => counts.twin_decode_failed_withheld, + Told::LateReservation => counts.late_reservation_withheld, + Told::QueueLimitsReached => counts.queue_limits_reached_withheld, + } +} + +/// The message of kind `told` named `name`: a decoded twin's failed decode as that site makes it, +/// another kind's as an informational line. +fn message(told: Told, name: &str) -> DebugMessage { + if told == Told::TwinDecodeFailed { + let failed = crate::error::internal("a decode that failed"); + return twin_decode_failed(PixelFormat::ETC2_RGB8, [8, 8, 1], &failed); + } + DebugMessage { + severity: MessageSeverity::Info, + kind: MessageKind { + general: true, + ..MessageKind::default() + }, + id_name: name.to_owned(), + id: 0, + text: format!("metal2vulkan: an occurrence of {name}"), + degradation: None, + } +} + +/// Each kind, met twice on a device: the first is said, the second made no message and counted +/// one in the kind's field alone; on another device, the kind's first is said again. +#[test] +fn each_kind_is_said_once_per_device_and_counted_after() { + let (device, heard) = listening(); + let (other, other_heard) = listening(); + for (at, &(told, name)) in KINDS.iter().enumerate() { + let made = std::cell::Cell::new(0); + let tell = |device: &Device| { + device.tell(told, || { + made.set(made.get() + 1); + message(told, name) + }) + }; + tell(&device); + tell(&device); + let names: Vec<&str> = KINDS[..=at].iter().map(|(_, name)| *name).collect(); + assert_eq!(*lock(&heard), names, "{told:?}"); + assert_eq!(made.get(), 1, "{told:?}: the later message was made"); + let counts = device.work_counts(); + for &(kind, _) in &KINDS { + let want = u64::from(KINDS[..=at].iter().any(|(met, _)| *met == kind)); + assert_eq!(withheld(&counts, kind), want, "{told:?}: {kind:?}"); + } + tell(&other); + assert_eq!(*lock(&other_heard), names, "{told:?} on another device"); + assert_eq!(withheld(&other.work_counts(), told), 0, "{told:?}"); + } +} + +/// A reservation of texture IDs after the device's first is ignored, as Metal ignores it: the +/// first such late call is said (`metal2vulkan-late-reservation`), the second counted +/// (`WorkCounts::late_reservation_withheld`) and not said; IDs go on as before. +#[test] +fn a_second_late_reservation_is_counted_not_said() { + let (device, heard) = listening(); + let reserve = |id| { + device + .reserve_resource_ids(ResourceIdKind::Texture, &[ResourceId(id)]) + .unwrap() + }; + let late = || device.work_counts().late_reservation_withheld; + reserve(2); + assert!(lock(&heard).is_empty(), "{:?}", lock(&heard)); + reserve(4); + assert_eq!(*lock(&heard), ["metal2vulkan-late-reservation"]); + assert_eq!(late(), 0); + reserve(6); + assert_eq!(*lock(&heard), ["metal2vulkan-late-reservation"]); + assert_eq!(late(), 1); +} diff --git a/crates/metal2vulkan-runtime/src/texture.rs b/crates/metal2vulkan-runtime/src/texture.rs index 3e1898ee1..c61b9e204 100644 --- a/crates/metal2vulkan-runtime/src/texture.rs +++ b/crates/metal2vulkan-runtime/src/texture.rs @@ -4587,7 +4587,8 @@ impl Heap { /// so in an informational message (id name `metal2vulkan-heap-texture-refused`, `Info` /// severity) naming the descriptor, the offset, the heap, the size and alignment /// [`Device::heap_texture_size_and_align`] answers, what the making planned and the refusal: a - /// diagnostic, as Metal says nothing. + /// diagnostic, as Metal says nothing. The device says it for its first such refusal alone, + /// and counts each later one (`WorkCounts::heap_texture_refused_withheld`). pub fn new_texture_at_offset( &self, descriptor: &TextureDescriptor, diff --git a/crates/metal2vulkan-runtime/src/texture/decoded_twin.rs b/crates/metal2vulkan-runtime/src/texture/decoded_twin.rs index 3cda71909..8dec6814a 100644 --- a/crates/metal2vulkan-runtime/src/texture/decoded_twin.rs +++ b/crates/metal2vulkan-runtime/src/texture/decoded_twin.rs @@ -128,7 +128,7 @@ use super::super::astc; use super::super::blit::{BlitCommandEncoder, TRANSFER}; use super::super::chroma_pairs; use super::super::copy_plan::ImageRegion; -use super::super::degradation::Degradation; +use super::super::degradation::{Degradation, Told}; use super::super::device::{lock, DebugMessage, MessageKind, MessageSeverity}; use super::super::error::{internal, Error}; use super::super::etc; @@ -1064,7 +1064,8 @@ impl Image { /// On the device's decode thread: decode `blocks` (`region`'s; `None`, the zero blocks) into /// the twin ([`write_decoded`](Self::write_decoded)) and count a write's decode; /// [`twin_decoded`](Self::twin_decoded) then lets the batches that wait for it go. A failure - /// is said on the device's message sink as an error (`metal2vulkan-twin-decode-failed`): the + /// is said on the device's message sink as an error (`metal2vulkan-twin-decode-failed`), the + /// device's first, and each later one counted (`WorkCounts::twin_decode_failed_withheld`): the /// call that queued it has returned. pub(super) fn finish_twin_decode( self: &Arc, @@ -1079,28 +1080,10 @@ impl Image { match result { Ok(_) if blocks.is_some() => shared.counts.cpu_block_decode(), Ok(_) => {} - Err(error) => { + Err(error) => self.device.tell(Told::TwinDecodeFailed, || { let plan = self.plan(); - let message = DebugMessage { - severity: MessageSeverity::Error, - kind: MessageKind { - general: true, - ..MessageKind::default() - }, - id_name: "metal2vulkan-twin-decode-failed".to_owned(), - id: 0, - text: format!( - "metal2vulkan: the decoded twin of a {:?} texture of {:?} kept its \ - earlier texels: its CPU decode failed ({error})", - plan.pixel_format, plan.extent - ), - degradation: None, - }; - match shared.instance.sink() { - Some(sink) => sink.deliver(&message), - None => eprintln!("{}", message.text), - } - } + twin_decode_failed(plan.pixel_format, plan.extent, &error) + }), } } @@ -1590,6 +1573,29 @@ impl Image { } } +/// The error message of a decoded twin's failed CPU decode (`metal2vulkan-twin-decode-failed`), +/// of a `pixel_format` texture of `extent`: the twin kept its earlier texels. +pub(crate) fn twin_decode_failed( + pixel_format: PixelFormat, + extent: [u32; 3], + error: &Error, +) -> DebugMessage { + DebugMessage { + severity: MessageSeverity::Error, + kind: MessageKind { + general: true, + ..MessageKind::default() + }, + id_name: "metal2vulkan-twin-decode-failed".to_owned(), + id: 0, + text: format!( + "metal2vulkan: the decoded twin of a {pixel_format:?} texture of {extent:?} kept its \ + earlier texels: its CPU decode failed ({error})" + ), + degradation: None, + } +} + /// `region` (of the twin's texels, in `decode`'s blocks) in steps whose blocks and texels take at /// most `most` bytes together (before, its texels alone): whole, else runs of its images (layers /// or depth slices), else each image in bands of whole block rows (of a whole-level decode's diff --git a/crates/metal2vulkan-runtime/src/texture/heap.rs b/crates/metal2vulkan-runtime/src/texture/heap.rs index 849ba9857..0bcf9cb53 100644 --- a/crates/metal2vulkan-runtime/src/texture/heap.rs +++ b/crates/metal2vulkan-runtime/src/texture/heap.rs @@ -233,7 +233,7 @@ use crate::buffer_texture::{ }; use crate::chroma_pairs; use crate::copy_plan::{CopyProblem, HostLayout, ImageRegion}; -use crate::degradation::Degradation; +use crate::degradation::{Degradation, Told}; use crate::device::lock; use crate::error::{internal, invalid, nil, vulkan, Error, MemoryKind, Nil, Problem, RuntimeGap}; use crate::heap::{Heap, HeapProblem, HeapType, SizeAndAlign, WeakHeap}; @@ -2634,7 +2634,8 @@ impl Device { /// A texture of `descriptor` in `heap`: at `offset` of a placement heap, or where an /// automatic heap has room when `None`. Where a placement heap makes none (`Nil` or - /// `OutOfMemory`) at an offset inside it, the device says so ([`HEAP_TEXTURE_REFUSED`]). + /// `OutOfMemory`) at an offset inside it, the device says so ([`HEAP_TEXTURE_REFUSED`]) the + /// first time, and counts each later one (`WorkCounts::heap_texture_refused_withheld`). pub(crate) fn new_heap_texture( &self, heap: &Heap, @@ -2645,8 +2646,9 @@ impl Device { let made = self.planned_heap_texture(heap, descriptor, offset, &mut planned); if let (Err(e @ (Error::Nil(_) | Error::OutOfMemory(_))), Some(offset)) = (&made, offset) { if offset < heap.size() { - let text = refused_text(self, heap, descriptor, offset, planned, e); - self.inform(HEAP_TEXTURE_REFUSED, text); + self.inform_once(Told::HeapTextureRefused, HEAP_TEXTURE_REFUSED, || { + refused_text(self, heap, descriptor, offset, planned, e) + }); } } made diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index 414ffdc92..54349399f 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -8,7 +8,7 @@ use super::buffer::{KeptBecause, ReadApart}; use super::churn_counts::{VkMaking, VkRelease}; use super::command_buffer::GroupEnd; -use super::degradation::Degradation; +use super::degradation::{Degradation, Told}; use super::device::lock; use super::heap_sets::Unkept; use super::memory::FreeCause; @@ -131,6 +131,10 @@ pub(crate) struct Counters { color_resolve_passes_kept: AtomicU64, ahead_nanos: AtomicU64, driver_diagnostics_withheld: AtomicU64, + heap_texture_refused_withheld: AtomicU64, + twin_decode_failed_withheld: AtomicU64, + late_reservation_withheld: AtomicU64, + queue_limits_reached_withheld: AtomicU64, stand_ins_made: AtomicU64, stand_in_bytes: AtomicU64, stale_detached_reaches: AtomicU64, @@ -2370,6 +2374,18 @@ impl Counters { .fetch_add(withheld, Ordering::Relaxed); } + /// A message of kind `told` was not said, since the device said one of that kind before + /// (`Device::tell`). + pub(crate) fn told_withheld(&self, told: Told) { + let count = match told { + Told::HeapTextureRefused => &self.heap_texture_refused_withheld, + Told::TwinDecodeFailed => &self.twin_decode_failed_withheld, + Told::LateReservation => &self.late_reservation_withheld, + Told::QueueLimitsReached => &self.queue_limits_reached_withheld, + }; + count.fetch_add(1, Ordering::Relaxed); + } + /// An internal submission was made (`device/submit.rs`): one a host call waits for. pub(crate) fn internal_submission(&self) { self.internal_submissions.fetch_add(1, Ordering::Relaxed); @@ -5025,6 +5041,21 @@ pub struct WorkCounts { /// call the runtime made, reported there (`driver_facts.rs`). MoltenVK 1.4.1's warning of a /// pipeline whose restart is dynamic, once per such pipeline it makes. pub driver_diagnostics_withheld: u64, + /// Placement heaps' textures not made at an offset inside the heap whose message + /// (`metal2vulkan-heap-texture-refused`) was withheld: each after the device's first, which + /// it said (`Heap::new_texture_at_offset`). The refusal is answered as before. + pub heap_texture_refused_withheld: u64, + /// Decoded twins' failed CPU decodes whose message (`metal2vulkan-twin-decode-failed`) was + /// withheld: each after the device's first, which it said. + pub twin_decode_failed_withheld: u64, + /// Late reservations of resource IDs, ignored, whose message + /// (`metal2vulkan-late-reservation`) was withheld: each after the device's first, which it + /// said (`Device::reserve_resource_ids`). + pub late_reservation_withheld: u64, + /// Placements and reads of the queue sharing the device's queue limits changed from its queue + /// plan's whose message (`metal2vulkan-queue-limits-reached`) was withheld: each after the + /// device's first, which it said (`DeviceOptions::queue_limits`). + pub queue_limits_reached_withheld: u64, /// Bytes of `VkDeviceMemory` the runtime allocated so far for memory of its own (its /// blocks, pooled or dedicated, freed since or not): none for host memory it imports. A /// detach allocates none for the bytes it detaches (`detach.rs`). @@ -8211,6 +8242,16 @@ impl Device { driver_diagnostics_withheld: counters .driver_diagnostics_withheld .load(Ordering::Relaxed), + heap_texture_refused_withheld: counters + .heap_texture_refused_withheld + .load(Ordering::Relaxed), + twin_decode_failed_withheld: counters + .twin_decode_failed_withheld + .load(Ordering::Relaxed), + late_reservation_withheld: counters.late_reservation_withheld.load(Ordering::Relaxed), + queue_limits_reached_withheld: counters + .queue_limits_reached_withheld + .load(Ordering::Relaxed), device_memory_allocated: allocated, device_memory_overflows: overflows, memory_blocks_live: census.pooled, diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index b541cbd26..28d1ef080 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -2833,6 +2833,7 @@ field metal2vulkan-runtime::WorkCounts.heap_slots_rewritten pub heap_slots_rewri field metal2vulkan-runtime::WorkCounts.heap_tables_worked_out pub heap_tables_worked_out: u64 field metal2vulkan-runtime::WorkCounts.heap_texture_block_compressed_layouts pub heap_texture_block_compressed_layouts: u64 field metal2vulkan-runtime::WorkCounts.heap_texture_lossless_layouts pub heap_texture_lossless_layouts: u64 +field metal2vulkan-runtime::WorkCounts.heap_texture_refused_withheld pub heap_texture_refused_withheld: u64 field metal2vulkan-runtime::WorkCounts.heap_texture_untiled_layouts pub heap_texture_untiled_layouts: u64 field metal2vulkan-runtime::WorkCounts.heap_textures_refit pub heap_textures_refit: u64 field metal2vulkan-runtime::WorkCounts.heap_textures_tiled pub heap_textures_tiled: u64 @@ -2974,6 +2975,7 @@ field metal2vulkan-runtime::WorkCounts.kept_draws_carry_dropped_layout pub kept_ field metal2vulkan-runtime::WorkCounts.kept_draws_carry_dropped_under pub kept_draws_carry_dropped_under: u64 field metal2vulkan-runtime::WorkCounts.kept_resident_keys_compared pub kept_resident_keys_compared: u64 field metal2vulkan-runtime::WorkCounts.kept_texels_passes pub kept_texels_passes: u64 +field metal2vulkan-runtime::WorkCounts.late_reservation_withheld pub late_reservation_withheld: u64 field metal2vulkan-runtime::WorkCounts.line_band_draws pub line_band_draws: u64 field metal2vulkan-runtime::WorkCounts.linear_alignments_probed pub linear_alignments_probed: u64 field metal2vulkan-runtime::WorkCounts.linear_alignments_recalled pub linear_alignments_recalled: u64 @@ -3048,6 +3050,7 @@ field metal2vulkan-runtime::WorkCounts.provoking_listed_draws pub provoking_list field metal2vulkan-runtime::WorkCounts.query_result_copies_recorded pub query_result_copies_recorded: u64 field metal2vulkan-runtime::WorkCounts.queue_drains pub queue_drains: u64 field metal2vulkan-runtime::WorkCounts.queue_joins pub queue_joins: u64 +field metal2vulkan-runtime::WorkCounts.queue_limits_reached_withheld pub queue_limits_reached_withheld: u64 field metal2vulkan-runtime::WorkCounts.queue_moves pub queue_moves: u64 field metal2vulkan-runtime::WorkCounts.queue_moves_off_unshared pub queue_moves_off_unshared: u64 field metal2vulkan-runtime::WorkCounts.queue_sharing_untimed pub queue_sharing_untimed: u64 @@ -3292,6 +3295,7 @@ field metal2vulkan-runtime::WorkCounts.timestamp_slots_reset_on_host pub timesta field metal2vulkan-runtime::WorkCounts.timestamp_slots_taken pub timestamp_slots_taken: u64 field metal2vulkan-runtime::WorkCounts.trail_waits pub trail_waits: u64 field metal2vulkan-runtime::WorkCounts.trail_waits_blocked pub trail_waits_blocked: u64 +field metal2vulkan-runtime::WorkCounts.twin_decode_failed_withheld pub twin_decode_failed_withheld: u64 field metal2vulkan-runtime::WorkCounts.two_plane_draws pub two_plane_draws: u64 field metal2vulkan-runtime::WorkCounts.uncached_host_images pub uncached_host_images: u64 field metal2vulkan-runtime::WorkCounts.unlisted_argument_sampler_buffers pub unlisted_argument_sampler_buffers: u64 diff --git a/docs/API.md b/docs/API.md index 2be074e13..b39d38ebf 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1668,7 +1668,8 @@ Whatever the variables, a placement heap's `newTextureWithDescriptor:offset:` th `metal2vulkan-heap-texture-refused`, `Info` severity): the descriptor, the offset, the heap's size, options and memory, the size and alignment the size query answers the descriptor, what the making planned (the size and alignment it places the texture by, its image's route, tiling and memory -requirements) and the refusal. A device's self-check that the driver does not make (the one +requirements) and the refusal; for the device's first such refusal alone, each later one counted +(`WorkCounts::heap_texture_refused_withheld`). A device's self-check that the driver does not make (the one pipeline it creates to ask whether a set-0 buffer binding of several variables may be a dynamic descriptor, `FAST-PATHS.md`) hands the sink one line saying so, with the driver's result and the messages it reported inside that creation (id name `metal2vulkan-self-check-refused`, `Info`