use cubecl::{prelude::*, std::tensor::layout::Coords2d};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StageEvent {
Begin,
LhsLoaded { current: u32, total: u32 },
RhsLoaded { current: u32, total: u32 },
TileMatmulCompleted { current: u32, total: u32 },
Finish,
}
#[cube]
pub trait StageEventListener: CubeType {
fn on_event(this: &mut Self, #[comptime] event: StageEvent);
}
#[derive(CubeType)]
pub struct NoEvent {}
#[cube]
impl StageEventListener for NoEvent {
fn on_event(_this: &mut Self, #[comptime] _event: StageEvent) {
}
}
impl Default for NoEvent {
fn default() -> Self {
Self::new()
}
}
#[cube]
impl NoEvent {
pub fn new() -> NoEvent {
NoEvent {}
}
}
#[derive(CubeType, Debug, Clone, Copy, PartialEq, Eq)]
pub enum WriteEvent {
Begin,
TileStored { tile: Coords2d },
Finish,
}
#[cube]
pub trait WriteEventListener: CubeType {
fn on_event(this: &mut Self, event: WriteEvent);
}