use crate::{codegen::Compiler, compute::CubeTask, ir::Elem};
use cubecl_runtime::{channel::ComputeChannel, client::ComputeClient, server::ComputeServer};
pub use cubecl_runtime::channel;
pub use cubecl_runtime::client;
pub use cubecl_runtime::server;
pub use cubecl_runtime::tune;
pub use cubecl_runtime::ExecutionMode;
pub trait Runtime: Send + Sync + 'static + core::fmt::Debug {
type Compiler: Compiler;
type Server: ComputeServer<Kernel = Box<dyn CubeTask<Self::Compiler>>, Feature = Feature>;
type Channel: ComputeChannel<Self::Server>;
type Device: Default + Clone + core::fmt::Debug;
fn client(device: &Self::Device) -> ComputeClient<Self::Server, Self::Channel>;
fn name() -> &'static str;
fn extension() -> &'static str;
fn require_array_lengths() -> bool {
false
}
fn supported_line_sizes() -> &'static [u8];
fn line_size_elem(elem: &Elem) -> impl Iterator<Item = u8> + Clone {
Self::supported_line_sizes()
.iter()
.filter(|v| **v as usize * elem.size() <= 16)
.cloned() }
fn max_cube_count() -> (u32, u32, u32);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Feature {
Plane,
Cmma {
a: Elem,
b: Elem,
c: Elem,
m: u8,
k: u8,
n: u8,
},
CmmaWarpSize(i32),
Type(Elem),
AtomicFloat(AtomicFeature),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum AtomicFeature {
LoadStore,
Add,
MinMax,
}