Skip to main content

PreparedLaunch

Struct PreparedLaunch 

Source
pub struct PreparedLaunch<K: KernelSignature> { /* private fields */ }
Expand description

A typed kernel and checked configuration retaining the native code owner.

Preparation checks the signature and launch requirements. It does not launch work, initialize output storage, or prove argument-dependent accesses valid. Immediate submissions, capture and graph-node creation share this configuration. Executable-node updates reuse its geometry and preserve the executable’s existing attributes.

Implementations§

Source§

impl<K: KernelSignature> PreparedLaunch<K>

Source

pub unsafe fn create( function: &KernelFunction, config: LaunchConfig, ) -> Result<Self>

Binds this signature to a kernel and checks its ABI and launch requirements.

§Safety

K’s access modes and launch requirements must describe this function. Parameter count and representation mismatches are rejected. CUDA metadata does not verify struct field layouts or semantic identity. Explicit struct mappings must match the device field layout.

§Errors

Returns a LaunchContractError for parameter count or layout mismatches, layout overflow, incompatible launch requirements, or exceeded function or device limits. Also propagates context binding, native parameter or attribute query, occupancy, resource query, and integer conversion errors. No work is launched on success.

Source

pub fn function(&self) -> &KernelFunction

Returns the retained context-specific kernel function.

Source

pub fn config(&self) -> &LaunchConfig

Returns the checked launch configuration.

Source

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

Returns the context in which the function’s module was loaded.

Source

pub fn validate_stream(&self, stream: &Stream) -> Result<()>

Checks that stream belongs to the prepared kernel’s context.

§Errors

Returns CudaError::StreamContextMismatch if stream belongs to a different context.

Source

pub unsafe fn launch_async( &self, arguments: K::Arguments<'_>, stream: &Stream, ) -> Result<()>

Submits a launch on an explicit stream in this kernel’s context.

§Safety

Values and views must satisfy the kernel’s bounds, initialization and semantic requirements. Preserve storage lifetimes and exclusive writable access until execution completes, including every graph replay when stream is capturing. Keep this prepared launch or another owner of its kernel code alive through completion.

§Errors

Propagates typed argument conversion and view-context errors from KernelSignature::raw_arguments. Returns CudaError::StreamContextMismatch if stream belongs to another context, and propagates context binding and native launch errors from KernelFunction::launch_async.

Source

pub unsafe fn record( &self, arguments: K::Arguments<'_>, scope: &StreamCaptureScope<'_>, ) -> Result<()>

Records a launch in the active capture and retains the kernel’s code for replay.

§Safety

Values and views must satisfy the kernel’s bounds, initialization and semantic requirements for every replay. Preserve storage lifetimes and exclusive writable access until all graph executions complete. Keep a graph, executable or another code owner alive until queued executions complete.

§Errors

Propagates typed argument conversion and view-context errors from KernelSignature::raw_arguments. Returns CudaError::StreamContextMismatch if the capture stream belongs to another context, and propagates context binding and native launch errors.

Source

pub unsafe fn add_to_graph( &self, arguments: K::Arguments<'_>, graph: &mut Graph, dependencies: &[GraphNode], ) -> Result<GraphNode>

Adds a graph node with this launch’s configuration and retains the kernel’s code.

§Safety

Values and views must satisfy the kernel’s bounds, initialization and semantic requirements for every replay. Preserve storage lifetimes and exclusive writable access until all graph executions complete. Keep a graph, executable or another code owner alive until queued executions complete.

§Errors

Propagates typed argument conversion and view-context errors from KernelSignature::raw_arguments. Also propagates graph-context, dependency ownership, context binding, and native node creation or launch-attribute errors from KernelFunction::add_to_graph.

Source

pub unsafe fn set_graph_node_params( &self, arguments: K::Arguments<'_>, executable: &mut ExecutableGraph, node: &GraphNode, ) -> Result<()>

Updates an executable node with this launch’s geometry and arguments, retaining the kernel’s code.

§Safety

Values and views must satisfy the kernel’s bounds, initialization and semantic requirements for all future executions. Preserve storage lifetimes and exclusive writable access until all executions using them complete. Keep the executable or another code owner alive until queued executions complete. Only this launch’s geometry is applied; executable attributes remain unchanged and must satisfy K.

§Errors

Propagates typed argument conversion and view-context errors from KernelSignature::raw_arguments. Also propagates executable-context, node ownership, context binding, and native update errors from KernelFunction::set_graph_node_params.

Source§

impl<K: KernelSignature> PreparedLaunch<K>

Source

pub unsafe fn into_operation<T: 'static>( self, arguments: K::Arguments<'_>, resources: Resources, output: T, ) -> Result<KernelOperation<K, T>>

Binds owned resources to this prepared launch without enqueueing work.

§Safety

Arguments must satisfy the kernel’s bounds, value, aliasing and output coverage contracts. Retain every pointed-to allocation and declare all accesses in resources. output must preserve pending initialization until successful completion, including capture.

§Errors

Propagates typed argument conversion and view-context errors from KernelSignature::raw_arguments.

Trait Implementations§

Source§

impl<K: KernelSignature> Clone for PreparedLaunch<K>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: KernelSignature> Debug for PreparedLaunch<K>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<K> !RefUnwindSafe for PreparedLaunch<K>

§

impl<K> !UnwindSafe for PreparedLaunch<K>

§

impl<K> Forget for PreparedLaunch<K>

§

impl<K> Freeze for PreparedLaunch<K>
where PhantomData<fn() -> K>: Freeze,

§

impl<K> Move for PreparedLaunch<K>

§

impl<K> Send for PreparedLaunch<K>
where PhantomData<fn() -> K>: Send,

§

impl<K> Sync for PreparedLaunch<K>
where PhantomData<fn() -> K>: Sync,

§

impl<K> Unpin for PreparedLaunch<K>
where PhantomData<fn() -> K>: Unpin,

§

impl<K> UnsafeUnpin for PreparedLaunch<K>
where PhantomData<fn() -> K>: UnsafeUnpin,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.