Trait cubecl_core::channel::ComputeChannel
source · pub trait ComputeChannel<Server>: Clone + Debug + Send + Syncwhere
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>;
fn execute(
&self,
kernel: <Server as ComputeServer>::Kernel,
count: <Server as ComputeServer>::DispatchOptions,
bindings: Vec<Binding<Server>>,
);
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>,
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>
fn read( &self, binding: Binding<Server>, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send>>
Given a binding, returns owned resource as bytes
sourcefn get_resource(
&self,
binding: Binding<Server>,
) -> <<Server as ComputeServer>::Storage as ComputeStorage>::Resource
fn get_resource( &self, binding: Binding<Server>, ) -> <<Server as ComputeServer>::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
sourcefn execute(
&self,
kernel: <Server as ComputeServer>::Kernel,
count: <Server as ComputeServer>::DispatchOptions,
bindings: Vec<Binding<Server>>,
)
fn execute( &self, kernel: <Server as ComputeServer>::Kernel, count: <Server as ComputeServer>::DispatchOptions, bindings: Vec<Binding<Server>>, )
Executes the kernel
over the given bindings
.
Object Safety§
This trait is not object safe.