use crate::components::{
MatrixPrecision,
global::{WriteEventListener, WriteTiling, memory::GlobalMemoryConfig},
stage::{Stage, StageConfig, StageFamily},
};
use cubecl_core as cubecl;
use cubecl_core::prelude::*;
use cubecl_std::tensor::{View, layout::Coords2d};
pub trait GlobalWriterFamily: 'static + Send + Sync {
type Stage: StageFamily<ReadWrite>;
type Writer<IP: MatrixPrecision>: GlobalWriter<
IP,
Stage = <Self::Stage as StageFamily<ReadWrite>>::Stage<IP::Stage, WriteTiling>,
>;
}
#[cube]
pub trait GlobalWriter<IP: MatrixPrecision>:
WriteEventListener + CubeType + 'static + Send + Sync
{
type Stage: Stage<IP::Stage, ReadWrite>;
fn init<S: StageConfig>(
tensor: View<Line<IP::Global>, Coords2d, ReadWrite>,
#[comptime] config: GlobalMemoryConfig,
#[comptime] stage_config: S,
) -> Self;
fn stage(this: &Self) -> Self::Stage;
}