Skip to main content

Tile

Struct Tile 

Source
pub struct Tile<N: Numeric, Sc: TileScope> { /* private fields */ }
Expand description

Public tile type. Wraps a [TileKind] payload; the inner enum is crate-private and callers construct via Tile::new_*.

Implementations§

Source§

impl<N: Numeric, Sc: TileScope> Tile<N, Sc>

Source

pub fn new_SharedTile(t: SharedTile<N>) -> Tile<N, Sc>

Source

pub fn new_Stage(t: StageTile<N>) -> Tile<N, Sc>

Source

pub fn new_Partition(t: PartitionTile<N, Sc>) -> Tile<N, Sc>

Source

pub fn new_Pipelined(t: PipelinedTile<N, Sc>) -> Tile<N, Sc>

Source

pub fn new_None() -> Tile<N, Sc>

Source

pub fn new_RowWise(t: RowWise<N>) -> Tile<N, Sc>

Source

pub fn partition_tile_at_mut( &mut self, m: usize, n: usize, n_cols: usize, ) -> &mut Tile<N, Sc>

Mutable reference to the (m, n) element of a Partition tile.

Source

pub fn __expand_new_SharedTile( scope: &Scope, t: <SharedTile<N> as CubeType>::ExpandType, ) -> <Tile<N, Sc> as CubeType>::ExpandType

Source

pub fn __expand_new_Stage( scope: &Scope, t: <StageTile<N> as CubeType>::ExpandType, ) -> <Tile<N, Sc> as CubeType>::ExpandType

Source

pub fn __expand_new_Partition( scope: &Scope, t: <PartitionTile<N, Sc> as CubeType>::ExpandType, ) -> <Tile<N, Sc> as CubeType>::ExpandType

Source

pub fn __expand_new_Pipelined( scope: &Scope, t: <PipelinedTile<N, Sc> as CubeType>::ExpandType, ) -> <Tile<N, Sc> as CubeType>::ExpandType

Source

pub fn __expand_new_None(scope: &Scope) -> <Tile<N, Sc> as CubeType>::ExpandType

Source

pub fn __expand_new_RowWise( scope: &Scope, t: <RowWise<N> as CubeType>::ExpandType, ) -> <Tile<N, Sc> as CubeType>::ExpandType

Source

pub fn __expand_partition_tile_at_mut<'infer, 'scope>( scope: &'scope Scope, this: &'infer mut <Self as CubeType>::ExpandType, m: usize, n: usize, n_cols: usize, ) -> &'infer mut <Tile<N, Sc> as CubeType>::ExpandType

Mutable reference to the (m, n) element of a Partition tile.

Source§

impl<N: Numeric, Sc: TileScope> Tile<N, Sc>

Source

pub fn init_zero<L: Numeric, R: Numeric>(&mut self, ident: StageIdent)

Zero-initialize the tile in place. L/R are only consulted on MMA.

Source

pub fn copy_from<SE: Numeric, SS: Size, L: Numeric, R: Numeric, A: Numeric>( &mut self, source: &Tile<SE, Sc>, ident: StageIdent, )

Copy source into self. SS is the smem vector size involved in the copy; L/R/A are only consulted on MMA paths.

Source

pub fn __expand_init_zero<L: Numeric, R: Numeric>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, ident: StageIdent, )

Zero-initialize the tile in place. L/R are only consulted on MMA.

Source

pub fn __expand_copy_from<SE: Numeric, SS: Size, L: Numeric, R: Numeric, A: Numeric>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, source: &<Tile<SE, Sc> as CubeType>::ExpandType, ident: StageIdent, )

Copy source into self. SS is the smem vector size involved in the copy; L/R/A are only consulted on MMA paths.

Source§

impl<E: Float> Tile<E, Plane>

Source

pub fn scale_and_mask<M: Mask>(&mut self, scale: E, mask: &M)

Multiply by scale and add -inf at masked positions.

Source

pub fn fill_zero(&mut self)

Source

pub fn __expand_scale_and_mask<M: Mask>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, scale: <E as CubeType>::ExpandType, mask: &<M as CubeType>::ExpandType, )

Multiply by scale and add -inf at masked positions.

Source

pub fn __expand_fill_zero( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, )

Source§

impl<N: Numeric, Sc: TileScope> Tile<N, Sc>

Source

pub fn load_mask_from_strided_tile<E: Numeric, ES: Size>( &mut self, tile: &StridedTile<E, ES>, )

Materialize a mask fragment from a StridedTile into Unit or WhiteboxFragment.

Source

pub fn __expand_load_mask_from_strided_tile<E: Numeric, ES: Size>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, tile: &<StridedTile<E, ES> as CubeType>::ExpandType, )

Materialize a mask fragment from a StridedTile into Unit or WhiteboxFragment.

Source§

impl<N: Numeric, Sc: TileScope> Tile<N, Sc>

Source

pub fn mma<L: Numeric, R: Numeric>( &mut self, lhs: &Tile<L, Sc>, rhs: &Tile<R, Sc>, )

self += lhs · rhs. For (Stage, Stage, Partition) use Tile::mma_partition.

Source

pub fn mma_partition<LhsS: Numeric, LhsSize: Size, LhsR: Numeric, RhsS: Numeric, RhsSize: Size, RhsR: Numeric, SEL: StageEventListener>( &mut self, lhs: &Tile<LhsS, Sc>, rhs: &Tile<RhsS, Sc>, a_fragment: &mut Sequence<Tile<LhsR, Sc>>, b_fragments: &mut Tile<RhsR, Sc>, partition_size_k: u32, listener: SEL, scheduler: &PartitionScheduler, )

mma for (Stage, Stage, Partition) operands with rhs fragments held under TileKind::Pipelined.

Source

pub fn __expand_mma<L: Numeric, R: Numeric>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, lhs: &<Tile<L, Sc> as CubeType>::ExpandType, rhs: &<Tile<R, Sc> as CubeType>::ExpandType, )

self += lhs · rhs. For (Stage, Stage, Partition) use Tile::mma_partition.

Source

pub fn __expand_mma_partition<LhsS: Numeric, LhsSize: Size, LhsR: Numeric, RhsS: Numeric, RhsSize: Size, RhsR: Numeric, SEL: StageEventListener>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, lhs: &<Tile<LhsS, Sc> as CubeType>::ExpandType, rhs: &<Tile<RhsS, Sc> as CubeType>::ExpandType, a_fragment: &mut <Sequence<Tile<LhsR, Sc>> as CubeType>::ExpandType, b_fragments: &mut <Tile<RhsR, Sc> as CubeType>::ExpandType, partition_size_k: u32, listener: <SEL as CubeType>::ExpandType, scheduler: &<PartitionScheduler as CubeType>::ExpandType, )

mma for (Stage, Stage, Partition) operands with rhs fragments held under TileKind::Pipelined.

Source§

impl<N: Numeric, Sc: TileScope> Tile<N, Sc>

Source

pub fn partition<P: Partitioner>( &self, compute_index: u32, plane_dim: u32, num_partitions_col: u32, ) -> Tile<N, P::OutputScope>

View of self at the partitioner’s output scope. Source must be a TileKind::Stage.

Source

pub fn __expand_partition<P: Partitioner>( scope: &Scope, this: &<Self as CubeType>::ExpandType, compute_index: <u32 as CubeType>::ExpandType, plane_dim: u32, num_partitions_col: u32, ) -> <Tile<N, P::OutputScope> as CubeType>::ExpandType

View of self at the partitioner’s output scope. Source must be a TileKind::Stage.

Source§

impl<E: Float> Tile<E, Plane>

Source

pub fn row_max(&self, acc: &mut RowWise<E>, base: &RowWise<E>)

Source

pub fn row_sum(&self, acc: &mut RowWise<E>)

Source

pub fn exp_diff(&mut self, rowwise: &RowWise<E>)

Source

pub fn rowwise_scale(&mut self, scale: &RowWise<E>)

Source

pub fn scale_mul<SM: Float>(&mut self, scale: &RowWise<SM>)

Multiply each row of self by scale[r]. The Bounce arm round-trips through smem to keep the cmma fragment current.

Source

pub fn scale_div<SM: Float>(&mut self, running_state_l: &RowWise<SM>)

Divide each row by running_state_l[r]; fully-masked rows stay zero.

Source

pub fn __expand_row_max( scope: &Scope, this: &<Self as CubeType>::ExpandType, acc: &mut <RowWise<E> as CubeType>::ExpandType, base: &<RowWise<E> as CubeType>::ExpandType, )

Source

pub fn __expand_row_sum( scope: &Scope, this: &<Self as CubeType>::ExpandType, acc: &mut <RowWise<E> as CubeType>::ExpandType, )

Source

pub fn __expand_exp_diff( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, rowwise: &<RowWise<E> as CubeType>::ExpandType, )

Source

pub fn __expand_rowwise_scale( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, scale: &<RowWise<E> as CubeType>::ExpandType, )

Source

pub fn __expand_scale_mul<SM: Float>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, scale: &<RowWise<SM> as CubeType>::ExpandType, )

Multiply each row of self by scale[r]. The Bounce arm round-trips through smem to keep the cmma fragment current.

Source

pub fn __expand_scale_div<SM: Float>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, running_state_l: &<RowWise<SM> as CubeType>::ExpandType, )

Divide each row by running_state_l[r]; fully-masked rows stay zero.

Source§

impl<Acc: Float> Tile<Acc, Plane>

Source

pub fn softmax<Lhs: Float, M: Mask>( &mut self, mask: &M, softmaxed_tile: &mut Tile<Lhs, Plane>, state: &mut (RowWise<Acc>, RowWise<Acc>), head_dim_factor: Acc, ) -> RowWise<Acc>

Online softmax update fused with the precision-cast write into the value-matmul lhs tile.

Source

pub fn write_results<DE: Float, DS: Size>(&self, dest: &mut Tile<DE, Plane>)

Copy self into dest.

Source

pub fn __expand_softmax<Lhs: Float, M: Mask>( scope: &Scope, this: &mut <Self as CubeType>::ExpandType, mask: &<M as CubeType>::ExpandType, softmaxed_tile: &mut <Tile<Lhs, Plane> as CubeType>::ExpandType, state: &mut (<RowWise<Acc> as CubeType>::ExpandType, <RowWise<Acc> as CubeType>::ExpandType), head_dim_factor: <Acc as CubeType>::ExpandType, ) -> <RowWise<Acc> as CubeType>::ExpandType

Online softmax update fused with the precision-cast write into the value-matmul lhs tile.

Source

pub fn __expand_write_results<DE: Float, DS: Size>( scope: &Scope, this: &<Self as CubeType>::ExpandType, dest: &mut <Tile<DE, Plane> as CubeType>::ExpandType, )

Copy self into dest.

Trait Implementations§

Source§

impl<N: Numeric, Sc: TileScope> CubeType for Tile<N, Sc>

Source§

impl<E: Numeric, Sc: TileScope> Mask for Tile<E, Sc>

Source§

fn should_mask(&self, local_pos: Coords2d) -> bool

Source§

fn __expand_should_mask( scope: &Scope, this: &<Self as CubeType>::ExpandType, local_pos: <Coords2d as CubeType>::ExpandType, ) -> <bool as CubeType>::ExpandType

Auto Trait Implementations§

§

impl<N, Sc> !Send for Tile<N, Sc>

§

impl<N, Sc> !Sync for Tile<N, Sc>

§

impl<N, Sc> Freeze for Tile<N, Sc>
where N: Freeze,

§

impl<N, Sc> RefUnwindSafe for Tile<N, Sc>

§

impl<N, Sc> Unpin for Tile<N, Sc>
where Sc: Unpin, N: Unpin,

§

impl<N, Sc> UnsafeUnpin for Tile<N, Sc>
where N: UnsafeUnpin,

§

impl<N, Sc> UnwindSafe for Tile<N, Sc>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.