pub trait TileMatmul<L: Numeric, R: Numeric, A: Numeric>:
'static
+ Send
+ Sync {
type Config: TileConfig;
type LhsFragment: CubeType;
type RhsFragment: CubeType;
type AccFragment: CubeType;
type LhsTile: TileKind;
type RhsTile: TileKind;
type AccTile: TileKind;
type OutTile: TileKind<ReadWrite>;
Show 16 methods
// Required methods
fn execute(
lhs: &Self::LhsFragment,
rhs: &Self::RhsFragment,
out: &mut Self::AccFragment,
config: Self::Config,
);
fn allocate_lhs(config: Self::Config) -> Self::LhsFragment;
fn load_lhs<E: Numeric>(
tile: &Tile<Self::LhsTile, E>,
lhs: &mut Self::LhsFragment,
config: Self::Config,
);
fn allocate_rhs(config: Self::Config) -> Self::RhsFragment;
fn load_rhs<E: Numeric>(
tile: &Tile<Self::RhsTile, E>,
rhs: &mut Self::RhsFragment,
config: Self::Config,
);
fn allocate_acc(config: Self::Config) -> Self::AccFragment;
fn load_acc<E: Numeric>(
tile: &Tile<Self::AccTile, E>,
acc: &mut Self::AccFragment,
config: Self::Config,
);
fn write_results<E: Numeric>(
tile: &mut TileMut<Self::OutTile, E>,
out: &Self::AccFragment,
config: Self::Config,
);
fn __expand_execute(
scope: &mut Scope,
lhs: <Self::LhsFragment as CubeType>::ExpandType,
rhs: <Self::RhsFragment as CubeType>::ExpandType,
out: <Self::AccFragment as CubeType>::ExpandType,
config: Self::Config,
) -> <() as CubeType>::ExpandType;
fn __expand_allocate_lhs(
scope: &mut Scope,
config: Self::Config,
) -> <Self::LhsFragment as CubeType>::ExpandType;
fn __expand_load_lhs<E: Numeric>(
scope: &mut Scope,
tile: <Tile<Self::LhsTile, E> as CubeType>::ExpandType,
lhs: <Self::LhsFragment as CubeType>::ExpandType,
config: Self::Config,
) -> <() as CubeType>::ExpandType;
fn __expand_allocate_rhs(
scope: &mut Scope,
config: Self::Config,
) -> <Self::RhsFragment as CubeType>::ExpandType;
fn __expand_load_rhs<E: Numeric>(
scope: &mut Scope,
tile: <Tile<Self::RhsTile, E> as CubeType>::ExpandType,
rhs: <Self::RhsFragment as CubeType>::ExpandType,
config: Self::Config,
) -> <() as CubeType>::ExpandType;
fn __expand_allocate_acc(
scope: &mut Scope,
config: Self::Config,
) -> <Self::AccFragment as CubeType>::ExpandType;
fn __expand_load_acc<E: Numeric>(
scope: &mut Scope,
tile: <Tile<Self::AccTile, E> as CubeType>::ExpandType,
acc: <Self::AccFragment as CubeType>::ExpandType,
config: Self::Config,
) -> <() as CubeType>::ExpandType;
fn __expand_write_results<E: Numeric>(
scope: &mut Scope,
tile: <TileMut<Self::OutTile, E> as CubeType>::ExpandType,
out: <Self::AccFragment as CubeType>::ExpandType,
config: Self::Config,
) -> <() as CubeType>::ExpandType;
}Expand description
Provides matrix multiplication operations at the tile level.
At the tile level,
- Dimensions M, N and K are fixed to an integer, and the matrix multiplication works only for size (M, K) · (K, N) = (M, N).
Assumptions:
- Inputs must always be valid. If the actual matrix multiplication should be done on smaller sizes than M, N and K, padding with zeros must be done beforehand.
- Enough units are present to perform the whole computation
Required Associated Types§
Sourcetype Config: TileConfig
type Config: TileConfig
The configuration type associated with this Matmul.
Sourcetype LhsFragment: CubeType
type LhsFragment: CubeType
Contains Lhs data for computation
Sourcetype RhsFragment: CubeType
type RhsFragment: CubeType
Contains Rhs data for computation
Sourcetype AccFragment: CubeType
type AccFragment: CubeType
Contains and accumulates results of the Tile Matmul execution
Required Methods§
Sourcefn execute(
lhs: &Self::LhsFragment,
rhs: &Self::RhsFragment,
out: &mut Self::AccFragment,
config: Self::Config,
)
fn execute( lhs: &Self::LhsFragment, rhs: &Self::RhsFragment, out: &mut Self::AccFragment, config: Self::Config, )
Executes the matrix multiplication of Lhs and Rhs, adding the result to the accumulator
Sourcefn allocate_lhs(config: Self::Config) -> Self::LhsFragment
fn allocate_lhs(config: Self::Config) -> Self::LhsFragment
Sourcefn load_lhs<E: Numeric>(
tile: &Tile<Self::LhsTile, E>,
lhs: &mut Self::LhsFragment,
config: Self::Config,
)
fn load_lhs<E: Numeric>( tile: &Tile<Self::LhsTile, E>, lhs: &mut Self::LhsFragment, config: Self::Config, )
Load the container of Lhs from tile data
Sourcefn allocate_rhs(config: Self::Config) -> Self::RhsFragment
fn allocate_rhs(config: Self::Config) -> Self::RhsFragment
Sourcefn load_rhs<E: Numeric>(
tile: &Tile<Self::RhsTile, E>,
rhs: &mut Self::RhsFragment,
config: Self::Config,
)
fn load_rhs<E: Numeric>( tile: &Tile<Self::RhsTile, E>, rhs: &mut Self::RhsFragment, config: Self::Config, )
Load the container of Rhs from tile data
Sourcefn allocate_acc(config: Self::Config) -> Self::AccFragment
fn allocate_acc(config: Self::Config) -> Self::AccFragment
Sourcefn load_acc<E: Numeric>(
tile: &Tile<Self::AccTile, E>,
acc: &mut Self::AccFragment,
config: Self::Config,
)
fn load_acc<E: Numeric>( tile: &Tile<Self::AccTile, E>, acc: &mut Self::AccFragment, config: Self::Config, )
Load the container of Acc from tile data
Sourcefn write_results<E: Numeric>(
tile: &mut TileMut<Self::OutTile, E>,
out: &Self::AccFragment,
config: Self::Config,
)
fn write_results<E: Numeric>( tile: &mut TileMut<Self::OutTile, E>, out: &Self::AccFragment, config: Self::Config, )
Write the content of the output container to the given slice
fn __expand_execute( scope: &mut Scope, lhs: <Self::LhsFragment as CubeType>::ExpandType, rhs: <Self::RhsFragment as CubeType>::ExpandType, out: <Self::AccFragment as CubeType>::ExpandType, config: Self::Config, ) -> <() as CubeType>::ExpandType
fn __expand_allocate_lhs( scope: &mut Scope, config: Self::Config, ) -> <Self::LhsFragment as CubeType>::ExpandType
fn __expand_load_lhs<E: Numeric>( scope: &mut Scope, tile: <Tile<Self::LhsTile, E> as CubeType>::ExpandType, lhs: <Self::LhsFragment as CubeType>::ExpandType, config: Self::Config, ) -> <() as CubeType>::ExpandType
fn __expand_allocate_rhs( scope: &mut Scope, config: Self::Config, ) -> <Self::RhsFragment as CubeType>::ExpandType
fn __expand_load_rhs<E: Numeric>( scope: &mut Scope, tile: <Tile<Self::RhsTile, E> as CubeType>::ExpandType, rhs: <Self::RhsFragment as CubeType>::ExpandType, config: Self::Config, ) -> <() as CubeType>::ExpandType
fn __expand_allocate_acc( scope: &mut Scope, config: Self::Config, ) -> <Self::AccFragment as CubeType>::ExpandType
fn __expand_load_acc<E: Numeric>( scope: &mut Scope, tile: <Tile<Self::AccTile, E> as CubeType>::ExpandType, acc: <Self::AccFragment as CubeType>::ExpandType, config: Self::Config, ) -> <() as CubeType>::ExpandType
fn __expand_write_results<E: Numeric>( scope: &mut Scope, tile: <TileMut<Self::OutTile, E> as CubeType>::ExpandType, out: <Self::AccFragment as CubeType>::ExpandType, config: Self::Config, ) -> <() as CubeType>::ExpandType
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.