BatchKernel

Trait BatchKernel 

Source
pub trait BatchKernel<I, O>: GpuKernel
where I: Send + Sync, O: Send + Sync,
{ // 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 context
  • execute_with_timeout() - Execute with deadline enforcement

§Type Parameters

  • I: Input type
  • O: Output type

Required Methods§

Source

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,

Execute the kernel with the given input.

§Arguments
  • input - The input data for the kernel
§Returns

The kernel output or an error.

Provided Methods§

Source

fn validate_input(&self, _input: &I) -> Result<()>

Validate the input before execution.

Override to provide custom input validation.

Source

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 info
  • input - 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.

Source

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,

Execute the kernel with a timeout.

§Arguments
  • input - The input data for the kernel
  • timeout - Maximum execution time
§Returns

The kernel output or a timeout error.

Implementors§