diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 6bba51e9d..f2a2af0e6 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -822,7 +822,9 @@ meanwhile wait for it. nothing and completes with no error, as on Metal's hang's queue. One made before the recovery and committed after fails with `GpuRecoveryVictim`. A queue's second hang revokes it, as Metal's does: a command buffer committed on it from then on, before the recovery too, fails - with `AccessRevoked`. + with `AccessRevoked`. The recovery's notice (`DeviceRecovered`) names the hang's command buffer + by its label (`CommandBuffer::set_label`) and its queue's, with its ended encoders' kinds and + labels (each encoder's `set_label`, which `CommandBuffer::ended_encoders` reports too). - The `Device` and its `CommandQueue`s go on: what they make from then on is made on the new `VkDevice`. A `Device` call that the loss meets while it runs is not refused for it: it runs again on the new `VkDevice`. One that takes host memory, a deallocator or a range token, which a diff --git a/crates/metal2vulkan-runtime/src/blit.rs b/crates/metal2vulkan-runtime/src/blit.rs index 8971b104a..f20fe8b79 100644 --- a/crates/metal2vulkan-runtime/src/blit.rs +++ b/crates/metal2vulkan-runtime/src/blit.rs @@ -695,6 +695,19 @@ impl BlitCommandEncoder { ) } + /// `label`: the label [`set_label`](Self::set_label) gave it, or `None`, as Metal's is `nil` + /// until set. + pub fn label(&self) -> Option { + self.core.command_buffer().open_encoder_label() + } + + /// `setLabel:`: label it `label`, which its command buffer's ended encoders keep + /// ([`CommandBuffer::ended_encoders`](crate::CommandBuffer::ended_encoders)) and the + /// runtime's notices naming the command buffer state, as [`CommandBuffer::set_label`](crate::CommandBuffer::set_label)'s. + pub fn set_label(&mut self, label: &str) { + self.core.command_buffer().label_open_encoder(label); + } + /// `endEncoding`. pub fn end_encoding(self) -> Result<(), Error> { let _for = self.core.notices_for(); diff --git a/crates/metal2vulkan-runtime/src/command_buffer/completion.rs b/crates/metal2vulkan-runtime/src/command_buffer/completion.rs index ff995edf7..914409b00 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/completion.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/completion.rs @@ -890,9 +890,11 @@ impl Answers { }; let buffer = &culprit.buffer; let failing = failed.iter().filter(|(_, batch)| batch.last).count(); + let queue = buffer.queue.label(); + let named = lock(&buffer.state).named(queue.as_deref()); device.line().named(Culprit { queue: Arc::downgrade(buffer.queue.common()), - label: buffer.queue.label(), + named, inferred: fronts.len() > 1, victims: failing.saturating_sub(1), }); diff --git a/crates/metal2vulkan-runtime/src/command_buffer/labels.rs b/crates/metal2vulkan-runtime/src/command_buffer/labels.rs new file mode 100644 index 000000000..1a3f9a9e0 --- /dev/null +++ b/crates/metal2vulkan-runtime/src/command_buffer/labels.rs @@ -0,0 +1,79 @@ +//! The labels a program gives a command buffer and its encoders (`MTLCommandBuffer.label`, +//! `MTLCommandEncoder.label`), and the command buffer as a notice names it with them: the +//! recovery from a lost device names the command buffer it failed as the hang so +//! (`device/line.rs`). An encoder's label is its command buffer's open encoder's until it ends: +//! a command buffer has one encoder open at a time, and the record of an ended one keeps it +//! ([`CommandBuffer::ended_encoders`]). + +use super::{CommandBuffer, State}; +use crate::EncoderKind; +use std::fmt::Write; + +/// The ended encoders a command buffer's naming lists, at most: it counts the rest. +const NAMED_ENCODERS: usize = 32; + +impl CommandBuffer { + /// `label`: the label [`set_label`](Self::set_label) gave it, or `None`, as Metal's is `nil` + /// until set. + pub fn label(&self) -> Option { + self.state().label.clone() + } + + /// `setLabel:`: label it `label`, at any time, committed or not, as Metal's. The runtime's + /// notices that name the command buffer state it: the recovery from a lost device names the + /// command buffer it failed as the hang by its label, with its encoders' kinds and labels + /// (`Degradation::DeviceRecovered`). + pub fn set_label(&self, label: &str) { + self.state().label = Some(label.to_owned()); + } + + /// Label its open encoder `label` (an encoder's `set_label`). + pub(crate) fn label_open_encoder(&self, label: &str) { + self.state().open_label = Some(label.to_owned()); + } + + /// The label of its open encoder (an encoder's `label`). + pub(crate) fn open_encoder_label(&self) -> Option { + self.state().open_label.clone() + } +} + +impl State { + /// The command buffer as a notice names it, of the queue labeled `queue` where it has a label: + /// its label and its queue's, then each of its first [`NAMED_ENCODERS`] ended encoders by its + /// place, its kind and its label, and the count of the rest. + pub(crate) fn named(&self, queue: Option<&str>) -> String { + let mut named = match &self.label { + Some(label) => format!("command buffer `{label}`"), + None => "a command buffer".to_owned(), + }; + if let Some(queue) = queue { + let _ = write!(named, " of queue `{queue}`"); + } + let count = self.ended.len(); + if count == 0 { + named.push_str(" (no encoder ended)"); + return named; + } + let plural = if count == 1 { "" } else { "s" }; + let _ = write!(named, " (its {count} encoder{plural}:"); + for (place, record) in self.ended.iter().enumerate().take(NAMED_ENCODERS) { + let kind = match record.kind { + EncoderKind::Blit => "blit", + EncoderKind::Compute => "compute", + EncoderKind::Render => "render", + EncoderKind::ResourceState => "resource state", + }; + let comma = if place == 0 { "" } else { "," }; + let _ = write!(named, "{comma} {place} {kind}"); + if let Some(label) = &record.label { + let _ = write!(named, " `{label}`"); + } + } + if count > NAMED_ENCODERS { + let _ = write!(named, ", and {} more", count - NAMED_ENCODERS); + } + named.push(')'); + named + } +} diff --git a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs index e84f90e4d..79fc185c3 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs @@ -42,6 +42,7 @@ pub(super) mod gate; mod group; pub(super) mod hang; pub(super) mod kept_barriers; +mod labels; pub(super) mod own; mod protection; pub(super) mod rebound_use; @@ -702,6 +703,11 @@ pub(super) struct State { error: Option, /// An encoder is open. pub(super) encoder_open: bool, + /// Its label (`MTLCommandBuffer.label`), where the program set one (`labels.rs`). + label: Option, + /// The label of its open encoder, where the program set one: the encoder's record takes it + /// as it ends (`labels.rs`). + open_label: Option, /// An encoder was dropped without `end_encoding`. pub(super) abandoned: bool, /// A render encoder's end, which its call left to the device's lowering thread @@ -1109,6 +1115,7 @@ impl State { let (event_waits_before, event_signals_before) = self.batches.events(); self.ended.push(EncoderRecord { kind, + label: self.open_label.take(), event_waits_before, event_signals_before, keys, @@ -1185,6 +1192,7 @@ impl State { .iter() .map(|record| ReadRecord { kind: record.kind, + label: record.label.clone(), event_waits_before: record.event_waits_before, event_signals_before: record.event_signals_before, keys: record.keys.clone(), @@ -2308,6 +2316,8 @@ impl CommandBuffer { status: CommandBufferStatus::NotEnqueued, error: None, encoder_open: false, + label: None, + open_label: None, abandoned: false, ending: None, end_lowered: false, diff --git a/crates/metal2vulkan-runtime/src/compute.rs b/crates/metal2vulkan-runtime/src/compute.rs index 0e021e1b7..7bb1a2203 100644 --- a/crates/metal2vulkan-runtime/src/compute.rs +++ b/crates/metal2vulkan-runtime/src/compute.rs @@ -1603,6 +1603,19 @@ impl ComputeCommandEncoder { self.residency.carry(residency); } + /// `label`: the label [`set_label`](Self::set_label) gave it, or `None`, as Metal's is `nil` + /// until set. + pub fn label(&self) -> Option { + self.core.command_buffer().open_encoder_label() + } + + /// `setLabel:`: label it `label`, which its command buffer's ended encoders keep + /// ([`CommandBuffer::ended_encoders`](crate::CommandBuffer::ended_encoders)) and the + /// runtime's notices naming the command buffer state, as [`CommandBuffer::set_label`](crate::CommandBuffer::set_label)'s. + pub fn set_label(&mut self, label: &str) { + self.core.command_buffer().label_open_encoder(label); + } + /// `endEncoding`. What it binds is held until the command buffer completes, as Metal holds /// what an encoder was handed. pub fn end_encoding(mut self) -> Result<(), Error> { diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index b235ea6f5..7a5d48dd3 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -2321,8 +2321,10 @@ degradations! { /// survives its GPU's recovery (`device/line.rs`): its command buffers in flight failed, /// the oldest incomplete one as the hang (`GpuHang`) and the rest as its victims /// (`GpuRecoveryVictim`); every later call goes to the new `VkDevice`. Announced at each - /// recovery, from the call that made it; the payload names the culprit (where two or more - /// `VkQueue`s had work in flight it is an inference, and says so) and the recovery's + /// recovery, from the call that made it; the payload names the culprit by its label and + /// its queue's, with its ended encoders' kinds and labels (`command_buffer/labels.rs`; + /// where two or more `VkQueue`s had work in flight it is an inference, and says so) and + /// the recovery's /// time, and the objects it carried to the new `VkDevice` and left refused, by kind /// (`device/carry.rs`). Announced as well, at most once each per recovery, whatever an /// earlier recovery announced: where a call waited past 10 seconds for the recovery under diff --git a/crates/metal2vulkan-runtime/src/device/line.rs b/crates/metal2vulkan-runtime/src/device/line.rs index b26942acf..4e10a22ca 100644 --- a/crates/metal2vulkan-runtime/src/device/line.rs +++ b/crates/metal2vulkan-runtime/src/device/line.rs @@ -189,8 +189,9 @@ enum State { pub(crate) struct Culprit { /// Its command queue's part every generation of the queue shares (`queue.rs`). pub(crate) queue: Weak, - /// Its queue's label, where it has one. - pub(crate) label: Option, + /// It as the notice names it: by its label and its queue's, with its ended encoders' kinds + /// and labels (`command_buffer/labels.rs`). + pub(crate) named: String, /// The queue was picked among two or more with work in flight: an inference, the queue whose /// oldest incomplete batch was submitted first. pub(crate) inferred: bool, @@ -465,10 +466,7 @@ impl Line { next.degrade_recovered(|| { let culprit = match culprit { Some(culprit) => { - let label = culprit.label.map_or_else( - || "a command buffer".to_owned(), - |label| format!("a command buffer of queue `{label}`"), - ); + let named = culprit.named; let inferred = match culprit.inferred { true => { " (an inference: work was in flight on two or more `VkQueue`s, and \ @@ -477,7 +475,7 @@ impl Line { false => "", }; format!( - "{label} failed as the hang (`GpuHang`){inferred}, and {} more in flight \ + "{named} failed as the hang (`GpuHang`){inferred}, and {} more in flight \ as its victims (`GpuRecoveryVictim`)", culprit.victims ) diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index 47e7c756c..4ce35ea82 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -2456,7 +2456,8 @@ pub struct EncoderCall { /// and its kin name their full form, as the method's documentation does). pub selector: &'static str, /// The call's place among the encoder's calls, from 0: every call of the encoder's methods - /// counts, `end_encoding` and the queries (`tile_width`, `tile_height`) but none. The end of an + /// counts, `end_encoding`, `set_label` and the queries (`tile_width`, `tile_height`, `label`) + /// but none. The end of an /// encoder that logged its calls names its notices `endEncoding`, at the place after its last /// call. A commit whose own work, run after it returned, refused it is `commit` at 0 /// (`CommandBuffer::commit`). diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 3af4384b2..5d8e95ef7 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -12587,6 +12587,22 @@ impl RenderCommandEncoder { } } + /// `label`: the label [`set_label`](Self::set_label) gave it, or `None`, as Metal's is `nil` + /// until set. + pub fn label(&self) -> Option { + self.command_buffer()?.open_encoder_label() + } + + /// `setLabel:`: label it `label`, which its command buffer's ended encoders keep + /// ([`CommandBuffer::ended_encoders`](crate::CommandBuffer::ended_encoders)) and the + /// runtime's notices naming the command buffer state, as [`CommandBuffer::set_label`](crate::CommandBuffer::set_label)'s. + /// Its calls' numbering ([`EncoderCall`](crate::EncoderCall)) skips it. + pub fn set_label(&mut self, label: &str) { + if let Some(command_buffer) = self.command_buffer() { + command_buffer.label_open_encoder(label); + } + } + /// `endEncoding`: begin the pass with its load and store operations, run the draws, and end it. /// A store action still `Unknown` is `DontCare`, as plain Metal stores it where its validation /// stops it: a color attachment's (measured on an M4), and a depth or stencil attachment's, diff --git a/crates/metal2vulkan-runtime/src/render/deferral.rs b/crates/metal2vulkan-runtime/src/render/deferral.rs index c36bd7eed..e61209b2c 100644 --- a/crates/metal2vulkan-runtime/src/render/deferral.rs +++ b/crates/metal2vulkan-runtime/src/render/deferral.rs @@ -742,6 +742,16 @@ impl RenderCommandEncoder { } } + /// Its command buffer: its lowering's, or, where its slot holds the lowering, the command + /// buffer the slot was taken for, which lives while the encoder is open. + pub(crate) fn command_buffer(&self) -> Option { + match (&self.own, &self.logged) { + (Some(own), _) => Some(own.0.core.command_buffer().clone()), + (None, Some(logged)) => logged.command_buffer.upgrade(), + (None, None) => None, + } + } + /// Whether the encoder lowers each call inside it (the module docs). pub(crate) fn lowers_at_call(&self) -> bool { self.logged.as_ref().is_none_or(|logged| logged.at_call) diff --git a/crates/metal2vulkan-runtime/src/sparse/encoder.rs b/crates/metal2vulkan-runtime/src/sparse/encoder.rs index 592d88a54..4b15f0ad0 100644 --- a/crates/metal2vulkan-runtime/src/sparse/encoder.rs +++ b/crates/metal2vulkan-runtime/src/sparse/encoder.rs @@ -408,6 +408,19 @@ impl ResourceStateCommandEncoder { Ok(()) } + /// `label`: the label [`set_label`](Self::set_label) gave it, or `None`, as Metal's is `nil` + /// until set. + pub fn label(&self) -> Option { + self.open.command_buffer.open_encoder_label() + } + + /// `setLabel:`: label it `label`, which its command buffer's ended encoders keep + /// ([`CommandBuffer::ended_encoders`](crate::CommandBuffer::ended_encoders)) and the + /// runtime's notices naming the command buffer state, as [`CommandBuffer::set_label`](crate::CommandBuffer::set_label)'s. + pub fn set_label(&mut self, label: &str) { + self.open.command_buffer.label_open_encoder(label); + } + /// `endEncoding`: the updates go to the command buffer, in a batch that binds them before /// the encoders after this one. pub fn end_encoding(self) -> Result<(), Error> { diff --git a/crates/metal2vulkan-runtime/src/tests/device_recovery.rs b/crates/metal2vulkan-runtime/src/tests/device_recovery.rs index ec2890f44..334846f49 100644 --- a/crates/metal2vulkan-runtime/src/tests/device_recovery.rs +++ b/crates/metal2vulkan-runtime/src/tests/device_recovery.rs @@ -112,7 +112,9 @@ fn busy(device: &Device, queue: &CommandQueue) -> CommandBuffer { .new_buffer(BYTES, ResourceOptions::private()) .unwrap(); let command_buffer = queue.command_buffer().unwrap(); + command_buffer.set_label("busy"); let mut blit = command_buffer.blit_command_encoder().unwrap(); + blit.set_label("copies"); for _ in 0..COPIES { blit.copy_from_buffer_to_buffer(&source, 0, &destination, 0, BYTES) .unwrap(); @@ -203,7 +205,8 @@ fn a_loss_holds_the_hang_s_queue_until_the_recovery() { /// A loss the driver reported before any fence could be read, as MoltenVK does under the /// program's own `MVK_CONFIG_RESUME_LOST_DEVICE` off (it marks the device lost first): the relay /// gives every batch in flight the loss's code (`device/relay.rs`), and the recovery's answers -/// stand, the command buffer in flight failing as the hang its notice names, not as a victim. +/// stand, the command buffer in flight failing as the hang its notice names, not as a victim: +/// by its label and its queue's, with its encoder's kind and label. /// The M3 Max's GPU fault under that setting read `GpuRecoveryVictim` there in 25 of 25 runs /// (`runtime_lane::host_memory`'s `a_gpu_fault_fails_its_command_buffer_and_the_queue_runs_on`). #[test] @@ -212,6 +215,7 @@ fn a_relayed_loss_leaves_the_recovery_s_hang() { let heard = Heard::default(); let device = heard_device(&scratch.0, &heard); let queue = device.new_command_queue().unwrap(); + queue.set_label("relayed"); for _ in 0..ATTEMPTS { let from = heard.lock().unwrap().len(); let in_flight = busy(&device, &queue); @@ -230,7 +234,10 @@ fn a_relayed_loss_leaves_the_recovery_s_hang() { continue; } assert!( - made[0].contains("failed as the hang (`GpuHang`)"), + made[0].contains( + "command buffer `busy` of queue `relayed` (its 1 encoder: 0 blit `copies`) failed \ + as the hang (`GpuHang`)" + ), "{made:?}" ); assert_eq!( diff --git a/crates/metal2vulkan-runtime/src/tests/labels.rs b/crates/metal2vulkan-runtime/src/tests/labels.rs new file mode 100644 index 000000000..ed7568f25 --- /dev/null +++ b/crates/metal2vulkan-runtime/src/tests/labels.rs @@ -0,0 +1,83 @@ +//! The labels a program gives a command buffer and its encoders (`command_buffer/labels.rs`): +//! read back as set, and each ended encoder keeps its own in its place, none where none was set, +//! under both render lowering policies (a render encoder that logs its calls ends on the device's +//! lowering thread). A device test: compiled only under the validation crate's GPU safety cfgs, +//! on the kind of device the cfg selects (docs/VALIDATION.md). + +use crate::tests::device_recovery::{Scratch, WAIT}; +use crate::{ + Device, DeviceKind, DeviceOptions, EncoderKind, RenderPassDescriptor, ResourceOptions, + ShaderCacheOptions, +}; +use metal2vulkan::device::RenderLoweringPolicy; +use std::path::Path; + +/// A device of the kind the cfg selects that lowers render calls as `lowering` says, its shader +/// cache in `cache`. +fn device(cache: &Path, lowering: RenderLoweringPolicy) -> Device { + let mut options = DeviceOptions { + kinds: match cfg!(m2v_cpu_icd) { + true => vec![DeviceKind::Cpu], + false => vec![ + DeviceKind::Discrete, + DeviceKind::Integrated, + DeviceKind::Virtual, + ], + }, + shader_cache: ShaderCacheOptions { + directory: Some(cache.to_owned()), + ..ShaderCacheOptions::default() + }, + ..DeviceOptions::default() + }; + options.policy.render_lowering = lowering; + Device::system_default_with(&options).unwrap() +} + +#[test] +fn labels_read_back_and_each_ended_encoder_keeps_its_own() { + for lowering in [RenderLoweringPolicy::AtCall, RenderLoweringPolicy::Worker] { + let scratch = Scratch::new(); + let device = device(&scratch.0, lowering); + let queue = device.new_command_queue().unwrap(); + let filled = device.new_buffer(4096, ResourceOptions::private()).unwrap(); + let command_buffer = queue.command_buffer().unwrap(); + assert_eq!(command_buffer.label(), None); + command_buffer.set_label("frame"); + assert_eq!(command_buffer.label().as_deref(), Some("frame")); + let mut blit = command_buffer.blit_command_encoder().unwrap(); + assert_eq!(blit.label(), None); + blit.set_label("fill"); + assert_eq!(blit.label().as_deref(), Some("fill")); + blit.fill_buffer(&filled, 0..4096, 1).unwrap(); + blit.end_encoding().unwrap(); + let mut pass = RenderPassDescriptor::new(); + pass.render_target_width = 1; + pass.render_target_height = 1; + pass.default_raster_sample_count = 1; + let mut render = command_buffer.render_command_encoder(&pass).unwrap(); + assert_eq!(render.label(), None, "{lowering:?}"); + render.set_label("pass"); + assert_eq!(render.label().as_deref(), Some("pass"), "{lowering:?}"); + render.end_encoding().unwrap(); + let compute = command_buffer.compute_command_encoder().unwrap(); + assert_eq!(compute.label(), None, "{lowering:?}"); + compute.end_encoding().unwrap(); + let ended: Vec<_> = (command_buffer.ended_encoders().into_iter()) + .map(|encoder| (encoder.kind, encoder.label)) + .collect(); + let labeled = |label: &str| Some(label.to_owned()); + assert_eq!( + ended, + [ + (EncoderKind::Blit, labeled("fill")), + (EncoderKind::Render, labeled("pass")), + (EncoderKind::Compute, None), + ], + "{lowering:?}" + ); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.label().as_deref(), Some("frame")); + } +} diff --git a/crates/metal2vulkan-runtime/src/tests/mod.rs b/crates/metal2vulkan-runtime/src/tests/mod.rs index 81483c4f7..4d7ab6cc0 100644 --- a/crates/metal2vulkan-runtime/src/tests/mod.rs +++ b/crates/metal2vulkan-runtime/src/tests/mod.rs @@ -346,6 +346,8 @@ mod kept_variants; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod kernel_end_device; #[cfg(any(m2v_gpu, m2v_cpu_icd))] +mod labels; +#[cfg(any(m2v_gpu, m2v_cpu_icd))] mod layer_claim; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod learned_coverage; diff --git a/crates/metal2vulkan-runtime/src/used_resources.rs b/crates/metal2vulkan-runtime/src/used_resources.rs index cc823d91e..da125cf98 100644 --- a/crates/metal2vulkan-runtime/src/used_resources.rs +++ b/crates/metal2vulkan-runtime/src/used_resources.rs @@ -81,6 +81,8 @@ pub enum EncoderKind { pub struct EndedEncoder { /// Its kind. pub kind: EncoderKind, + /// Its label (`MTLCommandEncoder.label`) as it ended, where the program set one. + pub label: Option, /// The event waits (`encode_wait_for_event`) the command buffer encoded before it, each /// call counted: one encoder has more than the encoder before it where a wait lies between /// them. @@ -100,6 +102,8 @@ pub struct EndedEncoder { /// ([`CommandBuffer::ended_encoders`]). pub(super) struct EncoderRecord { pub(super) kind: EncoderKind, + /// Its label as it ended, where the program set one (`command_buffer/labels.rs`). + pub(super) label: Option, pub(super) event_waits_before: usize, pub(super) event_signals_before: usize, /// The keys its commands' uses and bindings named, and its placed segments'. @@ -503,6 +507,7 @@ impl Listing { /// (`State::read_ended`). pub(super) struct ReadRecord { pub(super) kind: EncoderKind, + pub(super) label: Option, pub(super) event_waits_before: usize, pub(super) event_signals_before: usize, /// Every key its commands use and reach. @@ -556,7 +561,7 @@ impl CommandBuffer { } /// Its ended encoders, in the order they ended (the numbering of - /// [`CommitFailure`](super::CommitFailure)'s encoders), each with its kind, the event waits + /// [`CommitFailure`](super::CommitFailure)'s encoders), each with its kind, its label, the event waits /// and signals encoded before it, and what its own commands use, listed as /// [`used_resources`](Self::used_resources) lists the command buffer's: a runtime extension, /// no Metal call (docs/API.md, "What a command buffer uses"). Metal splits a command buffer @@ -576,6 +581,7 @@ impl CommandBuffer { .iter() .map(|record| EndedEncoder { kind: record.kind, + label: record.label.clone(), event_waits_before: record.event_waits_before, event_signals_before: record.event_signals_before, used_resources: record.listing(shared), diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index aa1ce6082..5b89559b4 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -2180,6 +2180,7 @@ field metal2vulkan-runtime::EncoderCall.selector pub selector: &'static str field metal2vulkan-runtime::EndedEncoder.event_signals_before pub event_signals_before: usize field metal2vulkan-runtime::EndedEncoder.event_waits_before pub event_waits_before: usize field metal2vulkan-runtime::EndedEncoder.kind pub kind: EncoderKind +field metal2vulkan-runtime::EndedEncoder.label pub label: Option field metal2vulkan-runtime::EndedEncoder.used_resources pub used_resources: UsedResources field metal2vulkan-runtime::ExecutedCommand.can_encode_indirect_commands pub can_encode_indirect_commands: bool field metal2vulkan-runtime::ExecutedCommand.index pub index: u64 @@ -3397,8 +3398,8 @@ field metal2vulkan-runtime::WorkCounts.slot_wait_nanos pub slot_wait_nanos: u64 field metal2vulkan-runtime::WorkCounts.slot_waits pub slot_waits: u64 field metal2vulkan-runtime::WorkCounts.snapshot_inline_splits pub snapshot_inline_splits: u64 field metal2vulkan-runtime::WorkCounts.spare_command_buffers_freed_past_held pub spare_command_buffers_freed_past_held: u64 -field metal2vulkan-runtime::WorkCounts.spare_command_buffers_freed_past_recorded pub spare_command_buffers_freed_past_recorded: u64 field metal2vulkan-runtime::WorkCounts.spare_command_buffers_freed_past_recent_uses pub spare_command_buffers_freed_past_recent_uses: u64 +field metal2vulkan-runtime::WorkCounts.spare_command_buffers_freed_past_recorded pub spare_command_buffers_freed_past_recorded: u64 field metal2vulkan-runtime::WorkCounts.spare_command_buffers_shed pub spare_command_buffers_shed: u64 field metal2vulkan-runtime::WorkCounts.spare_command_pool_trims pub spare_command_pool_trims: u64 field metal2vulkan-runtime::WorkCounts.spare_command_pools_reset pub spare_command_pools_reset: u64 @@ -8161,12 +8162,14 @@ method metal2vulkan-runtime::BlitCommandEncoder::fill_texture_color pub fn fill_ method metal2vulkan-runtime::BlitCommandEncoder::generate_mipmaps pub fn generate_mipmaps(&mut self, texture: &Texture) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::invalidate_compressed_texture pub fn invalidate_compressed_texture(&mut self, texture: &Texture) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::invalidate_compressed_texture_slice pub fn invalidate_compressed_texture_slice(&mut self, texture: &Texture, slice: u64, level: u64) -> Result<(), Error> +method metal2vulkan-runtime::BlitCommandEncoder::label pub fn label(&self) -> Option method metal2vulkan-runtime::BlitCommandEncoder::optimize_contents_for_cpu_access pub fn optimize_contents_for_cpu_access(&mut self, texture: &Texture) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::optimize_contents_for_cpu_access_slice_level pub fn optimize_contents_for_cpu_access_slice_level(&mut self, texture: &Texture, slice: u64, level: u64) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::optimize_contents_for_gpu_access pub fn optimize_contents_for_gpu_access(&mut self, texture: &Texture) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::optimize_contents_for_gpu_access_slice_level pub fn optimize_contents_for_gpu_access_slice_level(&mut self, texture: &Texture, slice: u64, level: u64) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::optimize_indirect_command_buffer pub fn optimize_indirect_command_buffer(&mut self, buffer: &IndirectCommandBuffer, range: Range) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::reset_commands_in_buffer pub fn reset_commands_in_buffer(&mut self, buffer: &IndirectCommandBuffer, range: Range) -> Result<(), Error> +method metal2vulkan-runtime::BlitCommandEncoder::set_label pub fn set_label(&mut self, label: &str) method metal2vulkan-runtime::BlitCommandEncoder::synchronize_resource pub fn synchronize_resource(&mut self, resource: ResourceRef<'_>) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::synchronize_texture pub fn synchronize_texture(&mut self, texture: &Texture, slice: u64, level: u64) -> Result<(), Error> method metal2vulkan-runtime::BlitCommandEncoder::update_fence pub fn update_fence(&mut self, fence: &Fence) -> Result<(), Error> @@ -8244,10 +8247,12 @@ method metal2vulkan-runtime::CommandBuffer::gpu_end_time pub fn gpu_end_time(&se method metal2vulkan-runtime::CommandBuffer::gpu_start_time pub fn gpu_start_time(&self) -> Result method metal2vulkan-runtime::CommandBuffer::kernel_end_time pub fn kernel_end_time(&self) -> f64 method metal2vulkan-runtime::CommandBuffer::kernel_start_time pub fn kernel_start_time(&self) -> f64 +method metal2vulkan-runtime::CommandBuffer::label pub fn label(&self) -> Option method metal2vulkan-runtime::CommandBuffer::object_id pub fn object_id(&self) -> ObjectId method metal2vulkan-runtime::CommandBuffer::refusal pub fn refusal(&self) -> Option method metal2vulkan-runtime::CommandBuffer::render_command_encoder pub fn render_command_encoder(&self, descriptor: &RenderPassDescriptor) -> Result method metal2vulkan-runtime::CommandBuffer::resource_state_command_encoder pub fn resource_state_command_encoder(&self) -> Result +method metal2vulkan-runtime::CommandBuffer::set_label pub fn set_label(&self, label: &str) method metal2vulkan-runtime::CommandBuffer::set_protection_options pub fn set_protection_options(&self, options: u64) -> Result<(), Error> method metal2vulkan-runtime::CommandBuffer::set_submission_check pub fn set_submission_check(&self, check: SubmissionCheck) -> Result<(), Error> method metal2vulkan-runtime::CommandBuffer::status pub fn status(&self) -> CommandBufferStatus @@ -8284,6 +8289,7 @@ method metal2vulkan-runtime::ComputeCommandEncoder::execute_commands_in_buffer_c method metal2vulkan-runtime::ComputeCommandEncoder::execute_commands_in_buffer_indirect pub fn execute_commands_in_buffer_indirect(&mut self, icb: &IndirectCommandBuffer, range_buffer: &Buffer, offset: u64) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::execute_commands_in_buffer_indirect_checked pub fn execute_commands_in_buffer_indirect_checked(&mut self, icb: &IndirectCommandBuffer, range_buffer: &Buffer, offset: u64, check: IndirectCommandCheck, needs: IndirectCommandCheckNeeds) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::insert_compressed_texture_reinterpretation_flush pub fn insert_compressed_texture_reinterpretation_flush(&mut self) +method metal2vulkan-runtime::ComputeCommandEncoder::label pub fn label(&self) -> Option method metal2vulkan-runtime::ComputeCommandEncoder::memory_barrier_with_resources pub fn memory_barrier_with_resources(&mut self, resources: &[ResourceRef<'_>]) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::memory_barrier_with_scope pub fn memory_barrier_with_scope(&mut self, scope: BarrierScope) method metal2vulkan-runtime::ComputeCommandEncoder::set_buffer pub fn set_buffer(&mut self, buffer: Option<&Buffer>, offset: u64, index: u32) -> Result<(), Error> @@ -8296,6 +8302,7 @@ method metal2vulkan-runtime::ComputeCommandEncoder::set_bytes pub fn set_bytes(& method metal2vulkan-runtime::ComputeCommandEncoder::set_bytes_with_stride pub fn set_bytes_with_stride(&mut self, bytes: &[u8], stride: u64, index: u32) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::set_compute_pipeline_state pub fn set_compute_pipeline_state(&mut self, state: &ComputePipelineState) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::set_imageblock_size pub fn set_imageblock_size(&mut self, width: u64, height: u64) -> Result<(), Error> +method metal2vulkan-runtime::ComputeCommandEncoder::set_label pub fn set_label(&mut self, label: &str) method metal2vulkan-runtime::ComputeCommandEncoder::set_sampler_state pub fn set_sampler_state(&mut self, sampler: Option<&SamplerState>, index: u32) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::set_sampler_state_with_lod_clamps pub fn set_sampler_state_with_lod_clamps(&mut self, sampler: Option<&SamplerState>, lod_min_clamp: f32, lod_max_clamp: f32, index: u32) -> Result<(), Error> method metal2vulkan-runtime::ComputeCommandEncoder::set_sampler_states pub fn set_sampler_states(&mut self, samplers: &[Option<&SamplerState>], first: u32) -> Result<(), Error> @@ -8725,6 +8732,7 @@ method metal2vulkan-runtime::RenderCommandEncoder::execute_commands_in_buffer pu method metal2vulkan-runtime::RenderCommandEncoder::execute_commands_in_buffer_checked pub fn execute_commands_in_buffer_checked(&mut self, icb: &IndirectCommandBuffer, range: Range, check: IndirectCommandCheck, needs: IndirectCommandCheckNeeds) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::execute_commands_in_buffer_indirect pub fn execute_commands_in_buffer_indirect(&mut self, icb: &IndirectCommandBuffer, range_buffer: &Buffer, offset: u64) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::execute_commands_in_buffer_indirect_checked pub fn execute_commands_in_buffer_indirect_checked(&mut self, icb: &IndirectCommandBuffer, range_buffer: &Buffer, offset: u64, check: IndirectCommandCheck, needs: IndirectCommandCheckNeeds) -> Result<(), Error> +method metal2vulkan-runtime::RenderCommandEncoder::label pub fn label(&self) -> Option method metal2vulkan-runtime::RenderCommandEncoder::memory_barrier_with_resources pub fn memory_barrier_with_resources(&mut self, resources: &[ResourceRef<'_>], after_stages: RenderStages, before_stages: RenderStages) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::memory_barrier_with_scope pub fn memory_barrier_with_scope(&mut self, scope: BarrierScope, after_stages: RenderStages, before_stages: RenderStages) method metal2vulkan-runtime::RenderCommandEncoder::set_alpha_test_reference_value pub fn set_alpha_test_reference_value(&mut self, value: f32) -> Result<(), Error> @@ -8751,6 +8759,7 @@ method metal2vulkan-runtime::RenderCommandEncoder::set_fragment_textures pub fn method metal2vulkan-runtime::RenderCommandEncoder::set_fragment_visible_function_table pub fn set_fragment_visible_function_table(&mut self, table: Option<&VisibleFunctionTable>, index: u32) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::set_fragment_visible_function_tables pub fn set_fragment_visible_function_tables(&mut self, tables: &[Option<&VisibleFunctionTable>], first: u32) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::set_front_facing_winding pub fn set_front_facing_winding(&mut self, winding: Winding) +method metal2vulkan-runtime::RenderCommandEncoder::set_label pub fn set_label(&mut self, label: &str) method metal2vulkan-runtime::RenderCommandEncoder::set_line_width pub fn set_line_width(&mut self, width: f32) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::set_mesh_buffer pub fn set_mesh_buffer(&mut self, buffer: Option<&Buffer>, offset: u64, index: u32) -> Result<(), Error> method metal2vulkan-runtime::RenderCommandEncoder::set_mesh_buffer_offset pub fn set_mesh_buffer_offset(&mut self, offset: u64, index: u32) -> Result<(), Error> @@ -8872,7 +8881,9 @@ method metal2vulkan-runtime::ResourceOptions::raw pub fn raw(self) -> u64 method metal2vulkan-runtime::ResourceOptions::shared pub fn shared() -> ResourceOptions method metal2vulkan-runtime::ResourceOptions::storage_mode pub fn storage_mode(self) -> Result method metal2vulkan-runtime::ResourceStateCommandEncoder::end_encoding pub fn end_encoding(self) -> Result<(), Error> +method metal2vulkan-runtime::ResourceStateCommandEncoder::label pub fn label(&self) -> Option method metal2vulkan-runtime::ResourceStateCommandEncoder::move_texture_mappings pub fn move_texture_mappings(&mut self, source: &Texture, source_slice: u64, source_level: u64, source_origin: Origin, source_size: Size, destination: &Texture, destination_slice: u64, destination_level: u64, destination_origin: Origin) -> Result<(), Error> +method metal2vulkan-runtime::ResourceStateCommandEncoder::set_label pub fn set_label(&mut self, label: &str) method metal2vulkan-runtime::ResourceStateCommandEncoder::update_fence pub fn update_fence(&mut self, fence: &Fence) -> Result<(), Error> method metal2vulkan-runtime::ResourceStateCommandEncoder::update_texture_mapping pub fn update_texture_mapping(&mut self, texture: &Texture, mode: TileMapping, region: Region, level: u64, slice: u64) -> Result<(), Error> method metal2vulkan-runtime::ResourceStateCommandEncoder::update_texture_mapping_indirect pub fn update_texture_mapping_indirect(&mut self, texture: &Texture, mode: TileMapping, indirect_buffer: &Buffer, indirect_buffer_offset: u64) -> Result<(), Error> diff --git a/docs/API.md b/docs/API.md index 49c92e2e3..583142786 100644 --- a/docs/API.md +++ b/docs/API.md @@ -3630,7 +3630,9 @@ bound. (`GpuRecoveryVictim`), and every later call of the device and of its command queues goes to the new `VkDevice`; a queue's lent `VkQueue` (`CommandQueue::with_vk_queue`) comes with the `VkDevice` it belongs to, the new one from then on. Announced at each recovery, by the call that made it; the reason names the hang's - command buffer (an inference, said so, where two or more `VkQueue`s had work in flight), how + command buffer (an inference, said so, where two or more `VkQueue`s had work in flight) by its + label and its queue's, with its first 32 ended encoders' places, kinds and labels + (`CommandBuffer::set_label`, each encoder's `set_label`), how long the recovery took, and the objects it carried to the new `VkDevice` and left refused, by kind. Announced too, at most once each per recovery whatever an earlier recovery announced: where a call waited past 10 seconds for the recovery under way, where its diff --git a/docs/CONFORMANCE-COVERAGE.md b/docs/CONFORMANCE-COVERAGE.md index 277cd7741..b8449e29c 100644 --- a/docs/CONFORMANCE-COVERAGE.md +++ b/docs/CONFORMANCE-COVERAGE.md @@ -32,12 +32,12 @@ Its limits, measured rather than asserted: | | | |---|---| -| implemented Metal items | 979 | +| implemented Metal items | 981 | | of those, unreachable: `objc2-metal` binds no name for them | 3 | -| so reachable by some case | 976 | +| so reachable by some case | 978 | | of the reachable, exercised by the suite's Metal leg | 815 | -| of the reachable, not exercised | 161 | -| share of the reachable exercised | 84% | +| of the reachable, not exercised | 163 | +| share of the reachable exercised | 83% | | of those exercised, no case reaching it loosens anything | 572 | | of those exercised, a case reaching it loosens some site | 243 | | case modules | 165 | @@ -383,6 +383,8 @@ Every container with an implemented item, by how much of it the suite reaches. * | `MTLSharedEventListener` | 2 | 0 | 0 | 2 | | | `MTLAttributeDescriptorArray` | 3 | 0 | 2 | 1 | `attribute_formats`, `attribute_strides`, `blit_indirect_commands`, `indirect_command_depth`… | | `MTLBufferLayoutDescriptorArray` | 3 | 0 | 2 | 1 | `attribute_formats`, `attribute_strides`, `blit_indirect_commands`, `indirect_command_depth`… | +| `MTLCommandBuffer` | 22 | 0 | 21 | 1 | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`… | +| `MTLCommandEncoder` | 3 | 0 | 2 | 1 | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`… | | `MTLComputePipelineReflection` | 3 | 0 | 2 | 1 | `function_bindings`, `pipeline_option_reflection`, `pipeline_options` | | `MTLFunction` | 12 | 0 | 11 | 1 | `argument_encoder_crossings`, `argument_encoders`, `compute_pipeline_descriptors`, `function_facts`… | | `MTLFunctionConstantValues` | 5 | 0 | 4 | 1 | `function_facts`, `library_facts` | @@ -410,8 +412,6 @@ Every container with an implemented item, by how much of it the suite reaches. * | `MTLBlitCommandEncoder` | 22 | 0 | 22 | 0 | `blend_interactions`, `blend_sweeps`, `blit_encoder_commands`, `blit_indirect_commands`… | | `MTLBufferBinding` | 6 | 0 | 6 | 0 | `fragment_imageblock_reflection`, `function_bindings`, `mesh_pipeline_reflection`, `pipeline_option_reflection`… | | `MTLBufferLayoutDescriptor` | 4 | 0 | 4 | 0 | `attribute_formats`, `attribute_strides`, `blit_indirect_commands`, `indirect_command_depth`… | -| `MTLCommandBuffer` | 21 | 0 | 21 | 0 | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`… | -| `MTLCommandEncoder` | 2 | 0 | 2 | 0 | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`… | | `MTLCommandQueue` | 4 | 0 | 4 | 0 | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`… | | `MTLComputePipelineDescriptor` | 16 | 0 | 16 | 0 | `attribute_formats`, `attribute_strides`, `binary_archives`, `blit_indirect_commands`… | | `MTLDepthStencilDescriptor` | 5 | 0 | 5 | 0 | `depth_resolve_pairs`, `depth_stencil_space`, `layered_targets`, `pass_sequence_actions`… | @@ -484,6 +484,8 @@ A container is one Objective-C type; the SDK header it sits in is the family of | `MTLVertexDescriptor.h` | 19 | 16 | 3 | | `MTLBuffer.h` | 6 | 4 | 2 | | `MTLIndirectCommandBuffer.h` | 26 | 24 | 2 | +| `MTLCommandBuffer.h` | 22 | 21 | 1 | +| `MTLCommandEncoder.h` | 3 | 2 | 1 | | `MTLFunctionConstantValues.h` | 5 | 4 | 1 | | `MTLPipeline.h` | 5 | 4 | 1 | | `MTLRenderPass.h` | 42 | 41 | 1 | @@ -492,8 +494,6 @@ A container is one Objective-C type; the SDK header it sits in is the family of | `MTLArgumentEncoder.h` | 23 | 23 | 0 | | `MTLBinaryArchive.h` | 10 | 10 | 0 | | `MTLBlitCommandEncoder.h` | 22 | 22 | 0 | -| `MTLCommandBuffer.h` | 21 | 21 | 0 | -| `MTLCommandEncoder.h` | 2 | 2 | 0 | | `MTLCommandQueue.h` | 4 | 4 | 0 | | `MTLDynamicLibrary.h` | 5 | 5 | 0 | | `MTLFunctionDescriptor.h` | 5 | 5 | 0 | @@ -960,6 +960,7 @@ One row per implemented item of the SDK, in the coverage map's order. *exercised | `MTLCommandBuffer` | yes | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`, `attribute_strides`, `blend_interactions`, `blend_sweeps`, `blit_encoder_commands`, `blit_indirect_commands`, `border_swizzles`, `buffer_blits`, `buffer_depth_samples`, `buffer_tails`, `buffer_target_clears`, `buffer_texture_blits`, `buffer_textures`, `chroma_pairs`, `color_write_masks`, `command_buffer_facts`, `compressed_blits`, `compressed_decode`, `compressed_moves`, `compressed_views`, `compute_encoder_commands`, `compute_heap_residency`, `compute_render_chains`, `compute_threadgroups`, `denormal_word_fetches`, `depth_resolve_pairs`, `depth_stencil_space`, `depth_texel_reads`, `discard_hoist`, `draw_state_changes`, `empty_command_buffers`, `etc_textures`, `event_orders`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_planes`, `extended_range_targets`, `extended_range_two_planes`, `extended_swizzles`, `fetch_ordered`, `format_copies`, `frame_chains`, `fresh_contents`, `half_output_blends`, `half_read_nans`, `half_storage_writes`, `half_texel_nans`, `half_write_nans`, `host_detach`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `level_sizes`, `math_routines`, `mesh_barriers`, `mesh_commands`, `mesh_draws`, `mesh_partial_barriers`, `nearest_positions`, `norm_storage_writes`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_bytes`, `pass_sequence_actions`, `pass_start_reads`, `pixel_downscales`, `pixel_samplers`, `primitive_type_crossings`, `pvrtc_cpu_order`, `pvrtc_rows`, `read_through`, `read_write_tiers`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_residency`, `render_state`, `rgb10a2_srgb`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_crossings`, `sampler_filtering`, `scheduled_handlers`, `shader_stencil`, `shared_events`, `shared_exponent_storage`, `simdgroup_lockstep`, `snorm_tile_store`, `sparse_mappings`, `srgb_fetch`, `stage_in_regions`, `stage_in_unread`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `swizzled_storage`, `tessellation_crossings`, `tessellation_sweeps`, `texel_swizzles`, `texture_buffer_tails`, `texture_fills`, `tile_threadgroups`, `topology_classes`, `two_plane_copies`, `two_plane_heap_blits`, `two_plane_samples`, `vertex_attribute_strides`, `vertex_fetch_reach`, `vertex_formats`, `visibility`, `visible_tables`, `wide_int_attributes`, `wide_points`, `ycbcr_gathers`, `ycbcr_minify`, `ycbcr_textures` | 884 | | `device` | yes | `command_buffer_facts` | 1 | | `commandQueue` | yes | `command_buffer_facts` | 1 | +| `label` | no | — | — | | `kernelStartTime` | yes | `command_buffer_facts`, `empty_command_buffers` | 2 | | `kernelEndTime` | yes | `command_buffer_facts`, `empty_command_buffers` | 2 | | `GPUStartTime` | yes | `command_buffer_facts`, `empty_command_buffers` | 2 | @@ -984,6 +985,7 @@ One row per implemented item of the SDK, in the coverage map's order. *exercised | item | exercised | families | cases Metal ran | |---|---|---|---| | `MTLCommandEncoder` | yes | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`, `attribute_strides`, `blend_interactions`, `blend_sweeps`, `blit_encoder_commands`, `blit_indirect_commands`, `border_swizzles`, `buffer_blits`, `buffer_depth_samples`, `buffer_tails`, `buffer_target_clears`, `buffer_texture_blits`, `buffer_textures`, `chroma_pairs`, `color_write_masks`, `command_buffer_facts`, `compressed_blits`, `compressed_decode`, `compressed_moves`, `compressed_views`, `compute_encoder_commands`, `compute_heap_residency`, `compute_render_chains`, `compute_threadgroups`, `denormal_word_fetches`, `depth_resolve_pairs`, `depth_stencil_space`, `depth_texel_reads`, `discard_hoist`, `draw_state_changes`, `empty_command_buffers`, `etc_textures`, `event_orders`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_planes`, `extended_range_targets`, `extended_range_two_planes`, `extended_swizzles`, `fetch_ordered`, `format_copies`, `frame_chains`, `fresh_contents`, `half_output_blends`, `half_read_nans`, `half_storage_writes`, `half_texel_nans`, `half_write_nans`, `host_detach`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `level_sizes`, `math_routines`, `mesh_barriers`, `mesh_commands`, `mesh_draws`, `mesh_partial_barriers`, `nearest_positions`, `norm_storage_writes`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_bytes`, `pass_sequence_actions`, `pass_start_reads`, `pixel_downscales`, `pixel_samplers`, `primitive_type_crossings`, `pvrtc_cpu_order`, `pvrtc_rows`, `read_through`, `read_write_tiers`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_residency`, `render_state`, `rgb10a2_srgb`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_crossings`, `sampler_filtering`, `scheduled_handlers`, `shader_stencil`, `shared_exponent_storage`, `simdgroup_lockstep`, `snorm_tile_store`, `sparse_mappings`, `srgb_fetch`, `stage_in_regions`, `stage_in_unread`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `swizzled_storage`, `tessellation_crossings`, `tessellation_sweeps`, `texel_swizzles`, `texture_buffer_tails`, `texture_fills`, `tile_threadgroups`, `topology_classes`, `two_plane_copies`, `two_plane_heap_blits`, `two_plane_samples`, `vertex_attribute_strides`, `vertex_fetch_reach`, `vertex_formats`, `visibility`, `visible_tables`, `wide_int_attributes`, `wide_points`, `ycbcr_gathers`, `ycbcr_minify`, `ycbcr_textures` | 882 | +| `label` | no | — | — | | `endEncoding` | yes | `alpha_coverage_pairs`, `argument_encoders`, `astc_textures`, `attribute_formats`, `attribute_strides`, `blend_interactions`, `blend_sweeps`, `blit_encoder_commands`, `blit_indirect_commands`, `border_swizzles`, `buffer_blits`, `buffer_depth_samples`, `buffer_tails`, `buffer_target_clears`, `buffer_texture_blits`, `buffer_textures`, `chroma_pairs`, `color_write_masks`, `command_buffer_facts`, `compressed_blits`, `compressed_decode`, `compressed_moves`, `compressed_views`, `compute_encoder_commands`, `compute_heap_residency`, `compute_render_chains`, `compute_threadgroups`, `denormal_word_fetches`, `depth_resolve_pairs`, `depth_stencil_space`, `depth_texel_reads`, `discard_hoist`, `draw_state_changes`, `empty_command_buffers`, `etc_textures`, `event_orders`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_planes`, `extended_range_targets`, `extended_range_two_planes`, `extended_swizzles`, `fetch_ordered`, `format_copies`, `frame_chains`, `fresh_contents`, `half_output_blends`, `half_read_nans`, `half_storage_writes`, `half_texel_nans`, `half_write_nans`, `host_detach`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `level_sizes`, `math_routines`, `mesh_barriers`, `mesh_commands`, `mesh_draws`, `mesh_partial_barriers`, `nearest_positions`, `norm_storage_writes`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_bytes`, `pass_sequence_actions`, `pass_start_reads`, `pixel_downscales`, `pixel_samplers`, `primitive_type_crossings`, `pvrtc_cpu_order`, `pvrtc_rows`, `read_through`, `read_write_tiers`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_residency`, `render_state`, `rgb10a2_srgb`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_crossings`, `sampler_filtering`, `scheduled_handlers`, `shader_stencil`, `shared_exponent_storage`, `simdgroup_lockstep`, `snorm_tile_store`, `sparse_mappings`, `srgb_fetch`, `stage_in_regions`, `stage_in_unread`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `swizzled_storage`, `tessellation_crossings`, `tessellation_sweeps`, `texel_swizzles`, `texture_buffer_tails`, `texture_fills`, `tile_threadgroups`, `topology_classes`, `two_plane_copies`, `two_plane_heap_blits`, `two_plane_samples`, `vertex_attribute_strides`, `vertex_fetch_reach`, `vertex_formats`, `visibility`, `visible_tables`, `wide_int_attributes`, `wide_points`, `ycbcr_gathers`, `ycbcr_minify`, `ycbcr_textures` | 882 | ### `MTLCommandQueue` diff --git a/docs/METAL-COVERAGE.md b/docs/METAL-COVERAGE.md index 28f52dff7..6af90cb06 100644 --- a/docs/METAL-COVERAGE.md +++ b/docs/METAL-COVERAGE.md @@ -10,12 +10,12 @@ Every public item of the macOS 27.2 SDK (Xcode 27.2, 27B52)'s Metal headers, by | Status | Items | Of which deprecated | |---|---|---| -| implemented | 980 | 36 | -| missing | 806 | 27 | +| implemented | 982 | 36 | +| missing | 804 | 27 | | out of scope | 349 | 5 | | all | 2135 | 68 | -Implemented by the runtime: 647; by the translator's values: 333. Missing by size: S 124, M 146, L 160, XL 376. +Implemented by the runtime: 649; by the translator's values: 333. Missing by size: S 122, M 146, L 160, XL 376. ## Missing, in build order @@ -23,7 +23,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app | Group | Size | Items | Examples | |---|---|---|---| -| labels, debug groups and signposts | S | 17 | `MTLBuffer.addDebugMarker:range:`, `MTLBuffer.removeAllDebugMarkers`, `MTLCommandBuffer.label`, ... | +| labels, debug groups and signposts | S | 15 | `MTLBuffer.addDebugMarker:range:`, `MTLBuffer.removeAllDebugMarkers`, `MTLCommandBuffer.pushDebugGroup:`, ... | | command buffer options (descriptor, unretained references, `enqueue`, encoder error status) | S/M | 12 | `MTLCommandBufferDescriptor`, `MTLCommandBufferDescriptor.retainedReferences`, `MTLCommandBufferDescriptor.errorOptions`, ... | | command queue descriptor | S | 3 | `MTLCommandQueueDescriptor`, `MTLCommandQueueDescriptor.maxCommandBufferCount`, `MTLDevice.newCommandQueueWithDescriptor:` | | compute, blit and resource-state pass descriptors | S | 10 | `MTLBlitPassDescriptor`, `MTLBlitPassDescriptor.blitPassDescriptor`, `MTLCommandBuffer.computeCommandEncoderWithDescriptor:`, ... | @@ -1135,7 +1135,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app | `MTLCommandBuffer.commandQueue` | property | implemented | `CommandBuffer::command_queue` (runtime) | | `MTLCommandBuffer.retainedReferences` | property | missing | S: YES for every runtime command buffer (it retains what it uses) | | `MTLCommandBuffer.errorOptions` | property | missing | M: encoder execution status (`MTLCommandBufferErrorOptionEncoderExecutionStatus`): which encoder faulted, in the error's `encoderInfos` | -| `MTLCommandBuffer.label` | property | missing | S: a label a program sets and reads back | +| `MTLCommandBuffer.label` | property | implemented | `CommandBuffer::label, CommandBuffer::set_label` (runtime) | | `MTLCommandBuffer.kernelStartTime` | property | implemented | `CommandBuffer::kernel_start_time` (runtime) | | `MTLCommandBuffer.kernelEndTime` | property | implemented | `CommandBuffer::kernel_end_time` (runtime) | | `MTLCommandBuffer.logs` | property | missing | M: shader logging | @@ -1176,7 +1176,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app |---|---|---|---| | `MTLCommandEncoder` | protocol | implemented | `ComputeCommandEncoder` (runtime) | | `MTLCommandEncoder.device` | property | missing | S: every encoder's device | -| `MTLCommandEncoder.label` | property | missing | S: every encoder's label | +| `MTLCommandEncoder.label` | property | implemented | `BlitCommandEncoder::label, BlitCommandEncoder::set_label, ComputeCommandEncoder::label, ComputeCommandEncoder::set_label, RenderCommandEncoder::label, RenderCommandEncoder::set_label, ResourceStateCommandEncoder::label, ResourceStateCommandEncoder::set_label` (runtime) | | `MTLCommandEncoder.endEncoding` | method | implemented | `ComputeCommandEncoder::end_encoding` (runtime): each encoder's `end_encoding(self)` | | `MTLCommandEncoder.barrierAfterQueueStages:beforeStages:` | method | missing | M: a barrier between this encoder's stages and earlier work of the queue (macOS 26) | | `MTLCommandEncoder.insertDebugSignpost:` | method | missing | S: debug signposts: no effect on results | diff --git a/scripts/metal-coverage/coverage.tsv b/scripts/metal-coverage/coverage.tsv index a32ecba88..9b17e082b 100644 --- a/scripts/metal-coverage/coverage.tsv +++ b/scripts/metal-coverage/coverage.tsv @@ -853,7 +853,7 @@ MTLCommandBuffer.h MTLCommandBuffer property device I runtime CommandBuffer::de MTLCommandBuffer.h MTLCommandBuffer property commandQueue I runtime CommandBuffer::command_queue MTLCommandBuffer.h MTLCommandBuffer property retainedReferences M YES for every runtime command buffer (it retains what it uses) S cmdbuf MTLCommandBuffer.h MTLCommandBuffer property errorOptions M encoder execution status (`MTLCommandBufferErrorOptionEncoderExecutionStatus`): which encoder faulted, in the error's `encoderInfos` M cmdbuf -MTLCommandBuffer.h MTLCommandBuffer property label M a label a program sets and reads back S labels +MTLCommandBuffer.h MTLCommandBuffer property label I runtime CommandBuffer::label, CommandBuffer::set_label MTLCommandBuffer.h MTLCommandBuffer property kernelStartTime I runtime CommandBuffer::kernel_start_time MTLCommandBuffer.h MTLCommandBuffer property kernelEndTime I runtime CommandBuffer::kernel_end_time MTLCommandBuffer.h MTLCommandBuffer property logs M shader logging M logging @@ -889,7 +889,7 @@ MTLCommandBuffer.h MTLCommandBuffer method useResidencySet: M residency sets MTLCommandBuffer.h MTLCommandBuffer method useResidencySets:count: M residency sets M residency MTLCommandEncoder.h MTLCommandEncoder protocol MTLCommandEncoder I runtime ComputeCommandEncoder MTLCommandEncoder.h MTLCommandEncoder property device M every encoder's device S labels -MTLCommandEncoder.h MTLCommandEncoder property label M every encoder's label S labels +MTLCommandEncoder.h MTLCommandEncoder property label I runtime BlitCommandEncoder::label, BlitCommandEncoder::set_label, ComputeCommandEncoder::label, ComputeCommandEncoder::set_label, RenderCommandEncoder::label, RenderCommandEncoder::set_label, ResourceStateCommandEncoder::label, ResourceStateCommandEncoder::set_label MTLCommandEncoder.h MTLCommandEncoder method endEncoding I runtime ComputeCommandEncoder::end_encoding each encoder's `end_encoding(self)` MTLCommandEncoder.h MTLCommandEncoder method barrierAfterQueueStages:beforeStages: M a barrier between this encoder's stages and earlier work of the queue (macOS 26) M barriers MTLCommandEncoder.h MTLCommandEncoder method insertDebugSignpost: M debug signposts: no effect on results S labels