pub trait BatchKernel<I, O>: GpuKernel{
// Required method
fn execute<'life0, 'async_trait>(
&'life0 self,
input: I,
) -> Pin<Box<dyn Future<Output = Result<O>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn validate_input(&self, _input: &I) -> Result<()> { ... }
fn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
input: I,
) -> Pin<Box<dyn Future<Output = Result<O>> + Send + 'async_trait>>
where I: 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn execute_with_timeout<'life0, 'async_trait>(
&'life0 self,
input: I,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<O>> + Send + 'async_trait>>
where I: 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Trait for batch (CPU-orchestrated) kernels.
Batch kernels are launched on-demand with CPU orchestration. They have 10-50μs launch overhead and state resides in CPU memory.
§Enterprise Features (0.3.1)
execute_with_context()- Execute with auth, tenant, and tracing contextexecute_with_timeout()- Execute with deadline enforcement
§Type Parameters
I: Input typeO: Output type
Required Methods§
Provided Methods§
Sourcefn validate_input(&self, _input: &I) -> Result<()>
fn validate_input(&self, _input: &I) -> Result<()>
Validate the input before execution.
Override to provide custom input validation.
Sourcefn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
input: I,
) -> Pin<Box<dyn Future<Output = Result<O>> + Send + 'async_trait>>where
I: 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
input: I,
) -> Pin<Box<dyn Future<Output = Result<O>> + Send + 'async_trait>>where
I: 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the kernel with execution context.
Provides authentication, tenant isolation, and distributed tracing context for the kernel execution.
§Arguments
ctx- The execution context with auth, tenant, and tracing infoinput- The input data for the kernel
§Returns
The kernel output or an error.
§Default Implementation
Delegates to execute() ignoring the context. Override to use context.