Skip to main content

StreamScope

Struct StreamScope 

Source
pub struct StreamScope<'scope, 'env> { /* private fields */ }
Expand description

A borrowed stream scope that drains queued work before borrowed storage can be released.

Constructed by Stream::sync_scope. Cleanup also drains during unwinding and aborts the process if completion cannot be established.

Implementations§

Source§

impl<'scope> StreamScope<'scope, '_>

Source

pub unsafe fn enqueue<T>( &self, accesses: &[Access], enqueue: impl FnOnce() -> Result<T>, ) -> Result<T>

Enqueues work on the scope’s stream after declaring the accesses it makes.

The declared accesses order the work after conflicting tracked work and make later tracked work wait for it. Wrapper _scoped functions use this to record their operands’ accesses.

§Safety

enqueue must only enqueue work on Self::stream that touches the declared accesses, in the declared modes. Borrowed operands must be 'env borrows, which the scope keeps alive until it drains.

§Errors

Propagates access-tracking, dependency-ordering, and completion-event errors, and errors returned by enqueue.

Source

pub const fn stream(&self) -> &'scope Stream

Returns the stream borrowed by this synchronous scope.

Trait Implementations§

Source§

impl AsStream for StreamScope<'_, '_>

Source§

fn context(&self) -> &Arc<Context> ⓘ

Returns the context the stream belongs to.
Source§

fn as_raw(&self) -> cudaStream_t

Returns the native stream handle without transferring ownership.
Source§

fn synchronize(&self) -> Result<()>

Blocks until the stream has completed all queued work. Read more
Source§

fn synchronize_or_abort(&self)

Waits for queued work on the stream, or prints the error and aborts the process if the wait fails. Read more
Source§

fn capture_status(&self) -> Result<StreamCaptureStatus>

Reports the stream’s capture state without invalidating an active capture. Read more
Source§

fn ensure_not_capturing(&self) -> Result<()>

Rejects active or invalidated capture before an operation that cannot be recorded. Read more
Source§

fn wait_event(&self, event: &Event, flags: EventWaitFlags) -> Result<()>

Makes work submitted to the stream after this call wait for the work captured in event. Read more
Source§

fn join_regions(&self, regions: &[DeviceRegion<'_>]) -> Result<()>

Orders subsequent work on the stream after the readiness streams of these device regions. Read more
Source§

impl<'scope, 'env> Debug for StreamScope<'scope, 'env>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'scope, 'env> !RefUnwindSafe for StreamScope<'scope, 'env>

§

impl<'scope, 'env> !UnwindSafe for StreamScope<'scope, 'env>

§

impl<'scope, 'env> Forget for StreamScope<'scope, 'env>

§

impl<'scope, 'env> Freeze for StreamScope<'scope, 'env>

§

impl<'scope, 'env> Move for StreamScope<'scope, 'env>

§

impl<'scope, 'env> Send for StreamScope<'scope, 'env>

§

impl<'scope, 'env> Sync for StreamScope<'scope, 'env>

§

impl<'scope, 'env> Unpin for StreamScope<'scope, 'env>

§

impl<'scope, 'env> UnsafeUnpin for StreamScope<'scope, 'env>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.