use cubecl::tune::Work;
#[derive(Debug, Clone, PartialEq)]
pub struct KernelEstimate {
pub cubes: Option<u64>,
pub cube: CubeFootprint,
pub demand: Option<Work>,
pub staging: Option<CubeStaging>,
pub work: Option<UnitWork>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CubeFootprint {
pub units: u32,
pub shared_memory: usize,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CubeStaging {
pub operations: f64,
pub reads: Vec<GlobalStream>,
pub writes: Vec<GlobalStream>,
pub stages: u64,
pub stages_in_flight: u32,
pub drain_atomics: u64,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct GlobalStream {
pub bytes: u64,
pub run_bytes: usize,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct UnitWork {
pub instruction: ArithmeticInstruction,
pub registers: u32,
}
impl UnitWork {
pub fn beside(self, other: UnitWork) -> UnitWork {
debug_assert_eq!(
self.instruction, other.instruction,
"work held beside other work runs on the same instruction"
);
UnitWork {
instruction: self.instruction,
registers: self.registers + other.registers,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ArithmeticInstruction {
Vector,
Matrix,
}