pub struct BacklogLedger { /* private fields */ }Expand description
What one realize added to the per-device backlog, taken back out when the realize ends (ROADMAP row
158, the executor feed). The executor owns one for the length of a walk and calls Self::add for
each kernel it submits to a GPU, with that node’s compile-time estimate
(crate::compiled::CompiledNode::est_ns); the guard’s Drop subtracts exactly what was added, on
the Ok path AND when an error unwinds the realize, so the backlog cannot leak.
Granularity, stated: work is counted from submit until the END OF THE REALIZE that submitted it, not until its fence signals. A realize ends by draining every device it used, so at its end the work has retired; within it the figure is an upper bound on what is still queued. What it is for: a second realize (multi-agent serving) resolving a branch while this one’s work is outstanding.
A CPU location and a zero estimate add nothing: the CPU has no queue to estimate, and a device the
executor cannot price must keep reporting NO estimate (backlog_estimate_ns None), never idle.
Implementations§
Source§impl BacklogLedger
impl BacklogLedger
Sourcepub fn add(&mut self, loc: DeviceLocation, ns: u64)
pub fn add(&mut self, loc: DeviceLocation, ns: u64)
Add ns of estimated work to loc’s backlog and keep it until the ledger is dropped (the end of
the realize). For work with no completion probe.
Sourcepub fn add_until(
&mut self,
loc: DeviceLocation,
ns: u64,
done: impl Fn() -> bool + Send + Sync + 'static,
)
pub fn add_until( &mut self, loc: DeviceLocation, ns: u64, done: impl Fn() -> bool + Send + Sync + 'static, )
Add ns of estimated work to loc’s backlog and take it back out as soon as done() reports the
work finished (checked by Self::retire_completed, without blocking), or when the ledger is
dropped, whichever comes first. done must not block.
Sourcepub fn retire_completed(&mut self)
pub fn retire_completed(&mut self)
Take back every entry whose probe reports its work finished. Never blocks. Called as the executor walks, so the backlog the picker reads is the work still QUEUED, not everything submitted so far.
Sourcepub fn outstanding_ns(&self, loc: DeviceLocation) -> u64
pub fn outstanding_ns(&self, loc: DeviceLocation) -> u64
What this ledger has added to loc and has outstanding (added minus retired).
Trait Implementations§
Source§impl Debug for BacklogLedger
impl Debug for BacklogLedger
Source§impl Default for BacklogLedger
impl Default for BacklogLedger
Source§impl Drop for BacklogLedger
impl Drop for BacklogLedger
Auto Trait Implementations§
impl !RefUnwindSafe for BacklogLedger
impl !UnwindSafe for BacklogLedger
impl Forget for BacklogLedger
impl Freeze for BacklogLedger
impl Move for BacklogLedger
impl Send for BacklogLedger
impl Sync for BacklogLedger
impl Unpin for BacklogLedger
impl UnsafeUnpin for BacklogLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more