Trait cubecl_runtime::channel::ComputeChannel
source · pub trait ComputeChannel<Server: ComputeServer>:
Clone
+ Debug
+ Send
+ Sync {
// Required methods
fn read(&self, binding: Binding<Server>) -> Reader;
fn get_resource(
&self,
binding: Binding<Server>,
) -> <Server::Storage as ComputeStorage>::Resource;
fn create(&self, data: &[u8]) -> Handle<Server>;
fn empty(&self, size: usize) -> Handle<Server>;
unsafe fn execute(
&self,
kernel: Server::Kernel,
count: Server::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§
sourcefn read(&self, binding: Binding<Server>) -> Reader
fn read(&self, binding: Binding<Server>) -> Reader
Given a binding, returns owned resource as bytes
sourcefn get_resource(
&self,
binding: Binding<Server>,
) -> <Server::Storage as ComputeStorage>::Resource
fn get_resource( &self, binding: Binding<Server>, ) -> <Server::Storage as ComputeStorage>::Resource
Given a resource handle, return the storage resource.
sourcefn create(&self, data: &[u8]) -> Handle<Server>
fn create(&self, data: &[u8]) -> Handle<Server>
Given a resource as bytes, stores it and returns the resource handle
sourcefn empty(&self, size: usize) -> Handle<Server>
fn empty(&self, size: usize) -> Handle<Server>
Reserves size
bytes in the storage, and returns a handle over them
sourceunsafe fn execute(
&self,
kernel: Server::Kernel,
count: Server::DispatchOptions,
bindings: Vec<Binding<Server>>,
mode: ExecutionMode,
)
unsafe fn execute( &self, kernel: Server::Kernel, count: Server::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.
Object Safety§
This trait is not object safe.