pub struct ExecuteScope<'a, S: WriteScoped> { /* private fields */ }Expand description
One scope around a unit of device work.
Built by over for work that reads nothing it must trust, or
launching for a kernel, which is the only kind that
can be skipped.
Which of the two it is is settled by the constructor and cannot change afterwards. Entering on a skip would be wrong rather than merely wasteful: the provisional failure would be minted, overwritten by the propagated one, and never pruned, because the exit that prunes it is on the path that does not run. Nothing has to remember that, because a scope is one or the other before it exists.
Implementations§
Source§impl<'a, S: WriteScoped> ExecuteScope<'a, S>
impl<'a, S: WriteScoped> ExecuteScope<'a, S>
Sourcepub fn over(
server: &'a mut S,
stream: StreamId,
written: Vec<BufferBinding>,
) -> Self
pub fn over( server: &'a mut S, stream: StreamId, written: Vec<BufferBinding>, ) -> Self
A scope over work that writes written and reads nothing it has to
trust — a host copy, a graph replay, a launch that never compiled.
Such work cannot be skipped, so this always enters.
Sourcepub fn launching<'b>(
server: &'a mut S,
kernel: KernelId,
stream: StreamId,
reads: impl Iterator<Item = &'b BufferBinding>,
written: Vec<BufferBinding>,
) -> Self
pub fn launching<'b>( server: &'a mut S, kernel: KernelId, stream: StreamId, reads: impl Iterator<Item = &'b BufferBinding>, written: Vec<BufferBinding>, ) -> Self
A scope over a launch of kernel on stream, reading reads and
writing written.
Skips, rather than claiming, when an input carries a failure. A launch whose input cannot be trusted does not run: a buffer holding garbage can be read as a dynamic cube count or as gather indices, scattering into memory that carried no failure at all. Its outputs take the failure that stopped it, exactly as a failed launch’s would, so a read downstream fails on the root cause.
Sourcepub fn execute<R>(
self,
body: impl FnOnce(&mut S) -> Result<R, ServerError>,
) -> ScopedOutcome<R>
pub fn execute<R>( self, body: impl FnOnce(&mut S) -> Result<R, ServerError>, ) -> ScopedOutcome<R>
Run body and settle the write set.
A skipped scope never runs it. Otherwise the claim is released if the
body succeeded and replaced with the real error if it did not, and
either way a measurement in flight hears about a failure, and a
recording window hears how the work ended. body may return early
anywhere.
Auto Trait Implementations§
impl<'a, S> !UnwindSafe for ExecuteScope<'a, S>
impl<'a, S> Freeze for ExecuteScope<'a, S>
impl<'a, S> RefUnwindSafe for ExecuteScope<'a, S>where
&'a mut S: RefUnwindSafe,
impl<'a, S> Send for ExecuteScope<'a, S>
impl<'a, S> Sync for ExecuteScope<'a, S>
impl<'a, S> Unpin for ExecuteScope<'a, S>
impl<'a, S> UnsafeUnpin for ExecuteScope<'a, S>where
&'a mut S: UnsafeUnpin,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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