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>
impl<K: KernelSignature> PreparedLaunch<K>
Sourcepub unsafe fn create(
function: &KernelFunction,
config: LaunchConfig,
) -> Result<Self>
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.
Sourcepub fn function(&self) -> &KernelFunction
pub fn function(&self) -> &KernelFunction
Returns the retained context-specific kernel function.
Sourcepub fn config(&self) -> &LaunchConfig
pub fn config(&self) -> &LaunchConfig
Returns the checked launch configuration.
Sourcepub fn context(&self) -> &Arc<Context> ⓘ
pub fn context(&self) -> &Arc<Context> ⓘ
Returns the context in which the function’s module was loaded.
Sourcepub fn validate_stream(&self, stream: &Stream) -> Result<()>
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.
Sourcepub unsafe fn launch_async(
&self,
arguments: K::Arguments<'_>,
stream: &Stream,
) -> Result<()>
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.
Sourcepub unsafe fn record(
&self,
arguments: K::Arguments<'_>,
scope: &StreamCaptureScope<'_>,
) -> Result<()>
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.
Sourcepub unsafe fn add_to_graph(
&self,
arguments: K::Arguments<'_>,
graph: &mut Graph,
dependencies: &[GraphNode],
) -> Result<GraphNode>
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.
Sourcepub unsafe fn set_graph_node_params(
&self,
arguments: K::Arguments<'_>,
executable: &mut ExecutableGraph,
node: &GraphNode,
) -> Result<()>
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>
impl<K: KernelSignature> PreparedLaunch<K>
Sourcepub unsafe fn into_operation<T: 'static>(
self,
arguments: K::Arguments<'_>,
resources: Resources,
output: T,
) -> Result<KernelOperation<K, T>>
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.