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
TiledMatmul
struct TiledMatmul[config: KernelConfig, transpose_b: Bool, b_packed: Bool, elementwise_epilogue_enabled: Bool, kernel_id: InnerKernelID, a_type: DType, a_layout: TensorLayout, a_origin: ImmOrigin, b_type: DType, b_layout: TensorLayout, b_origin: ImmOrigin, c_type: DType, c_layout: TensorLayout, c_origin: MutOrigin, algorithm: InnerMatmulKernel, ElementwiseEpilogueFnType: def(GemmShape, GemmShape, TileTensor[*?, *?, origin_of(origin), Storage=*?, linear_idx_type=*?]) -> None & ImplicitlyCopyable]
Tiled matmul implementation integrating packing, inner loop and tile partitions.
Parametersβ
- βconfig (
KernelConfig): Kernel configuration controlling tile dimensions and SIMD width. - βtranspose_b (
Bool): Whether the B operand is transposed. - βb_packed (
Bool): Whether B was pre-packed offline in the cache-friendly layout. - βelementwise_epilogue_enabled (
Bool): Whether to apply the elementwise epilogue on the last K tile. - βkernel_id (
InnerKernelID): Identifier of the inner microkernel to dispatch. - βa_type (
DType): Element type of the A operand. - βa_layout (
TensorLayout): Memory layout of the A operand. - βa_origin (
ImmOrigin): Memory origin provenance of the A operand. - βb_type (
DType): Element type of the B operand. - βb_layout (
TensorLayout): Memory layout of the B operand. - βb_origin (
ImmOrigin): Memory origin provenance of the B operand. - βc_type (
DType): Element type of the C output. - βc_layout (
TensorLayout): Memory layout of the C output. - βc_origin (
MutOrigin): Memory origin provenance of the mutable C output. - βalgorithm (
InnerMatmulKernel): Microkernel implementing the inner accumulate loop. - βElementwiseEpilogueFnType (
def(GemmShape, GemmShape, TileTensor[*?, *?, origin_of(origin), Storage=*?, linear_idx_type=*?]) -> None&ImplicitlyCopyable): Type of the elementwise epilogue function applied to each output tile.
Fieldsβ
- βalg (
algorithm): Inner microkernel conforming toInnerMatmulKernel. - βc (
TileTensor[c_type, c_layout, c_origin]): OutputTileTensorthe result accumulates into. - βa (
TileTensor[a_type, a_layout, a_origin]): Left operandTileTensor. - βb (
TileTensor[b_type, b_layout, b_origin]): Right operandTileTensor. - βtile_n_k (
IndexList[Int(2)]): Dynamic(N, K)tile extents used to partition the problem. - βglobal_tile_offset (
GemmShape):(M, N, K)offset of this routine's tile region. - βglobal_tile_shape (
GemmShape):(M, N, K)extent of this routine's tile region. - βb_tile_generator (
BTileGenerator[config, a_type, b_type, c_type, b_layout, transpose_b, b_packed, b_origin]): Generator that packsBsub-tiles for the inner kernel. - βelementwise_epilogue_fn (
ElementwiseEpilogueFnType): Fused elementwise epilogue applied to each output tile.
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable