Trait cubecl_core::channel::ComputeChannel

source ·
pub trait ComputeChannel<Server>:
    Clone
    + Debug
    + Send
    + Sync
where Server: ComputeServer,
{ // Required methods fn read( &self, binding: Binding<Server>, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>; fn get_resource( &self, binding: Binding<Server>, ) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource; fn create(&self, data: &[u8]) -> Handle<Server>; fn empty(&self, size: usize) -> Handle<Server>; unsafe fn execute( &self, kernel: <Server as ComputeServer>::Kernel, count: <Server as ComputeServer>::DispatchOptions, bindings: Vec<Binding<Server>>, mode: ExecutionMode, ); fn sync(&self, sync_type: SyncType); }
Expand description

The ComputeChannel trait links the ComputeClient to the ComputeServer while ensuring thread-safety

Required Methods§

source

fn read( &self, binding: Binding<Server>, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>

Given a binding, returns owned resource as bytes

source

fn get_resource( &self, binding: Binding<Server>, ) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource

Given a resource handle, return the storage resource.

source

fn create(&self, data: &[u8]) -> Handle<Server>

Given a resource as bytes, stores it and returns the resource handle

source

fn empty(&self, size: usize) -> Handle<Server>

Reserves size bytes in the storage, and returns a handle over them

source

unsafe fn execute( &self, kernel: <Server as ComputeServer>::Kernel, count: <Server as ComputeServer>::DispatchOptions, bindings: Vec<Binding<Server>>, mode: ExecutionMode, )

Executes the kernel over the given bindings.

§Safety

When executing with mode ExecutionMode::Unchecked, out-of-bound reads and writes can happen.

source

fn sync(&self, sync_type: SyncType)

Perform some synchronization of commands on the server.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Server> ComputeChannel<Server> for MpscComputeChannel<Server>
where Server: ComputeServer + 'static,

source§

impl<Server> ComputeChannel<Server> for MutexComputeChannel<Server>
where Server: ComputeServer,

source§

impl<Server> ComputeChannel<Server> for RefCellComputeChannel<Server>
where Server: ComputeServer + Send,