diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index e5a57af30..556406c67 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -659,7 +659,8 @@ Calls Metal does not have, for a consumer that emulates a Metal device: completion of one that needs no GPU work, taken with no submission behind no work in flight, never waits for it), or sooner, as the command buffer becomes `Scheduled`, where its remaining batches wait only for a host step of its queue's behind work already submitted (Metal schedules - it then, its dependencies resolved); + it then, its dependencies resolved); on the thread whose pass took it, once that pass let go of + the scheduler's lock and before that thread passes again; `add_executed_commands_handler` each time an execution's indirect records are read. - `CommandBuffer::add_completion_seen_handler` is called once the command buffer completed, its status, error and GPU times final, on the runtime's thread that saw it complete (its queue's diff --git a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs index 4863321dc..0bc882e4c 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs @@ -4064,7 +4064,7 @@ impl CommandBuffer { } let _clock = CommitClock::start(device); self.commit_as("commit_and_submit", None, Hand::Pass)?; - device.shared().scheduler.submit_at_commit(device); + device.shared().scheduler.submit_at_commit(device, &self.0); Ok(()) } @@ -4221,7 +4221,7 @@ impl CommandBuffer { ); } if hand == Hand::Pass { - shared.scheduler.submit_at_commit(&self.0.device); + shared.scheduler.submit_at_commit(&self.0.device, &self.0); } } diff --git a/crates/metal2vulkan-runtime/src/scheduler/inbox.rs b/crates/metal2vulkan-runtime/src/scheduler/inbox.rs index 190910570..b59662f71 100644 --- a/crates/metal2vulkan-runtime/src/scheduler/inbox.rs +++ b/crates/metal2vulkan-runtime/src/scheduler/inbox.rs @@ -22,7 +22,7 @@ //! its look may take that lock first and hold it across a `vkQueueSubmit` that waits for a //! `VkQueue` another holds. The thread sleeps under a lock of its own, which no pass takes //! (`scheduler/mod.rs`), and reads the inbox again under it before it sleeps. -//! - **The scheduler's thread looks again until its passes leave it work** ([`Inbox::pass`]). +//! - **The scheduler's thread looks again until its passes leave it work** ([`Inbox::pass_each`]). //! Its passes may leave it work to do without the lock first (a submission check, a host step), //! which the batches behind it wait for: it stops looking again at the first pass that leaves //! some, and before each piece of that work, passes again for as long as the inbox holds @@ -30,15 +30,22 @@ //! left to it, while it holds the lock for a pass, so waits for that pass, the submission //! handlers the thread runs right after it, and the pass that takes it in; never for a wake or //! the thread's work. -//! - **Who runs the after-work.** The thread lets go, outside the lock, of what its passes -//! submitted (the holds, the submission handlers) in submission order. +//! - **Who runs the after-work, and when.** Each pass's after-work (the submission handlers of +//! what it submitted, in submission order, and its holds) runs once that pass let go of the lock +//! and counted out, before the thread looks at the inbox again: never after the passes a stream +//! of commits keeps it making. A command buffer's transition to `Scheduled` waits for its +//! submission handlers, so a pass's handlers left until a later pass ended would hold that +//! transition, and its queue's context behind it, for every submission of the passes between +//! (on a Radeon 780M under a guest's steady commits, 1 to 7 ms; `command_buffer/completion.rs`). +//! The thread is counted out meanwhile, as it is once its passes end: a commit made then finds +//! no passer, and its committing thread may pass for itself. //! - **A thread about to block passes once** ([`Inbox::pass_once`]). A thread that is about to //! sleep for work it committed itself passes for it instead of waiting for a wake, where the //! inbox holds commits and no passer is counted: it is counted as the passer by a swap from //! none, so two such threads never both pass, and it looks again for nothing once counted out //! (it is going to sleep). What was left to it meanwhile it hands to the scheduler's thread -//! instead, by the same fence and look its own `look_again` would make, and a wake -//! ([`Inbox::passed_over`]). The scheduler's thread is never gated: its [`pass`](Inbox::pass) +//! instead, by the same fence and look its own look again would make, and a wake +//! ([`Inbox::passed_over`]). The scheduler's thread is never gated: its [`pass_each`](Inbox::pass_each) //! counts in whatever is counted, and waits for the lock while such a pass holds it. //! - **A committing thread may pass once for its own commit** ([`Inbox::post_quietly`], //! [`Inbox::pass_once_then`]). `CommandBuffer::commit_and_submit` posts its commit with no mark @@ -66,6 +73,15 @@ use std::sync::Mutex; /// and wait for each frame's last), so a commit's push allocates only past a backlog that deep. pub(crate) const ROOM: usize = 128; +/// Why a thread that would pass once made no pass ([`Inbox::pass_once_then`]). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum NoPass { + /// The inbox held no commit: another pass took them in first. + TakenIn, + /// A passer was counted, whose pass (or the thread it wakes) takes the commits in. + Passing, +} + /// A state `S` that passes work on under its lock, and the commits `C` waiting to be taken in. pub(crate) struct Inbox { state: Mutex, @@ -160,20 +176,20 @@ impl Inbox { /// lock is free and before the passer counts out: the work the pass left the caller (its /// submission handlers, the holds it let go of, a check and the passes after it, /// [`pass_again`](Self::pass_again)), during which a commit made finds the passer counted and - /// is left to it. What `after` answered, where it passed. + /// is left to it. What `after` answered, where it passed; else why it made no pass. pub(crate) fn pass_once_then( &self, pass: impl FnOnce(&mut S, &mut Vec) -> R, after: impl FnOnce(R) -> T, - ) -> Option { + ) -> Result { if !self.holds_commits() { - return None; + return Err(NoPass::TakenIn); } if (self.passers) .compare_exchange(0, 1, Ordering::SeqCst, Ordering::SeqCst) .is_err() { - return None; + return Err(NoPass::Passing); } let passed = { let mut state = lock(&self.state); @@ -185,7 +201,7 @@ impl Inbox { }; let answered = after(passed); self.passers.fetch_sub(1, Ordering::SeqCst); - Some(answered) + Ok(answered) } /// Another pass for a caller of [`pass_once_then`](Self::pass_once_then), from its `after`, @@ -198,8 +214,8 @@ impl Inbox { } /// Whether a commit or a nudge was left to the thread that makes passes, read after - /// [`pass_once`](Self::pass_once) counted out: the same fence and look its - /// [`look_again`](Self::look_again) would make, for a caller that sleeps instead of passing + /// [`pass_once`](Self::pass_once) counted out: the same fence and look the thread's + /// [`pass_each`](Self::pass_each) makes once counted out, for a caller that sleeps instead of passing /// again. One posted or nudged during that pass put its write in before its own fence and /// its look at the count, which found a passer: whichever fence comes first, the later look /// sees the other's write, so it is seen here or its own caller found no passer and woke the @@ -235,49 +251,44 @@ impl Inbox { !self.passing() } - /// A pass by the scheduler's thread, never gated (the module docs), `pass` taking in what the inbox - /// holds and answering whether to look again; then look at the inbox again - /// ([`look_again`](Self::look_again)) while each pass answers so. Where one answers no, the + /// A pass by the scheduler's thread, never gated (the module docs), `pass` taking in what the + /// inbox holds and answering whether to look again, then `after` run on `work` once the pass + /// let go of the state's lock and counted out (the module docs, "Who runs the after-work, and + /// when"): what that pass left its thread to do without the lock; then look at the inbox + /// again while each pass answers so, passing for what it holds. Where one answers no, the /// inbox may hold commits left to this thread, which it looks for itself /// ([`holds_commits`](Self::holds_commits)) and passes for before it sleeps (the module docs). - /// Each pass takes every commit out of the list it is given. - pub(crate) fn pass(&self, mut pass: impl FnMut(&mut S, &mut Vec) -> bool) { - self.passers.fetch_add(1, Ordering::SeqCst); - let mut state = lock(&self.state); - let mut taking = lock(&self.taking); - self.take(&mut taking); - let again = pass(&mut state, &mut taking); - debug_assert!(taking.is_empty(), "a pass takes in every commit"); - drop(taking); - drop(state); - self.passers.fetch_sub(1, Ordering::SeqCst); - if again { - self.look_again(&mut pass); - } - } - - /// After the passer is counted out: while the inbox holds a commit or a nudge, take the lock - /// and pass for it (waiting only for a holder that makes no pass), until a pass answers not - /// to look again. - fn look_again(&self, pass: &mut impl FnMut(&mut S, &mut Vec) -> bool) { + /// Each pass takes every commit out of the list it is given. `pass` and `after` share `work`, + /// which `pass` fills under the lock and `after` empties. + pub(crate) fn pass_each( + &self, + work: &mut W, + mut pass: impl FnMut(&mut W, &mut S, &mut Vec) -> bool, + mut after: impl FnMut(&mut W), + ) { loop { + self.passers.fetch_add(1, Ordering::SeqCst); + let again = { + let mut state = lock(&self.state); + let mut taking = lock(&self.taking); + self.take(&mut taking); + let again = pass(work, &mut state, &mut taking); + debug_assert!(taking.is_empty(), "a pass takes in every commit"); + again + }; + self.passers.fetch_sub(1, Ordering::SeqCst); + after(work); + // After the passer counted out, while the inbox holds a commit or a nudge, pass for + // it (waiting only for a holder that makes no pass), until a pass answers not to look + // again. + if !again { + return; + } fence(Ordering::SeqCst); let asked = self.posted.load(Ordering::SeqCst) || self.nudged.load(Ordering::SeqCst); if !asked { return; } - self.passers.fetch_add(1, Ordering::SeqCst); - let mut state = lock(&self.state); - let mut taking = lock(&self.taking); - self.take(&mut taking); - let again = pass(&mut state, &mut taking); - debug_assert!(taking.is_empty(), "a pass takes in every commit"); - drop(taking); - drop(state); - self.passers.fetch_sub(1, Ordering::SeqCst); - if !again { - return; - } } } diff --git a/crates/metal2vulkan-runtime/src/scheduler/mod.rs b/crates/metal2vulkan-runtime/src/scheduler/mod.rs index 36ff8d49e..3560e2f53 100644 --- a/crates/metal2vulkan-runtime/src/scheduler/mod.rs +++ b/crates/metal2vulkan-runtime/src/scheduler/mod.rs @@ -113,9 +113,11 @@ //! - **Submission handlers** (a runtime extension). This thread runs a command buffer's //! submission handlers once it submitted its last batch, or held it in a group (below), or //! made it `Scheduled` behind a host step (above), in -//! submission order among the command buffers its passes took so, once it let go of the lock -//! and before it lets go of the command buffers, before its next pass, which they hold back. -//! The command buffer's transition to `Scheduled` waits for them. They hold back no completion +//! submission order among the command buffers its passes took so, once the pass that took them +//! let go of the lock and before it lets go of the command buffers, before its next pass, which +//! they hold back: never at the end of the passes a stream of commits keeps it making +//! ([`round`]). The command buffer's transition to `Scheduled` waits for them, and its queue's +//! context waits behind it: the completion of the queue's command buffer before it among them. They hold back no completion //! of what the passes took: a command buffer taken with no submission whose `VkQueue` has no //! work in flight, whose completion turn is this thread's (`Completion::turn_owed`), is //! finished before they run. @@ -256,10 +258,11 @@ use super::tracker::{self, Footprint, Tracker}; use super::Device; use ash::vk; use binary::{BinarySignals, Needs}; -use inbox::Inbox; +use inbox::{Inbox, NoPass}; use left::{work_through, Kind, Left}; use metal2vulkan::error::RuntimeDriverDefect; use order::{Behind, Order, Place}; +use std::cell::Cell; use std::collections::{BTreeMap, BTreeSet}; use std::sync::atomic::{fence, AtomicBool, AtomicU64, Ordering}; use std::sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock}; @@ -1001,7 +1004,8 @@ impl Scheduler { let taken = take_in(state, commits, &mut spent); let mut none = Handlers::new(); let waiting = (Passer::Waiting, &mut none); - submitted = submit_plain_ready(state, &mut spent, waiting, PASS_SUBMISSIONS).batches; + submitted = + submit_plain_ready(state, &mut spent, waiting, PASS_SUBMISSIONS, None).batches; debug_assert!( none.is_empty(), "a waiting thread took a submission handler" @@ -1053,7 +1057,10 @@ impl Scheduler { /// It runs the program's code only in the submission checks of the heads it checks and the /// submission handlers of the batches it submitted: a scheduled handler is run on its queue's /// handler thread, as the thread's passes leave it. - pub(crate) fn submit_at_commit(&self, device: &Device) { + /// + /// Where it submits none of the scheduler's batches, the commit is counted by why + /// ([`LeftAtCommit`]): `buffer` is the command buffer it committed. + pub(crate) fn submit_at_commit(&self, device: &Device, buffer: &CommandBufferShared) { let shared = &*self.shared; // Timed as the commit call's phases (`commit_times.rs`): the lock's wait, the pass under // it, and the submissions, checks and handlers, each apart. @@ -1065,18 +1072,27 @@ impl Scheduler { trace::submitting("a committing thread's pass"); let mut spent = Spent::new(); let taken = take_in(state, commits, &mut spent); - let pass = AtCommit::pass(state, spent, PASS_SUBMISSIONS); + let pass = AtCommit::pass(state, spent, PASS_SUBMISSIONS, buffer); shared.took_in(taken); pass }) }, - |pass| commit_times::phase(Phase::Pass, || self.after_pass_at_commit(device, pass)), + |pass| { + let after = || self.after_pass_at_commit(device, pass, buffer); + commit_times::phase(Phase::Pass, after) + }, ) }); - let Some((submitted, alone, checked, left_over)) = passed else { - return; + let counts = &device.shared().counts; + let (submitted, alone, checked, left_over, left) = match passed { + Ok(passed) => passed, + Err(NoPass::TakenIn) => return counts.left_at_commit(LeftAtCommit::TakenIn), + Err(NoPass::Passing) => return counts.left_at_commit(LeftAtCommit::Passing), }; - device.shared().counts.committer_passed(submitted, checked); + counts.committer_passed(submitted, checked); + if let Some(left) = left.filter(|_| submitted == 0) { + counts.left_at_commit(left); + } // After the submissions, so none waits for the wake. if left_over || shared.inbox.passed_over() { self.wake_for(Woken::Host); @@ -1087,35 +1103,38 @@ impl Scheduler { /// [`submit_at_commit`](Self::submit_at_commit)'s work after its first pass, still counted as /// the passer: the pass's submission handlers, the check it took and its pass again, and so - /// on. How many batches it submitted, alone, and checked, and whether it left any over. + /// on. How many batches it submitted, alone, and checked, whether it left any over, and why + /// its last pass left `ours`, the committed command buffer, where that pass submitted nothing. fn after_pass_at_commit( &self, device: &Device, mut pass: AtCommit, - ) -> (usize, usize, usize, bool) { + ours: &CommandBufferShared, + ) -> (usize, usize, usize, bool, Option) { let shared = &*self.shared; let (mut submitted, mut alone, mut checked) = (0, 0, 0); loop { submitted += pass.submitted; alone += pass.alone; - let left_over = pass.left_over; + let (left_over, left) = (pass.left_over, pass.left); // The completion turn a command buffer the pass took with no submission left this // thread, before the handlers and the check, as the scheduler's thread makes it before // its handlers ([`round`]). device.shared().completion.turn_owed(); let let_go = || pass.let_go(&shared.turns, device); let Some(check) = commit_times::phase(Phase::Submit, let_go) else { - return (submitted, alone, checked, left_over); + return (submitted, alone, checked, left_over, left); }; // None once the process is exiting, as the thread then runs nothing more. let ran = || run_work(&self.shared, Kind::Check, check); if !commit_times::phase(Phase::Submit, ran) { - return (submitted, alone, checked, left_over); + return (submitted, alone, checked, left_over, left); } checked += 1; let room = PASS_SUBMISSIONS.saturating_sub(submitted); let again = |state: &mut State| { - commit_times::phase(Phase::Pass, || AtCommit::pass(state, Spent::new(), room)) + let pass = || AtCommit::pass(state, Spent::new(), room, ours); + commit_times::phase(Phase::Pass, pass) }; pass = commit_times::phase(Phase::LockWait, || shared.inbox.pass_again(again)); } @@ -1528,23 +1547,36 @@ fn run_work(shared: &Arc, kind: Kind, work: Work) -> bool { } /// One round of the thread's: a pass, looking at the inbox again while the passes leave the -/// thread no work and none stopped at [`PASS_SUBMISSIONS`] ([`Inbox::pass`]; such a pass marked -/// the state for the next round), what they leave added to `left` and what they let go of to -/// `passed` (empty, kept from round to round); then, without the lock, what they let go of: the -/// switches of storage forms settled ended, the completion turn a command buffer they took with -/// no submission left this thread made (`Completion::turn_owed`), and the submission handlers -/// run (on this thread, before its next pass; none of these once the process is exiting, as the -/// thread then runs nothing more, their command buffers staying `Committed`), the holds dropped -/// (the last reference to a command buffer may be among them, and with it its device, whose drop -/// stops this thread). False once the process is exiting. +/// thread no work and none stopped at [`PASS_SUBMISSIONS`] ([`Inbox::pass_each`]; such a pass +/// marked the state for the next round), what they leave added to `left` and what they let go of +/// to `passed` (empty, kept from round to round), which each pass's after-work ([`let_go`]) lets go +/// of without the lock before the thread looks at the inbox again, never at the round's end: a +/// command buffer's transition to `Scheduled` waits for its submission handlers, and its queue's +/// context behind it (the module docs, **Submission handlers**). False once the process is +/// exiting. fn round(shared: &SchedulerShared, left: &mut Left, passed: &mut Passed) -> bool { - (shared.inbox).pass(|state, commits| { - shared.passes.fetch_add(1, Ordering::Relaxed); - let taken = pass(state, commits, (&mut *passed, &mut *left), &shared.awaits); - shared.took_in(taken); - !passed.exiting && left.is_empty() && !passed.more - }); + (shared.inbox).pass_each( + &mut (&mut *left, &mut *passed), + |(left, passed), state, commits| { + shared.passes.fetch_add(1, Ordering::Relaxed); + let taken = pass(state, commits, (&mut **passed, &mut **left), &shared.awaits); + shared.took_in(taken); + !passed.exiting && left.is_empty() && !passed.more + }, + |(_, passed)| let_go(shared, passed), + ); passed.more = false; + !passed.exiting +} + +/// A pass's after-work, without the lock ([`round`]): what it let go of, `passed`'s, emptied: +/// the switches of storage forms settled ended, the completion turn a command buffer it took with +/// no submission left this thread made (`Completion::turn_owed`), and the submission handlers run +/// (on this thread, before its next pass; none of these once the process is exiting, as the thread +/// then runs nothing more, their command buffers staying `Committed`), the holds dropped (the last +/// reference to a command buffer may be among them, and with it its device, whose drop stops this +/// thread). +fn let_go(shared: &SchedulerShared, passed: &mut Passed) { if passed.exiting { passed.settled.clear(); passed.handlers.clear(); @@ -1557,14 +1589,13 @@ fn round(shared: &SchedulerShared, left: &mut Left, passed: &mut Passed) - // flight, is finished by this thread, holding no lock (`Completion::turn_owed`), before // it runs a submission handler: a handler that waits for its completion (another // queue's, as Metal delivers) would otherwise wait for its own return. Every command - // buffer the passes took is in `spent`. + // buffer the pass took is in `spent`. if let Some(buffer) = passed.spent.first() { buffer.device().shared().completion.turn_owed(); } shared.turns.run(&mut passed.handlers, &mut passed.turns); } passed.spent.clear(); - !passed.exiting } /// What passes let go of for their thread to finish without the lock ([`submit_ready`]'s @@ -2148,16 +2179,28 @@ struct AtCommit { check: Option, /// It left batches in the order or the group. left_over: bool, + /// Where it submitted nothing, why the committing thread's command buffer's first batch was + /// left ([`LeftAtCommit`]). + left: Option, } impl AtCommit { /// Submit the heads [`plain_ready`] holds for, in commit order, at most `room` /// ([`submit_plain_ready`]); then, with room for one more, take the checks of the first head /// left whose checks the committing thread may run ([`claim_check`]). Its holds go to `spent`. - fn pass(state: &mut State, mut spent: Spent, room: usize) -> AtCommit { + /// `ours` is the committing thread's command buffer, whose batch's place it notes where it + /// submits nothing. + fn pass( + state: &mut State, + mut spent: Spent, + room: usize, + ours: &CommandBufferShared, + ) -> AtCommit { let mut handlers = Handlers::new(); let committing = (Passer::Committing, &mut handlers); - let submitted = submit_plain_ready(state, &mut spent, committing, room); + let noting = Noting::new(ours); + let submitted = submit_plain_ready(state, &mut spent, committing, room, Some(¬ing)); + let left = (submitted.batches == 0).then(|| noting.why(&state.order)); let mut segments = Vec::new(); if !handlers.is_empty() { segments.push((handlers.len(), state.handler_ticket())); @@ -2175,6 +2218,7 @@ impl AtCommit { alone: submitted.alone, check, left_over, + left, } } @@ -2223,11 +2267,15 @@ impl AtCommit { /// check, where Metal runs neither. So it reads `order`, `binary` and `decodes`, submits against /// `tracker`, `values`, `waited`, `kept` and `lists` as a pass does, and leaves `awaits`, `left`, /// the group, `dirty` and the sleeps alone. It makes no pass at all while the group holds a batch. +/// +/// Where `noting` names a committing thread's command buffer, each look notes on it why that +/// command buffer's batch was left when its line's head was asked about ([`Noting`]). fn submit_plain_ready( state: &mut State, spent: &mut Spent, (passer, handlers): (Passer, &mut Handlers), room: usize, + noting: Option<&Noting<'_>>, ) -> Plain { let mut submitted = Plain::default(); while submitted.batches < room && state.grouped.is_empty() { @@ -2249,16 +2297,30 @@ fn submit_plain_ready( let mut first_left = Vec::new(); order.next( goes_first, - |order, sequence| is_behind(order, binary, &mut memo, sequence), + |order, sequence| { + let behind = is_behind(order, binary, &mut memo, sequence); + if let Some(noting) = noting { + noting.behind(behind); + } + behind + }, |held| { + let ours = noting.filter(|noting| noting.is_ours(held)); if left_behind_unshared(held, &first_left) { + ours.inspect(|noting| noting.left(LeftAtCommit::Unshared)); return None; } let waits = plain_ready(held, binary, decodes, untracked, passer); - if waits.is_none() && first_for_the_thread(held, binary, decodes, untracked) { + if waits.is_err() && first_for_the_thread(held, binary, decodes, untracked) { first_left.extend(held.buffer.unshared_vk_queue()); } - waits + if let Some(noting) = ours { + match &waits { + Ok(_) => noting.readied(), + Err(why) => noting.left(*why), + } + } + waits.ok() }, ) }; @@ -2486,6 +2548,99 @@ enum Passer { Committing, } +/// A committing thread's command buffer, and why its pass left that command buffer's first batch +/// in the order, noted as the pass's looks ask about it ([`submit_plain_ready`]). +struct Noting<'a> { + ours: &'a CommandBufferShared, + /// Why the last look that asked about its batch, at its line's head, left it. + why: Cell>, + /// The head the look just found ready is its, and it is asked next whether it waits behind + /// an earlier commit ([`Order::next`]). + readied: Cell, +} + +impl<'a> Noting<'a> { + fn new(ours: &'a CommandBufferShared) -> Noting<'a> { + Noting { + ours, + why: Cell::new(None), + readied: Cell::new(false), + } + } + + /// Whether `held` is a batch of its command buffer. + fn is_ours(&self, held: &Held) -> bool { + std::ptr::eq::(&**held.buffer, self.ours) + } + + /// Its batch, at its line's head, was left for `why`. + fn left(&self, why: LeftAtCommit) { + self.why.set(Some(why)); + } + + /// Its batch, at its line's head, was found ready. + fn readied(&self) { + self.readied.set(true); + } + + /// The head just found ready waits `behind` an earlier commit, or not. + fn behind(&self, behind: bool) { + if self.readied.replace(false) && behind { + self.left(LeftAtCommit::BehindAnotherQueue); + } + } + + /// Why a pass that submitted nothing left its command buffer's first batch: where none of its + /// batches is in `order`, gone; where one is but behind an earlier batch of its own queue, so; + /// else what its look noted, or `Other` where no look asked (a group held, a submission put + /// back). + fn why(&self, order: &Order) -> LeftAtCommit { + match order.place_of(self.ours.logical_queue(), |held| self.is_ours(held)) { + None => LeftAtCommit::Gone, + Some(false) => LeftAtCommit::BehindItsQueue, + Some(true) => self.why.get().unwrap_or(LeftAtCommit::Other), + } + } +} + +/// Why the pass `CommandBuffer::commit_and_submit` makes for its own commit +/// ([`Scheduler::submit_at_commit`]) submitted none of the scheduler's batches, where it did: the +/// command buffer's batches then go to the scheduler's thread. Counted for each commit that left +/// them so (`WorkCounts::scheduler_at_commit_left_taken_in` and kin), the first two of which made +/// no pass; the rest made one that submitted nothing, by why the command buffer's first batch in +/// the order was not taken. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum LeftAtCommit { + /// No pass: another pass took the commit in before the committing thread looked. + TakenIn, + /// No pass: a pass was under way, which takes the commit in, or the thread it wakes does. + Passing, + /// None of its batches was in the order: another thread's pass took them in and on. + Gone, + /// An earlier batch of its own queue led its queue's line. + BehindItsQueue, + /// It waited behind an earlier commit of another queue (`is_behind`). + BehindAnotherQueue, + /// It waits for an event value no submitted signal reached yet. + EventWait, + /// Its submission checks, which the committing thread did not take. + Checks, + /// It has a host step for the scheduler's thread to record. + HostStep, + /// It waits for a binary semaphore whose signal was not submitted yet. + BinaryWait, + /// It is held back for an unshared queue (`unshared_hold.rs`). + Unshared, + /// Anything else: a rebind encodes it again, a decode it reads is queued, a switch of + /// storage forms rides on it, a group holds it or was held, or its submission was put back. + Other, +} + +impl LeftAtCommit { + /// How many there are, for the counters' array. + pub(crate) const COUNT: usize = 11; +} + /// How a commit hands its batches to the scheduler. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub(crate) enum Hand { @@ -2524,30 +2679,34 @@ fn plain_ready( decodes: &BTreeMap, untracked_decodes: usize, passer: Passer, -) -> Option> { +) -> Result, LeftAtCommit> { if held.checked && held.buffer.needs_check(held.index) { - return None; + return Err(LeftAtCommit::Checks); } - if !plain(held, binary, decodes, untracked_decodes, passer) { - return None; - } - event_waits(held) + plain(held, binary, decodes, untracked_decodes, passer)?; + event_waits(held).ok_or(LeftAtCommit::EventWait) } /// Whether nothing holds `held` back from `passer` but its submission checks and its event waits -/// ([`plain_ready`]'s other conditions). +/// ([`plain_ready`]'s other conditions); else what holds it first, of those. fn plain( held: &Held, binary: &BinarySignals, decodes: &BTreeMap, untracked_decodes: usize, passer: Passer, -) -> bool { - if held.segments || !binary.ready(&held.binary_needs) || held.buffer.reencode_pending() { - return false; +) -> Result<(), LeftAtCommit> { + if held.segments { + return Err(LeftAtCommit::HostStep); + } + if !binary.ready(&held.binary_needs) { + return Err(LeftAtCommit::BinaryWait); + } + if held.buffer.reencode_pending() { + return Err(LeftAtCommit::Other); } if untracked_decodes > 0 || (!decodes.is_empty() && reads_decoding(held, decodes)) { - return false; + return Err(LeftAtCommit::Other); } // A batch that may wait in the group is the scheduler thread's to hold, but for a committing // thread's where its `VkQueue` would see the group go at once (`goes_alone_at_commit`). @@ -2558,12 +2717,18 @@ fn plain( && (!held.buffer.groups() || held.buffer.goes_alone_at_commit()) } }; + if !theirs { + return Err(LeftAtCommit::Other); + } // One held back for an unshared queue is the scheduler thread's to hold, and to wait for its // room (`unshared_hold.rs`), as is one an unshared queue's commit not yet taken in may hold // (its passes note the commits it waits behind). - theirs - && held.buffer.held_for_unshared().is_none() - && (held.buffer.unshared_commits()).is_none_or(|(_, (posted, taken))| taken >= posted) + let unshared = held.buffer.held_for_unshared().is_some() + || (held.buffer.unshared_commits()).is_some_and(|(_, (posted, taken))| taken < posted); + match unshared { + true => Err(LeftAtCommit::Unshared), + false => Ok(()), + } } /// The checks of the first line head in commit order whose checks a committing thread may run @@ -2590,7 +2755,7 @@ fn claim_check(state: &mut State) -> Option { held.checked && held.checks_taken.is_none() && held.buffer.needs_check(held.index) - && plain(held, binary, decodes, *untracked_decodes, passer) + && plain(held, binary, decodes, *untracked_decodes, passer).is_ok() && landing_waits(held).is_some_and(|waits| waits.is_empty()) }); claimable.sort_unstable(); diff --git a/crates/metal2vulkan-runtime/src/scheduler/order.rs b/crates/metal2vulkan-runtime/src/scheduler/order.rs index 6c8b963b0..e8cd190d1 100644 --- a/crates/metal2vulkan-runtime/src/scheduler/order.rs +++ b/crates/metal2vulkan-runtime/src/scheduler/order.rs @@ -246,6 +246,15 @@ impl Order { false } + /// Where the first batch `select` picks waits on logical queue `queue`'s line: whether it + /// leads that line; `None` where the line holds none. + pub(crate) fn place_of(&self, queue: u64, select: impl Fn(&B) -> bool) -> Option { + let (_, line) = self.lines.iter().find(|(line, _)| *line == queue)?; + line.iter() + .position(|(_, batch)| select(batch)) + .map(|at| at == 0) + } + /// Each line's head, with its commit sequence number. pub(crate) fn heads(&self) -> impl Iterator + '_ { (self.lines.iter()) diff --git a/crates/metal2vulkan-runtime/src/tests/inbox.rs b/crates/metal2vulkan-runtime/src/tests/inbox.rs index d6724a4e6..287032a91 100644 --- a/crates/metal2vulkan-runtime/src/tests/inbox.rs +++ b/crates/metal2vulkan-runtime/src/tests/inbox.rs @@ -23,6 +23,21 @@ use std::time::{Duration, Instant}; /// instead of returning fails the test after it, rather than hanging it. const WAIT: Duration = Duration::from_secs(30); +/// [`Inbox::pass_each`] with no after-work, for the tests of the passes themselves. +pub(super) trait Passes { + fn pass(&self, pass: impl FnMut(&mut S, &mut Vec) -> bool); +} + +impl Passes for Inbox { + fn pass(&self, mut pass: impl FnMut(&mut S, &mut Vec) -> bool) { + self.pass_each( + &mut pass, + |pass, state, commits| pass(state, commits), + |_| {}, + ); + } +} + /// The state: the commits in the order the passes took them in. type Log = Inbox, u32>; @@ -169,6 +184,50 @@ fn a_pass_leaves_the_inbox_room_for_twice_the_commits_it_took_in() { ); } +/// The scheduler's after-work for a pass ([`Inbox::pass_each`]) runs once that pass counted out +/// and before the look that may pass again: a commit posted during the first pass is passed for +/// only after the first pass's after-work ran, and a thread that passes once during that +/// after-work finds no passer counted and passes. +#[test] +fn each_pass_s_after_work_runs_before_the_look_again_uncounted() { + let inbox = Log::new(Vec::new()); + inbox.post(1); + let mut events: Vec = Vec::new(); + inbox.pass_each( + &mut events, + |events, log, commits| { + events.push(format!("pass {commits:?}")); + log.append(commits); + if log.len() == 1 { + assert!(!inbox.post(2), "a commit found no pass under way"); + } + true + }, + |events| events.push("after".to_owned()), + ); + assert_eq!(events, ["pass [1]", "after", "pass [2]", "after"]); + inbox.post(3); + let mut passed_once = false; + inbox.pass_each( + &mut passed_once, + |_, log, commits| { + log.append(commits); + log.len() == 3 + }, + |passed_once| { + if !*passed_once { + inbox.post(4); + *passed_once = inbox.pass_once(|log, commits| log.append(commits)); + } + }, + ); + assert!( + passed_once, + "a pass once during the after-work found a passer counted" + ); + assert_eq!(*lock(inbox.state()), [1, 2, 3, 4]); +} + #[test] fn the_scheduler_s_pass_looks_again_until_a_pass_answers_it_has_work_first() { for again in [true, false] { diff --git a/crates/metal2vulkan-runtime/src/tests/left.rs b/crates/metal2vulkan-runtime/src/tests/left.rs index 6398d4563..1cec2b917 100644 --- a/crates/metal2vulkan-runtime/src/tests/left.rs +++ b/crates/metal2vulkan-runtime/src/tests/left.rs @@ -3,7 +3,7 @@ //! the round that took an earlier one in; the work runs in the order the rounds found it, a //! round's checks before its steps; and the exit ends it. -use super::inbox::commit_elsewhere; +use super::inbox::{commit_elsewhere, Passes}; use crate::device::lock; use crate::scheduler::inbox::Inbox; use crate::scheduler::left::{work_through, Kind, Left}; diff --git a/crates/metal2vulkan-runtime/src/tests/mod.rs b/crates/metal2vulkan-runtime/src/tests/mod.rs index 90281061c..784ae7a78 100644 --- a/crates/metal2vulkan-runtime/src/tests/mod.rs +++ b/crates/metal2vulkan-runtime/src/tests/mod.rs @@ -820,6 +820,8 @@ mod storage_form; mod storage_form_recycle; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod store_out_device; +#[cfg(any(m2v_gpu, m2v_cpu_icd))] +mod submission_turns; mod submit_check; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod submit_check_device; diff --git a/crates/metal2vulkan-runtime/src/tests/submission_turns.rs b/crates/metal2vulkan-runtime/src/tests/submission_turns.rs new file mode 100644 index 000000000..8b1a12cf0 --- /dev/null +++ b/crates/metal2vulkan-runtime/src/tests/submission_turns.rs @@ -0,0 +1,129 @@ +//! When a command buffer's submission handlers run (`scheduler/mod.rs`, **Submission handlers**; +//! `scheduler/inbox.rs`, "Who runs the after-work, and when"): on the thread whose pass took it, +//! once that pass let go of the scheduler's lock and before that thread passes again. A pass of +//! the scheduler's thread is held in a submission (`trace::Point::FirstWork`) while another queue +//! commits, so the thread's look after that pass takes the second commit in: the first command +//! buffer's submission handlers ran before the second's submission was called (its +//! `kernel_end_time`), where they once ran only after every pass the commits kept the thread +//! making. Under either `CompletionPolicy`: a batch the default `Grouped` holds in a group is taken +//! (its handlers taken with it) at the hold, which the first work's take is reached at 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. + +use crate::command_buffer::completion::trace; +use crate::tests::SETTLE; +use crate::{ + host_time, Buffer, CommandBuffer, CommandBufferStatus, CommandQueue, Device, DeviceKind, + DeviceOptions, ResourceOptions, +}; +use metal2vulkan::device::CompletionPolicy; +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +/// The bytes each command buffer fills. +const FILL: u64 = 64 << 10; + +/// How long a step may take before the test fails rather than hangs. +const WAIT: Duration = Duration::from_secs(10); + +/// The device the cfg selects (a CPU device under `m2v_cpu_icd`, else a GPU) under `completion`. +fn device(completion: CompletionPolicy) -> Device { + let mut options = DeviceOptions { + kinds: match cfg!(m2v_cpu_icd) { + true => vec![DeviceKind::Cpu], + false => vec![ + DeviceKind::Discrete, + DeviceKind::Integrated, + DeviceKind::Virtual, + ], + }, + ..DeviceOptions::default() + }; + options.policy.completion = completion; + let device = Device::system_default_with(&options).unwrap(); + assert!( + device.settle_submit_checks(SETTLE), + "the submission checks never answered" + ); + device +} + +/// A command buffer of `queue` that fills `target` with `value`. +fn fill(queue: &CommandQueue, target: &Buffer, value: u8) -> CommandBuffer { + let command_buffer = queue.command_buffer().unwrap(); + let mut blit = command_buffer.blit_command_encoder().unwrap(); + blit.fill_buffer(target, 0..FILL, value).unwrap(); + blit.end_encoding().unwrap(); + command_buffer +} + +/// Wait for `command_buffer`, which completes. +fn completes(command_buffer: &CommandBuffer) { + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.status(), CommandBufferStatus::Completed); +} + +/// The module docs' check, under `completion`. +fn handlers_run_before_the_next_pass(completion: CompletionPolicy) { + let device = device(completion); + let (first, second) = ( + device.new_command_queue().unwrap(), + device.new_command_queue().unwrap(), + ); + let targets = [ + device.new_buffer(FILL, ResourceOptions::private()).unwrap(), + device.new_buffer(FILL, ResourceOptions::private()).unwrap(), + ]; + // Each queue's first work done, and each target's, before the measured commits. + for (queue, target) in [(&first, &targets[0]), (&second, &targets[1])] { + let warm = fill(queue, target, 1); + warm.commit().unwrap(); + completes(&warm); + } + let ran = Arc::new(Mutex::new(None)); + let held = fill(&first, &targets[0], 2); + let noted = Arc::clone(&ran); + held.add_submission_handler(Box::new(move |_: &CommandBuffer| { + *noted.lock().unwrap() = Some(host_time()); + })) + .unwrap(); + // The scheduler's thread takes it in its pass and is held in its submission, the scheduler's + // lock held and the thread counted as the passer. + trace::hold_at(trace::Point::FirstWork); + held.commit().unwrap(); + let reached = trace::reached(trace::Point::FirstWork, WAIT); + // Posted while that pass is under way: left to the thread's look once the pass ends. + let later = fill(&second, &targets[1], 3); + if reached { + later.commit().unwrap(); + } + trace::release(trace::Point::FirstWork); + assert!(reached, "the scheduler's pass never reached its submission"); + completes(&held); + completes(&later); + let ran = (*ran.lock().unwrap()).expect("its submission handler ran"); + let submitted = later.kernel_end_time(); + println!( + "SUBMISSION-TURNS {} {completion:?}: the held pass's handler ran {:.1} us before the \ + later commit's submission was called", + device.name(), + (submitted - ran) * 1e6, + ); + assert!( + ran < submitted, + "the held pass's submission handler ran {:.1} us after the next pass submitted the commit \ + posted meanwhile ({completion:?})", + (ran - submitted) * 1e6, + ); +} + +#[test] +fn a_pass_s_submission_handlers_run_before_the_thread_passes_again_exact() { + handlers_run_before_the_next_pass(CompletionPolicy::Exact); +} + +#[test] +fn a_pass_s_submission_handlers_run_before_the_thread_passes_again_grouped() { + handlers_run_before_the_next_pass(CompletionPolicy::Grouped); +} diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index 22023deff..e3c0c3941 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -15,7 +15,7 @@ use super::heap_sets::Unkept; use super::memory::FreeCause; use super::recorder::CommandsRecorded; use super::render::{LeadingShare, SplitReason}; -use super::scheduler::HeldFor; +use super::scheduler::{HeldFor, LeftAtCommit}; use super::shadow::{Backing, CarryTally, CopyCause, Lost, ShadowCopy, ShadowSource}; use super::shadow_standing::{LetGo, Missed, Unskipped}; use super::texture::faces::Unturned; @@ -337,6 +337,9 @@ pub(crate) struct Counters { scheduler_passes_by_waiters: AtomicU64, batches_submitted_by_waiters: AtomicU64, scheduler_passes_at_commit: AtomicU64, + /// By `LeftAtCommit`, in its order: the commits of `commit_and_submit` whose own pass + /// submitted none of the scheduler's batches, or that made none. + left_at_commit: [AtomicU64; LeftAtCommit::COUNT], batches_submitted_at_commit: AtomicU64, batches_checked_at_commit: AtomicU64, commit_calls: AtomicU64, @@ -3692,6 +3695,13 @@ impl Counters { self.batches_by_pending[bucket].fetch_add(1, Ordering::Relaxed); } + /// A commit of `commit_and_submit` left its batches to the scheduler's thread, its own pass + /// submitting none of the scheduler's batches, or making none, for `why` + /// (`scheduler/mod.rs`). + pub(crate) fn left_at_commit(&self, why: LeftAtCommit) { + self.left_at_commit[why as usize].fetch_add(1, Ordering::Relaxed); + } + /// A batch on a `VkQueue` whose batches group went in a kernel submission of its own, for /// `why` (`command_buffer/group.rs`). pub(crate) fn batch_alone(&self, why: Alone) { @@ -8099,6 +8109,34 @@ pub struct WorkCounts { /// (`CommandBuffer::commit_and_submit`, `scheduler/mod.rs`): one where no pass was under /// way. A commit whose pass found one under way leaves its batches to it, uncounted here. pub scheduler_passes_at_commit: u64, + /// Commits of `CommandBuffer::commit_and_submit` whose committing thread made no pass of its + /// own, as another pass had taken its commit in first (`scheduler/mod.rs`, `LeftAtCommit`): + /// its batches go to the scheduler's thread, or to the pass that took them. + pub scheduler_at_commit_left_taken_in: u64, + /// Those whose committing thread made no pass, as a pass was under way, which takes the + /// commit in (the scheduler thread's, while it passes again for the commits that keep coming). + pub scheduler_at_commit_left_passing: u64, + /// Passes at commit (`scheduler_passes_at_commit`) that submitted nothing, by why the + /// committed command buffer's first batch was left: none of its batches was in the order any + /// more (another thread's pass took them in and on). + pub scheduler_at_commit_left_gone: u64, + /// An earlier batch of its own queue led its queue's line. + pub scheduler_at_commit_left_behind_its_queue: u64, + /// It waited behind an earlier commit of another queue. + pub scheduler_at_commit_left_behind_another_queue: u64, + /// It waits for an event value no submitted signal reached yet. + pub scheduler_at_commit_left_event_waits: u64, + /// Its submission checks, which the committing thread did not take. + pub scheduler_at_commit_left_checks: u64, + /// It has a host step for the scheduler's thread to record. + pub scheduler_at_commit_left_host_steps: u64, + /// It waits for a binary semaphore whose signal was not submitted yet. + pub scheduler_at_commit_left_binary_waits: u64, + /// It is held back for an unshared queue (`unshared_hold.rs`). + pub scheduler_at_commit_left_unshared: u64, + /// Anything else: a rebind encodes it again, a decode it reads is queued, a switch of storage + /// forms rides on it, a group holds it or was held, or its submission was put back. + pub scheduler_at_commit_left_other: u64, /// The batches those passes submitted: those ready with nothing for the scheduler's thread to /// do for them (no host step, no group, no switch of a storage form, no submission check the /// committing thread may not run), their submission handlers run by the committing thread, @@ -11768,6 +11806,8 @@ impl Device { |reason: HeldFor| counters.heads_held_for[reason as usize].load(Ordering::Relaxed); let pending = |bucket: usize| counters.batches_by_pending[bucket].load(Ordering::Relaxed); let alone = |why: Alone| counters.batches_alone[why as usize].load(Ordering::Relaxed); + let left_at_commit = + |why: LeftAtCommit| counters.left_at_commit[why as usize].load(Ordering::Relaxed); let [behind, unshared_behind] = (counters.behind_other_queues) .each_ref() .map(|tally| tally.read()); @@ -12294,6 +12334,19 @@ impl Device { .batches_submitted_by_waiters .load(Ordering::Relaxed), scheduler_passes_at_commit: counters.scheduler_passes_at_commit.load(Ordering::Relaxed), + scheduler_at_commit_left_taken_in: left_at_commit(LeftAtCommit::TakenIn), + scheduler_at_commit_left_passing: left_at_commit(LeftAtCommit::Passing), + scheduler_at_commit_left_gone: left_at_commit(LeftAtCommit::Gone), + scheduler_at_commit_left_behind_its_queue: left_at_commit(LeftAtCommit::BehindItsQueue), + scheduler_at_commit_left_behind_another_queue: left_at_commit( + LeftAtCommit::BehindAnotherQueue, + ), + scheduler_at_commit_left_event_waits: left_at_commit(LeftAtCommit::EventWait), + scheduler_at_commit_left_checks: left_at_commit(LeftAtCommit::Checks), + scheduler_at_commit_left_host_steps: left_at_commit(LeftAtCommit::HostStep), + scheduler_at_commit_left_binary_waits: left_at_commit(LeftAtCommit::BinaryWait), + scheduler_at_commit_left_unshared: left_at_commit(LeftAtCommit::Unshared), + scheduler_at_commit_left_other: left_at_commit(LeftAtCommit::Other), footprints_built: counters.footprints_built.load(Ordering::Relaxed), footprint_lock_waits: counters.footprint_lock_waits.load(Ordering::Relaxed), batches_submitted_at_commit: counters diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index d26ea1527..2f5820f17 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 523; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 2428; +pub const RUNTIME_VERSION: u32 = 2429; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 98fb4b979..f8cbb6303 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -3609,6 +3609,17 @@ field metal2vulkan-runtime::WorkCounts.sampler_sets_made pub sampler_sets_made: field metal2vulkan-runtime::WorkCounts.sampler_sets_shared pub sampler_sets_shared: u64 field metal2vulkan-runtime::WorkCounts.scheduled_behind_host_steps pub scheduled_behind_host_steps: u64 field metal2vulkan-runtime::WorkCounts.scheduled_where_submitted pub scheduled_where_submitted: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_behind_another_queue pub scheduler_at_commit_left_behind_another_queue: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_behind_its_queue pub scheduler_at_commit_left_behind_its_queue: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_binary_waits pub scheduler_at_commit_left_binary_waits: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_checks pub scheduler_at_commit_left_checks: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_event_waits pub scheduler_at_commit_left_event_waits: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_gone pub scheduler_at_commit_left_gone: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_host_steps pub scheduler_at_commit_left_host_steps: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_other pub scheduler_at_commit_left_other: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_passing pub scheduler_at_commit_left_passing: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_taken_in pub scheduler_at_commit_left_taken_in: u64 +field metal2vulkan-runtime::WorkCounts.scheduler_at_commit_left_unshared pub scheduler_at_commit_left_unshared: u64 field metal2vulkan-runtime::WorkCounts.scheduler_gpu_waits pub scheduler_gpu_waits: u64 field metal2vulkan-runtime::WorkCounts.scheduler_passes pub scheduler_passes: u64 field metal2vulkan-runtime::WorkCounts.scheduler_passes_at_commit pub scheduler_passes_at_commit: u64