Trait cubecl_runtime::server::ComputeServer
source · pub trait ComputeServer: Send + Debugwhere
Self: Sized,{
type Kernel: Send;
type DispatchOptions: Send;
type Storage: ComputeStorage;
type MemoryManagement: MemoryManagement<Self::Storage>;
type FeatureSet: Send + Sync;
// Required methods
fn read(&mut self, binding: Binding<Self>) -> Reader;
fn get_resource(
&mut self,
binding: Binding<Self>,
) -> <Self::Storage as ComputeStorage>::Resource;
fn create(&mut self, data: &[u8]) -> Handle<Self>;
fn empty(&mut self, size: usize) -> Handle<Self>;
fn execute(
&mut self,
kernel: Self::Kernel,
count: Self::DispatchOptions,
bindings: Vec<Binding<Self>>,
);
fn sync(&mut self, command: SyncType);
}
Expand description
The compute server is responsible for handling resources and computations over resources.
Everything in the server is mutable, therefore it should be solely accessed through the compute channel for thread safety.
Required Associated Types§
sourcetype DispatchOptions: Send
type DispatchOptions: Send
Options when dispatching the kernel, eg. the number of executions.
sourcetype Storage: ComputeStorage
type Storage: ComputeStorage
The storage type defines how data is stored and accessed.
sourcetype MemoryManagement: MemoryManagement<Self::Storage>
type MemoryManagement: MemoryManagement<Self::Storage>
The memory management type defines strategies for allocation in the storage type.
sourcetype FeatureSet: Send + Sync
type FeatureSet: Send + Sync
Features supported by the compute server.
Required Methods§
sourcefn read(&mut self, binding: Binding<Self>) -> Reader
fn read(&mut self, binding: Binding<Self>) -> Reader
Given a handle, returns the owned resource as bytes.
sourcefn get_resource(
&mut self,
binding: Binding<Self>,
) -> <Self::Storage as ComputeStorage>::Resource
fn get_resource( &mut self, binding: Binding<Self>, ) -> <Self::Storage as ComputeStorage>::Resource
Given a resource handle, returns the storage resource.
sourcefn create(&mut self, data: &[u8]) -> Handle<Self>
fn create(&mut self, data: &[u8]) -> Handle<Self>
Given a resource as bytes, stores it and returns the memory handle.
sourcefn empty(&mut self, size: usize) -> Handle<Self>
fn empty(&mut self, size: usize) -> Handle<Self>
Reserves size
bytes in the storage, and returns a handle over them.
Object Safety§
This trait is not object safe.