pub trait ComputeServer: Send + Debugwhere
Self: Sized,{
type Kernel: Send;
type Storage: ComputeStorage;
type MemoryManagement: MemoryManagement<Self::Storage>;
type AutotuneKey: AutotuneKey;
// Required methods
fn read(&mut self, handle: &Handle<Self>) -> Reader<Vec<u8>>;
fn create(&mut self, data: &[u8]) -> Handle<Self>;
fn empty(&mut self, size: usize) -> Handle<Self>;
fn execute(&mut self, kernel: Self::Kernel, handles: &[&Handle<Self>]);
fn sync(&mut self);
}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 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 AutotuneKey: AutotuneKey
type AutotuneKey: AutotuneKey
The key used to cache operations used on specific inputs in autotune
Required Methods§
Sourcefn read(&mut self, handle: &Handle<Self>) -> Reader<Vec<u8>>
fn read(&mut self, handle: &Handle<Self>) -> Reader<Vec<u8>>
Given a handle, returns the owned resource as bytes.
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.