use cubecl::{prelude::*, std::tensor::layout::Coords2d};
use crate::{
stage::{StageMemoryConfig, TilingLayout},
tile::{Tile, TileScope},
};
#[cube]
pub trait Stage<ES: Numeric>: CubeType<ExpandType: Clone> + Clone + 'static {
fn tile<Sc: TileScope>(this: &Self, tile: Coords2d) -> Tile<ES, Sc>;
fn as_stage_tile<Sc: TileScope>(this: &Self) -> Tile<ES, Sc>;
}
pub trait StageFamily: Send + Sync + 'static {
type Stage<ES: Numeric, NS: Size, T: TilingLayout>: Stage<ES>;
}
#[cube]
pub trait LoadStageFamily: StageFamily {
fn create<ES: Numeric, NS: Size, T: TilingLayout>(
#[comptime] alignment: usize,
#[comptime] config: StageMemoryConfig,
) -> Self::Stage<ES, NS, T>;
fn with_buffer_index<ES: Numeric, NS: Size, T: TilingLayout>(
stage: &Self::Stage<ES, NS, T>,
buffer_index: u32,
) -> Self::Stage<ES, NS, T>;
fn free<ES: Numeric, NS: Size, T: TilingLayout>(stage: &Self::Stage<ES, NS, T>);
}