Skip to main content

cubek_std/tile/data/
kind.rs

1use cubecl::prelude::*;
2
3use crate::tile::data::strided::StridedTile;
4
5/// Kind (family) of the tiles returned by a stage and ingested by a tile matmul reader
6pub trait TileKind<IO: SliceVisibility = ReadOnly>: CubeType + Send + Sync + 'static {
7    /// Concrete tile instantiated with the element type
8    type Tile<E: Numeric, N: Size>: CubeType;
9}
10
11/// Tile is a slice of memory with a stride
12#[derive(CubeType)]
13pub struct Strided {}
14
15/// Tile is a single value that gets filled in everywhere
16#[derive(CubeType)]
17pub struct Filled {}
18
19impl<IO: SliceVisibility> TileKind<IO> for Strided {
20    type Tile<E: Numeric, N: Size> = StridedTile<E, N, IO>;
21}
22
23impl TileKind<ReadOnly> for Filled {
24    type Tile<E: Numeric, N: Size> = E;
25}
26
27impl<Inner: TileKind<IO>, IO: SliceVisibility> TileKind<IO> for Option<Inner> {
28    type Tile<E: Numeric, N: Size> = ComptimeOption<Inner::Tile<E, N>>;
29}