Skip to main content

ComputeBackend

Trait ComputeBackend 

Source
pub trait ComputeBackend: Send + Sync {
Show 13 methods // Required methods fn name(&self) -> &str; fn capabilities(&self) -> BackendCapabilities; fn tensor_ops(&self) -> &dyn TensorOps; fn tensor_factory(&self) -> &dyn TensorFactory; fn memory_manager(&self) -> &dyn DeviceMemoryManager; fn kernel_executor(&self) -> Option<&dyn KernelExecutor>; fn initialize<'life0, 'life1, 'async_trait>( &'life0 mut self, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn supports_device(&self, device: &Device) -> bool; fn version(&self) -> String; fn synchronize<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn status(&self) -> BackendStatus; fn shutdown<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn kernel_ops(&self) -> Option<&dyn KernelOps> { ... }
}
Expand description

Compute backend for tensor operations and kernel execution

Required Methods§

Source

fn name(&self) -> &str

Get backend name/identifier

Source

fn capabilities(&self) -> BackendCapabilities

Get backend capabilities

Source

fn tensor_ops(&self) -> &dyn TensorOps

Get tensor operations interface

Source

fn tensor_factory(&self) -> &dyn TensorFactory

Get tensor factory for creating tensors

Source

fn memory_manager(&self) -> &dyn DeviceMemoryManager

Get memory manager for this backend

Source

fn kernel_executor(&self) -> Option<&dyn KernelExecutor>

Get kernel executor (if backend supports custom kernels)

Source

fn initialize<'life0, 'life1, 'async_trait>( &'life0 mut self, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialize backend with device

Source

fn supports_device(&self, device: &Device) -> bool

Check if backend supports specific device

Source

fn version(&self) -> String

Get backend version

Source

fn synchronize<'life0, 'life1, 'async_trait>( &'life0 self, device: &'life1 Device, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Synchronize all pending operations

Source

fn status(&self) -> BackendStatus

Get backend status

Source

fn shutdown<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Shutdown backend gracefully

Provided Methods§

Source

fn kernel_ops(&self) -> Option<&dyn KernelOps>

Get LLM-specific kernel operations (if backend provides optimized impls).

Returns None by default — existing backends compile unchanged. Backends that implement KernelOps sub-traits (NormOps, PositionOps, etc.) return Some here to enable accelerated paths.

Implementors§