diff --git a/crates/metal2vulkan-runtime/src/device/mod.rs b/crates/metal2vulkan-runtime/src/device/mod.rs index 25b44cd9d..7681dbabf 100644 --- a/crates/metal2vulkan-runtime/src/device/mod.rs +++ b/crates/metal2vulkan-runtime/src/device/mod.rs @@ -1784,6 +1784,10 @@ impl Device { }; let nudge = timelines[queue_places.len()]; let queue_quiet = Arc::new(queue_quiet::QueueQuiet::default()); + // Whether the driver stalls in one signalling call of every 1024 to a queue: its calls' + // CPU time tells its stall (`submit_stalls.rs`). + let stalls = (description.driver_facts()) + .contains(&metal2vulkan::device::DriverFact::SignallingSubmitsStallEvery1024); let queues: Vec = queue_places .iter() .zip(&timelines) @@ -1792,7 +1796,7 @@ impl Device { // call after the word is put back. let queue = unsafe { loader_word.restored(|| raw.get_device_queue(family, index)) }; QueueSlot { - raw: Mutex::new((queue, submit_stalls::Period::default())), + raw: Mutex::new((queue, submit_stalls::Period::new(stalls))), stall_due: AtomicBool::new(false), family, flags: flags_of(family), diff --git a/crates/metal2vulkan-runtime/src/device/relay.rs b/crates/metal2vulkan-runtime/src/device/relay.rs index f15ddbf3a..ff2be58bc 100644 --- a/crates/metal2vulkan-runtime/src/device/relay.rs +++ b/crates/metal2vulkan-runtime/src/device/relay.rs @@ -466,6 +466,7 @@ impl super::DeviceShared { } #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] crate::command_buffer::completion::trace::submitting("submit called"); + let cpu = period.cpu_now(); let entered = crate::gpu_time::host_nanos(); let submitted = f(vk_queue); let end = crate::gpu_time::host_nanos(); @@ -473,7 +474,8 @@ impl super::DeviceShared { crate::command_buffer::completion::trace::submitting("submit returned"); let nanos = end.saturating_sub(entered); (self.counts).batch_submitted_in(nanos); - if submitted.is_ok() && period.called(Caller::Work, nanos, end) { + let took = period.took(nanos, cpu); + if submitted.is_ok() && period.called(Caller::Work, took, end) { self.counts.submit_stall_on_work(); } match (&submitted, logged) { @@ -647,10 +649,12 @@ impl<'a> QueueUses<'a> { Uses::Unknown => hold.with(f), Uses::OneSignalling => { let (used, behind) = hold.with_counted(Caller::Work, |vk_queue, period| { + let cpu = period.cpu_now(); let entered = crate::gpu_time::host_nanos(); let used = f(vk_queue); let end = crate::gpu_time::host_nanos(); - if period.called(Caller::Work, end.saturating_sub(entered), end) { + let took = period.took(end.saturating_sub(entered), cpu); + if period.called(Caller::Work, took, end) { self.counts.submit_stall_on_work(); } used diff --git a/crates/metal2vulkan-runtime/src/device/submit_stalls.rs b/crates/metal2vulkan-runtime/src/device/submit_stalls.rs index 1df6cab92..5fe091e00 100644 --- a/crates/metal2vulkan-runtime/src/device/submit_stalls.rs +++ b/crates/metal2vulkan-runtime/src/device/submit_stalls.rs @@ -20,15 +20,24 @@ //! //! - **Learnt per queue.** Each signalling call the runtime makes under a queue's lock and times //! (a batch's, a fence's with no work, the device's own submission, an empty one of the plan's) -//! is counted; one that took [`STALL_NANOS`] or more is taken as the driver's stall, and the -//! count starts again from it, unless the place is confirmed and the call is not where the -//! count puts the next stall (within [`MARGIN`] calls before it): there it is another of the -//! driver's costs. The place is confirmed once a stall came where the count put it, so a long -//! call elsewhere before then (a device's first submissions) gives way to the next stall, and -//! one after leaves the place. A use of the queue the runtime cannot count (the program's, a -//! sparse binding, a wait for its idle) forgets the count until the next stall, as does a due -//! stall that did not come: a release without the stall submits no empty submission after its -//! first miss, and none before a stall was seen. +//! is counted; one in which the calling thread spent [`STALL_NANOS`] or more of its CPU is taken +//! as the driver's stall, and the count starts again from it, unless the place is confirmed and +//! the call is not where the count puts the next stall (within [`MARGIN`] calls before it): +//! there it is another of the driver's costs. The thread's CPU time, not the call's length +//! ([`Took`]): the stall is the driver's work on the calling thread, and a call that only waits +//! that long is none. In the device test on the RTX 5080 (615.71.09), alone and beside the +//! runtime's device suite, the 10 stalls spent 1998 to 3880 us of the thread's CPU, within 0.5% +//! of their length; beside the suite, 25 to 29 other calls a run took 1.3 to 40.8 ms waiting, +//! spending 8 to 884 us of CPU. Taken by their length, those calls moved the queue's place off +//! the stalls before any came where the count put it, so no stall was due at an idle and every +//! one fell on work. The place is confirmed once a stall came where the count put it, so a long +//! call elsewhere before then (a device's first submissions, up to 4.1 ms of CPU there) gives +//! way to the next stall, and one after leaves the place. A use of the queue the runtime cannot +//! count (the program's, a sparse binding, a wait for its idle) forgets the count until the +//! next stall, as does a due stall that did not come: a release without the stall submits no +//! empty submission after its first miss, and none before a stall was seen. A queue whose +//! driver lacks the cost fact reads no CPU time, and a call's length counts its stalls there +//! (`WorkCounts::submit_stalls_on_work`). //! - **Taken while idle.** Once the scheduler's thread has had nothing to submit for //! [`IDLE_NANOS`] and a queue's next stall is due within its next burst of work (the most //! signalling calls it made between two such idles over its last [`BURSTS`], plus [`MARGIN`]), @@ -55,10 +64,11 @@ use std::sync::{Arc, Mutex}; /// The signalling calls to a `VkQueue` from one stall of the driver's to the next. pub(crate) const PERIOD: u32 = 1024; -/// A signalling call that took this long or longer, in nanoseconds, is the driver's stall where -/// the count puts it, or where the queue's place is not confirmed ([`Period::called`]): the -/// stalls measured took 1.97 ms or more (3 of 15 under 2 ms in the device test on the RTX 5080), -/// and other signalling calls up to 1.4 ms, a device's 62nd 10 ms. +/// A signalling call in which the calling thread spent this much of its CPU or more, in +/// nanoseconds ([`Took`]), is the driver's stall where the count puts it, or where the queue's +/// place is not confirmed ([`Period::called`]): the stalls measured took 1.97 ms or more (3 of 15 +/// under 2 ms in the device test on the RTX 5080), and other signalling calls up to 1.4 ms, a +/// device's 62nd 10 ms. pub(crate) const STALL_NANOS: u64 = 1_000_000; /// How long the scheduler's thread has had nothing to submit before it takes a stall due, in @@ -93,6 +103,23 @@ pub(crate) enum Uses { Unknown, } +/// A signalling call's time ([`Period::called`]): its length, and the CPU time the calling thread +/// spent in it where its queue's place is learnt from that ([`Period::cpu_now`]), each in +/// nanoseconds. +#[derive(Clone, Copy, Debug)] +pub(crate) struct Took { + pub(crate) nanos: u64, + pub(crate) cpu: Option, +} + +impl Took { + /// What the driver's stall is told by: the thread's CPU time in the call where it was read, + /// else the call's length. + fn spent(self) -> u64 { + self.cpu.unwrap_or(self.nanos) + } +} + /// Who made a signalling call to the queue. #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub(crate) enum Caller { @@ -106,6 +133,10 @@ pub(crate) enum Caller { /// Kept under the queue's lock (`QueueSlot`). #[derive(Default)] pub(crate) struct Period { + /// The driver stalls in one signalling call of every [`PERIOD`] + /// (`DriverFact::SignallingSubmitsStallEvery1024`): its calls' CPU time is read + /// ([`cpu_now`](Self::cpu_now)). Elsewhere a call's length alone is read. + stalls: bool, /// The signalling calls since the last stall seen, each counted: `None` before one is seen, /// once a use was not counted, or once a stall due did not come. since: Option, @@ -125,6 +156,28 @@ pub(crate) struct Period { } impl Period { + /// The place of a queue whose driver stalls in one signalling call of every [`PERIOD`] where + /// `stalls`, before any call. + pub(crate) fn new(stalls: bool) -> Period { + Period { + stalls, + ..Period::default() + } + } + + /// The calling thread's CPU time now, in nanoseconds, where the driver stalls: a timed call + /// reads it before itself, and [`took`](Self::took) after; elsewhere `None`, read nowhere. + pub(crate) fn cpu_now(&self) -> Option { + self.stalls.then(thread_cpu).flatten() + } + + /// What a call that took `nanos` took ([`Took`]), `cpu` the thread's CPU time + /// [`cpu_now`](Self::cpu_now) read before it: read again now. + pub(crate) fn took(&self, nanos: u64, cpu: Option) -> Took { + let cpu = (cpu.zip(self.cpu_now())).map(|(start, end)| end.saturating_sub(start)); + Took { nanos, cpu } + } + /// A use of the queue the runtime cannot count: no stall is due until one is seen. pub(crate) fn forget(&mut self) { self.since = None; @@ -140,14 +193,15 @@ impl Period { behind } - /// A signalling call of `caller`'s that took `nanos` and ended at host time `end`, in - /// nanoseconds: whether it was the driver's stall, a call of [`STALL_NANOS`] or more where - /// the count puts the next stall (the [`PERIOD`]th call since the last, or up to [`MARGIN`] - /// calls before it), which confirms the place, or anywhere while the place is not confirmed. - /// A call of work [`IDLE_NANOS`] or more after the one before begins a burst. - pub(crate) fn called(&mut self, caller: Caller, nanos: u64, end: u64) -> bool { + /// A signalling call of `caller`'s that took `took` and ended at host time `end`, in + /// nanoseconds: whether it was the driver's stall, a call that spent [`STALL_NANOS`] or more + /// ([`Took`]) where the count puts the next stall (the [`PERIOD`]th call since the last, or up + /// to [`MARGIN`] calls before it), which confirms the place, or anywhere while the place is + /// not confirmed. A call of work [`IDLE_NANOS`] or more after the one before begins a burst. + pub(crate) fn called(&mut self, caller: Caller, took: Took, end: u64) -> bool { + let nanos = took.nanos; let expected = (self.since).is_some_and(|since| since + 1 + MARGIN >= PERIOD); - let stalled = nanos >= STALL_NANOS && (expected || !self.confirmed); + let stalled = took.spent() >= STALL_NANOS && (expected || !self.confirmed); if stalled { self.confirmed = expected; } @@ -203,6 +257,29 @@ impl Period { } } +/// The calling thread's CPU time, in nanoseconds (`CLOCK_THREAD_CPUTIME_ID`); `None` where it +/// cannot be read. +fn thread_cpu() -> Option { + #[cfg(unix)] + { + let mut now = libc::timespec { + tv_sec: 0, + tv_nsec: 0, + }; + // SAFETY: `now` is a valid timespec for the call to fill. + if unsafe { libc::clock_gettime(libc::CLOCK_THREAD_CPUTIME_ID, &mut now) } != 0 { + return None; + } + let seconds = u64::try_from(now.tv_sec).ok()?; + let nanos = u64::try_from(now.tv_nsec).ok()?; + Some(seconds * 1_000_000_000 + nanos) + } + #[cfg(not(unix))] + { + None + } +} + /// `count` timeline semaphores at 0 of `raw`'s, one for each queue's empty submissions; `None` /// where the device made not all of them (it releases those it made), and then takes no stall /// idle. @@ -328,6 +405,7 @@ impl IdleStalls { .push_next(&mut timeline); let raw = self.functions.get(); let ((submitted, stalled), _) = slot.with_counted(Caller::Empty, |vk_queue, period| { + let cpu = period.cpu_now(); let start = crate::gpu_time::host_nanos(); // SAFETY: a submission of no work signalling the queue's own semaphore of the plan's // above every value it was signalled to (they rise under the plan's lock, by one @@ -335,7 +413,8 @@ impl IdleStalls { let submitted = unsafe { raw.queue_submit(vk_queue, &[info], vk::Fence::null()) }; let end = crate::gpu_time::host_nanos(); let nanos = end.saturating_sub(start); - let stalled = submitted.is_ok() && period.called(Caller::Empty, nanos, end); + let took = period.took(nanos, cpu); + let stalled = submitted.is_ok() && period.called(Caller::Empty, took, end); (submitted, stalled.then_some(nanos)) }); exit_guard::called(Guarded::QueueSubmit); diff --git a/crates/metal2vulkan-runtime/src/tests/submit_stalls.rs b/crates/metal2vulkan-runtime/src/tests/submit_stalls.rs index a028feadd..3f9b63fd2 100644 --- a/crates/metal2vulkan-runtime/src/tests/submit_stalls.rs +++ b/crates/metal2vulkan-runtime/src/tests/submit_stalls.rs @@ -2,23 +2,33 @@ //! while the scheduler is idle (`device/submit_stalls.rs`), against a model of the driver. use crate::device::submit_stalls::{ - Caller, Period, BEHIND_NANOS, IDLE_NANOS, MARGIN, MOST_EMPTY, PERIOD, STALL_NANOS, + Caller, Period, Took, BEHIND_NANOS, IDLE_NANOS, MARGIN, MOST_EMPTY, PERIOD, STALL_NANOS, }; /// The stall the RTX 5080's driver took, and its other calls' time, in nanoseconds. const STALL: u64 = 2_300_000; const CALL: u64 = 2_000; +/// A call of `nanos` that spent them all on the calling thread's CPU, as the driver's stall does. +fn spent(nanos: u64) -> Took { + Took { + nanos, + cpu: Some(nanos), + } +} + /// A driver whose every [`PERIOD`]th signalling call to the queue stalls, its first at call /// `first`, and every `early`th period `by` calls early; or none, where `stalls` is false. Its /// stalls take `stall`, and the calls of `costs` (each a call's number and its time) take long -/// elsewhere. +/// elsewhere, each on the calling thread's CPU; those of `waits` take long waiting, spending +/// [`CALL`] of it. struct Driver { calls: u64, first: u64, stalls: bool, stall: u64, costs: Vec<(u64, u64)>, + waits: Vec<(u64, u64)>, /// The call that last stalled, and the periods so far. last: Option, periods: u64, @@ -33,6 +43,7 @@ impl Driver { stalls, stall: STALL, costs: Vec::new(), + waits: Vec::new(), last: None, periods: 0, early: None, @@ -40,7 +51,7 @@ impl Driver { } /// One signalling call: its time, and whether it stalled. - fn call(&mut self) -> (u64, bool) { + fn call(&mut self) -> (Took, bool) { self.calls += 1; let period = match self.early { Some((every, by)) if (self.periods + 1).is_multiple_of(every) => u64::from(PERIOD) - by, @@ -52,14 +63,25 @@ impl Driver { Some(last) => self.calls - last >= period, }; if !stalls { - let cost = self.costs.iter().find(|(call, _)| *call == self.calls); - return (cost.map_or(CALL, |(_, took)| *took), false); + let at = |list: &[(u64, u64)]| { + list.iter() + .find(|(call, _)| *call == self.calls) + .map(|(_, took)| *took) + }; + if let Some(waited) = at(&self.waits) { + let took = Took { + nanos: waited, + cpu: Some(CALL), + }; + return (took, false); + } + return (spent(at(&self.costs).unwrap_or(CALL)), false); } if self.last.is_some() { self.periods += 1; } self.last = Some(self.calls); - (self.stall, true) + (spent(self.stall), true) } } @@ -80,7 +102,7 @@ fn frames(driver: &mut Driver, frames: u32, per_frame: u32, take: bool) -> Run { for _ in 0..frames { for _ in 0..per_frame { let (took, stalled) = driver.call(); - now += took + 15_000; + now += took.nanos + 15_000; if period.called(Caller::Work, took, now) { run.on_work += 1; } @@ -90,7 +112,7 @@ fn frames(driver: &mut Driver, frames: u32, per_frame: u32, take: bool) -> Run { if take && period.may_be_due() { for _ in 0..period.due_idle() { let (took, _) = driver.call(); - now += took; + now += took.nanos; run.empty += 1; if period.called(Caller::Empty, took, now) { run.idle += 1; @@ -150,6 +172,26 @@ fn long_calls_elsewhere_and_short_stalls_spend_no_empty_call() { assert!(with.empty <= with.idle * (25 + MARGIN), "{with:?}"); } +/// Beside other processes' GPU work, as in the runtime's device suite on the RTX 5080: calls that +/// wait milliseconds in the driver while spending little of the thread's CPU (25 to 29 a run +/// there, 1.3 to 40.8 ms each, 8 to 884 us of CPU) are no stall, so the place stays where the +/// stalls put it, and every stall after the first is taken idle as without them. Taken by their +/// length, those calls moved the place off the stalls before any came where the count put it, +/// and none was taken idle: 20 stalls on work, none idle and no empty call, as in the device +/// test's failure on the RTX 5080 beside the suite. +#[test] +fn calls_that_wait_long_beside_other_work_are_no_stall() { + let waits = [ + 300, 610, 880, 1290, 1570, 1930, 2210, 2500, 2850, 3190, 3460, 3770, 4090, 4400, 4720, + ]; + let mut driver = Driver::new(28, true); + driver.waits = waits.iter().map(|&call| (call, 1_500_000)).collect(); + let with = frames(&mut driver, 200, 25, true); + assert_eq!(with.on_work, 1, "{with:?}"); + assert!(with.idle >= 4, "{with:?}"); + assert!(with.empty <= with.idle * (25 + MARGIN), "{with:?}"); +} + /// Once a stall came where the count put it, a long call elsewhere is no stall and leaves the /// place: the next stall is still due where the count puts it. #[test] @@ -158,7 +200,7 @@ fn a_long_call_away_from_a_confirmed_place_leaves_it() { let mut now = 0; let mut call = |period: &mut Period, took: u64| { now += took + 15_000; - period.called(Caller::Work, took, now) + period.called(Caller::Work, spent(took), now) }; assert!(call(&mut period, STALL)); for _ in 0..PERIOD - 1 { @@ -194,12 +236,12 @@ fn no_stall_seen_takes_none() { #[test] fn a_stall_due_that_does_not_come_forgets_the_place() { let mut period = Period::default(); - assert!(period.called(Caller::Work, STALL, 10 * STALL)); + assert!(period.called(Caller::Work, spent(STALL), 10 * STALL)); for at in 0..PERIOD - 1 { - assert!(!period.called(Caller::Work, CALL, 20 * STALL + u64::from(at))); + assert!(!period.called(Caller::Work, spent(CALL), 20 * STALL + u64::from(at))); } assert!(period.may_be_due()); - assert!(!period.called(Caller::Work, CALL, 30 * STALL)); + assert!(!period.called(Caller::Work, spent(CALL), 30 * STALL)); assert!(!period.may_be_due()); assert_eq!(period.due_idle(), 0); } @@ -208,9 +250,9 @@ fn a_stall_due_that_does_not_come_forgets_the_place() { #[test] fn an_uncounted_use_forgets_the_place() { let mut period = Period::default(); - period.called(Caller::Work, STALL, STALL); + period.called(Caller::Work, spent(STALL), STALL); for at in 0..PERIOD - 10 { - period.called(Caller::Work, CALL, STALL + 15_000 * u64::from(at)); + period.called(Caller::Work, spent(CALL), STALL + 15_000 * u64::from(at)); } assert!(period.may_be_due()); period.forget(); @@ -227,11 +269,11 @@ fn a_stall_is_taken_within_the_next_burst() { *now += 2 * IDLE_NANOS; for _ in 0..calls { *now += 15_000; - period.called(Caller::Work, CALL, *now); + period.called(Caller::Work, spent(CALL), *now); } }; let (mut period, mut now) = (Period::default(), 0); - period.called(Caller::Work, STALL, STALL); + period.called(Caller::Work, spent(STALL), STALL); // 38 bursts of 25 after the stall (the first with the stall's call): 950 calls since, 74 // left. for _ in 0..38 { @@ -246,7 +288,7 @@ fn a_stall_is_taken_within_the_next_burst() { ); // Bursts larger than the most: due within `MOST_EMPTY` calls alone. let (mut period, mut now) = (Period::default(), 0); - period.called(Caller::Work, STALL, STALL); + period.called(Caller::Work, spent(STALL), STALL); burst(&mut period, 700, &mut now); assert_eq!(period.due_idle(), 0, "324 left"); burst(&mut period, 200, &mut now); @@ -257,33 +299,39 @@ fn a_stall_is_taken_within_the_next_burst() { #[test] fn an_idle_splits_bursts() { let (mut period, mut now) = (Period::default(), 0); - period.called(Caller::Work, STALL, STALL); + period.called(Caller::Work, spent(STALL), STALL); for _ in 0..1000 { now += 15_000; - period.called(Caller::Work, CALL, now); + period.called(Caller::Work, spent(CALL), now); } // One burst of 1001 calls: 24 left, within the most. assert_eq!(period.due_idle(), 24); let (mut period, mut now) = (Period::default(), 0); - period.called(Caller::Work, STALL, STALL); + period.called(Caller::Work, spent(STALL), STALL); for at in 0..924 { now += match at % 10 { 0 => 2 * IDLE_NANOS, _ => 15_000, }; - period.called(Caller::Work, CALL, now); + period.called(Caller::Work, spent(CALL), now); } // Bursts of 10 (the first with the stall's, 11): 100 left, past 11 + the margin. assert_eq!(period.due_idle(), 0); } -/// A call under `STALL_NANOS` is no stall, whatever its length. +/// A call that spends under `STALL_NANOS` of its thread's CPU is no stall, whatever its length: +/// one that waits 10 ms, spending a microsecond under it, is none; one that spends it all is. #[test] fn a_long_call_short_of_a_stall_is_none() { let mut period = Period::default(); - assert!(!period.called(Caller::Work, STALL_NANOS - 1, STALL_NANOS)); + assert!(!period.called(Caller::Work, spent(STALL_NANOS - 1), STALL_NANOS)); + let waited = Took { + nanos: 10 * STALL_NANOS, + cpu: Some(STALL_NANOS - 1), + }; + assert!(!period.called(Caller::Work, waited, 12 * STALL_NANOS)); assert!(!period.may_be_due()); - assert!(period.called(Caller::Work, STALL_NANOS, 3 * STALL_NANOS)); + assert!(period.called(Caller::Work, spent(STALL_NANOS), 14 * STALL_NANOS)); } /// The call that takes the queue's lock next waited behind a stall taken idle where an empty @@ -292,11 +340,11 @@ fn a_long_call_short_of_a_stall_is_none() { #[test] fn a_wait_behind_a_stall_taken_idle_is_counted_once() { let mut period = Period::default(); - period.called(Caller::Empty, STALL, STALL); + period.called(Caller::Empty, spent(STALL), STALL); assert_eq!(period.entered(BEHIND_NANOS - 1), None); - period.called(Caller::Empty, STALL, 2 * STALL); + period.called(Caller::Empty, spent(STALL), 2 * STALL); assert_eq!(period.entered(STALL / 2), Some(STALL / 2)); assert_eq!(period.entered(STALL / 2), None); - period.called(Caller::Work, STALL, 3 * STALL); + period.called(Caller::Work, spent(STALL), 3 * STALL); assert_eq!(period.entered(STALL / 2), None); } diff --git a/crates/metal2vulkan-runtime/src/tests/submit_stalls_idle.rs b/crates/metal2vulkan-runtime/src/tests/submit_stalls_idle.rs index 4308ec46a..f1f9fcf15 100644 --- a/crates/metal2vulkan-runtime/src/tests/submit_stalls_idle.rs +++ b/crates/metal2vulkan-runtime/src/tests/submit_stalls_idle.rs @@ -10,8 +10,10 @@ use metal2vulkan::device::DriverFact; use std::path::PathBuf; use std::time::Duration; -/// The frames, and each frame's command buffers: about five of the driver's periods of 1024 -/// signalling submissions, at the 25 command buffers a frame `host_ab present` commits. +/// The frames, and each frame's command buffers, at the 25 command buffers a frame `host_ab +/// present` commits: about five of the driver's periods of 1024 signalling submissions where each +/// batch takes a call of its own, about two on the RTX 5080, where the scheduler merges the +/// batches it finds ready together (2190 to 2500 signalling calls a run there). const FRAMES: u32 = 200; const PER_FRAME: u32 = 25; diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index d602b009d..16ee56358 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -90,7 +90,7 @@ known. The rest of the differences are docs/API.md section 9's precision notes. | Float simdgroup reductions sum in the device's association order. | Apple's order is not modelled. | `ReductionOrder` (`reduction-order`) | | A vertex or fragment function keeps more than 16 KiB a thread of private memory, up to the 192 KiB Metal holds, on a device whose Function storage was not measured: it runs on the driver's scratch, which past what the driver holds answers wrongly or hangs the GPU with no error. | Vulkan states no amount of Function storage; only a measurement of the device does. No other form is exact: a fragment function's helper invocations may not write the memory it would move to, and a vertex function's, a compute pre-pass, is not built. | `FunctionStorageAssumed` (`function-storage-assumed`) | | A render pipeline of more color attachments than the device draws at once (the lesser of `maxColorAttachments` and `maxFragmentOutputAttachments`, four at Vulkan's floor; Metal takes eight) draws each draw once per group of that many, each group in a render pass of its own over a twin of the pass's depth and stencil. Every variant's vertex stage is one module, `Position` invariant, and every fragment variant's `FragDepth`, `SampleMask` and `FragStencilRefEXT` are `Invariant`; groups past the first may differ at discard or depth edges if the driver compiles the variants differently. | The device holds no more attachments in one subpass. Vulkan's invariance rules make only identical pipelines repeat exactly, and the groups' fragment modules and attachments differ. | `ColorAttachmentGroups` (`color-attachment-groups`) | -| On NVIDIA's driver (615.71.09 on an RTX 5080 Laptop GPU) one `vkQueueSubmit` in every 1024 that signal on a `VkQueue` takes 2 to 4 ms in the driver (1.97 to 4.06 ms measured), which holds the command buffer whose batch it falls on, and the ones committed behind it, from the GPU that long. | The cost is the driver's, and every batch signals its completion. The scheduler's thread takes the stall while idle, by empty submissions, once one was seen (`DriverFact::SignallingSubmitsStallEvery1024`, `device/submit_stalls.rs`; a call of 1 ms or more, and once one came where the count put it, only there): it falls on work only before then, after a use of the queue the runtime cannot count, or on a queue that never idles 1 ms. Whether the driver's stall also holds other threads' semaphore calls is unsettled: a probe polling the timeline from a second thread during 10 stalls saw 5 of its 9 slow calls (up to 7.1 ms) overlap one in one run, and none of its 3 in another; in `host_ab present` the completion handlers of command buffers that completed during a stall taken idle ran 126 us (p50, 341 at most) after their GPU end, as elsewhere. | None (timing only; `WorkCounts::submit_stalls_on_work`, `WorkCounts::submit_stalls_idle`) | +| On NVIDIA's driver (615.71.09 on an RTX 5080 Laptop GPU) one `vkQueueSubmit` in every 1024 that signal on a `VkQueue` takes 2 to 4 ms in the driver (1.97 to 4.06 ms measured), which holds the command buffer whose batch it falls on, and the ones committed behind it, from the GPU that long. | The cost is the driver's, and every batch signals its completion. The scheduler's thread takes the stall while idle, by empty submissions, once one was seen (`DriverFact::SignallingSubmitsStallEvery1024`, `device/submit_stalls.rs`; a call in which the calling thread spent 1 ms or more of its CPU, and once one came where the count put it, only there; a call that only waits that long, as beside other processes' GPU work, is none): it falls on work only before then, after a use of the queue the runtime cannot count, or on a queue that never idles 1 ms. Whether the driver's stall also holds other threads' semaphore calls is unsettled: a probe polling the timeline from a second thread during 10 stalls saw 5 of its 9 slow calls (up to 7.1 ms) overlap one in one run, and none of its 3 in another; in `host_ab present` the completion handlers of command buffers that completed during a stall taken idle ran 126 us (p50, 341 at most) after their GPU end, as elsewhere. | None (timing only; `WorkCounts::submit_stalls_on_work`, `WorkCounts::submit_stalls_idle`) | | Command buffers that share no resource run one after another, where Metal overlaps them while the GPU has room. | The runtime orders nothing between them and runs at each driver's floor for one completion signal per command buffer; a signal shared by several would hold an earlier one's completion for the later ones' work. | None (timing only) | | On MoltenVK a light queue's command buffer waits for the latest one another queue committed, where Metal waits for none: MoltenVK fences every encoder of every queue device-wide when argument buffers and a residency set are on. | The runtime needs argument buffers, and MoltenVK has no setting for its residency set; `runtime_lane::queue_storms` judges the runtime against Metal under those fences. | None (timing only) | | A `Boolean` visibility result where a sample passed is the device's occlusion query result without `VK_QUERY_CONTROL_PRECISE_BIT` (ORed over a split pass's render pass instances, and under `Accumulate` into the word the buffer held), which Vulkan states only as nonzero; where none passed it is 0 (under `Accumulate`, the word). An Apple M3 Max writes 1, Metal on the AMD Radeon Pro 5300M and the Intel UHD Graphics 630 (macOS 26.7.1) the samples that passed. | Metal's contract is nonzero, and the device's query answers it natively: no dispatch rewrites the word to 1. | `DeviceBooleanVisibility` (`device-boolean-visibility`) |