use core::future::Future;
use cubecl_common::{ExecutionMode, benchmark::ProfileDuration};
use crate::{
server::{Binding, BindingWithMeta, Bindings, ComputeServer, CubeCount, Handle},
storage::{BindingResource, ComputeStorage},
};
use alloc::vec::Vec;
pub trait ComputeChannel<Server: ComputeServer>: Clone + core::fmt::Debug + Send + Sync {
fn read(&self, bindings: Vec<Binding>) -> impl Future<Output = Vec<Vec<u8>>> + Send;
fn read_tensor(
&self,
bindings: Vec<BindingWithMeta>,
) -> impl Future<Output = Vec<Vec<u8>>> + Send;
fn get_resource(
&self,
binding: Binding,
) -> BindingResource<<Server::Storage as ComputeStorage>::Resource>;
fn create(&self, data: &[u8]) -> Handle;
fn create_tensor(&self, data: &[u8], shape: &[usize], elem_size: usize)
-> (Handle, Vec<usize>);
fn empty(&self, size: usize) -> Handle;
fn empty_tensor(&self, shape: &[usize], elem_size: usize) -> (Handle, Vec<usize>);
unsafe fn execute(
&self,
kernel: Server::Kernel,
count: CubeCount,
bindings: Bindings,
mode: ExecutionMode,
);
fn flush(&self);
fn sync(&self) -> impl Future<Output = ()> + Send;
fn memory_usage(&self) -> crate::memory_management::MemoryUsage;
fn memory_cleanup(&self);
fn start_profile(&self);
fn end_profile(&self) -> ProfileDuration;
}