Skip to main content

LaunchRecorder

Struct LaunchRecorder 

Source
pub struct LaunchRecorder { /* private fields */ }
Expand description

Records buffer uses for a single launch or copy on launch_stream. Consume it with Self::enqueue, then consume the returned EnqueuedLaunch with commit or abort. Dropping a prepared transaction automatically aborts it and never panics.

§Lifetime model

Registration clones the actual backing owner, not the device bytes, and immediately releases the source borrow. Callers can subsequently borrow mutable kernel parameters. Internal bare block identities are validated against the retained runtime’s allocator during atomic admission.

§Required public call order for non-empty recorders

Self::enqueue MUST own the recorder and the closure MUST enqueue every operation synchronously on its supplied stream. Preparation queues the cross-stream waits each recorded access kind requires (read waits on prior writes; write waits on prior writes and prior reads), so the operation sees a well-fenced view of every input. EnqueuedLaunch::commit then records the new event on launch_stream so future operations can wait on it.

During managed stream capture, the same registration transfers passive allocation owners and access ranges to the graph without recording events. Each replay admits its complete manifest before submitting device work. Nested kernels and graphs use the supplied CudaEnqueue through their launch_in methods, without preparing another recorder inside the callback.

Empty recorders (no read/write/… calls) are a no-op and bypass runtime preparation: there are no waits to queue, no events to record.

Implementations§

Source§

impl LaunchRecorder

Source

pub fn new_permissive(launch_stream: StreamId) -> Self

Recorder for an unbound execution domain. Owner-bearing inputs are retained.

Source

pub fn new_strict(launch_stream: StreamId) -> Self

Recorder eligible for a sealed resident execution domain.

Source

pub fn launch_stream(&self) -> StreamId

Configured launch stream.

Source

pub fn mode(&self) -> RecorderMode

Configured mode.

Source

pub fn read<T: DeviceRepr>( &mut self, slice: &(impl DeviceRead<T> + ?Sized), ) -> &mut Self

Retain the actual allocation/import owner and record its exact read span.

Source

pub fn write<T: DeviceRepr>( &mut self, slice: &(impl DeviceWrite<T> + ?Sized), ) -> &mut Self

Retain the actual owner and record the exact writable span, including fresh output allocations and independently imported aliases.

Source

pub fn read_write<T: DeviceRepr>( &mut self, slice: &(impl DeviceWrite<T> + ?Sized), ) -> &mut Self

Retain an owner-bearing span used for both reading and writing.

Source

pub fn read_column(&mut self, col: &CudaColumn) -> &mut Self

Record a column read and retain its allocation or external import token.

Source

pub fn write_column(&mut self, col: &CudaColumn) -> &mut Self

Record a crate::memory::CudaColumn the launch will write.

Source

pub fn recorded_count(&self) -> usize

Number of recorded registrations before deduplication. Diagnostic.

Source

pub unsafe fn enqueue<E, F>( self, runtime: &Arc<XlogDeviceRuntime>, operation: F, ) -> Result<EnqueuedLaunch, LaunchEnqueueError<E>>
where F: FnOnce(&CudaEnqueue<'_>) -> Result<(), E>,

Prepare the recorded uses and synchronously invoke one enqueue operation.

§Safety

operation must enqueue all work synchronously before it returns and use only the supplied enqueue capability. Every XLOG-owned allocation it touches must be registered on this recorder with its exact access mode. Nested operations must reuse that capability rather than admitting another recorder or submitting independently on its raw stream.

Trait Implementations§

Source§

impl Drop for LaunchRecorder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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<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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.