For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo struct
GemmShape
struct GemmShape
Helper class to unpack gemm dimension and layout.
Fields
- M (
Int): - N (
Int): - K (
Int):
Implemented traits
AnyType,
Copyable,
Deinitable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
TrivialRegisterPassable
Methods
__init__
def __init__(index: IndexList[Int(3)]) -> Self
Constructor of a gemm shape record from a index tuple.
Args:
- index (
IndexList[Int(3)]): The int tuple containing the index(m,n,k).
__getitem__
__setitem__
def __setitem__(mut self, idx: Int, value: Int)
__add__
def __add__(self, rhs: Self) -> Self
Coordinate-wise addition of two gemm shape records.
Args:
- rhs (
Self): Another gemm shape record to add with.
__sub__
def __sub__(self, rhs: Self) -> Self
Coordinate-wise subtraction of two gemm shape records.
Args:
- rhs (
Self): Another gemm shape record to subtract with.
get
static def get[transpose_b: Bool](c: TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type]) -> Self
Constructor of a gemm shape record from TileTensor inputs.
M, N, and K are intentionally calculated using a and c ONLY. This
is because b may be padded to a multiple of the tile size if it has
been pre-packed.
Parameters:
- transpose_b (
Bool): Whether matrix B is stored in transposed form.
Args:
- c (
TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type]): TileTensor with allocated output space. - a (
TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type]): TileTensor containing matrix operand A. - b (
TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type]): TileTensor containing matrix operand B.
as_index
def as_index(self) -> IndexList[Int(3)]
Utility to convert the underlying data to an index tuple. So that the utilities such as elementwise add can be used.
Returns:
IndexList[Int(3)]: The constructed index tuple.