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 function
matmul
def matmul[*, transpose_b: Bool = False, b_packed: Bool = False, saturated_vnni: Bool = False](c: TileTensor[Engine=c.Engine, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, linear_idx_type=b.linear_idx_type], kernel_type_m: Int, num_threads: Int = Int(-1), ctx: Optional[DeviceContext[CompilationTarget()]] = None)
TileTensor matmul dispatcher. Selects kernel type and delegates to _matmul_cpu_impl.
Parameters:
- transpose_b (
Bool): Whether the B operand is transposed (defaults toFalse). - b_packed (
Bool): Whether B was pre-packed offline in the cache-friendly layout (defaults toFalse). - saturated_vnni (
Bool): WhenTrue, uses the saturating x86 variant, which requires theaoperand to lie in[0, 127]; it saves instructions only on the AVX2 emulation path used when the target lacks VNNI (defaults toFalse).
Args:
- c (
TileTensor[Engine=c.Engine, linear_idx_type=c.linear_idx_type]): Output matrix buffer accumulating the matmul result. - a (
TileTensor[Engine=a.Engine, linear_idx_type=a.linear_idx_type]): Left operand of the matmul. - b (
TileTensor[Engine=b.Engine, linear_idx_type=b.linear_idx_type]): Right operand of the matmul. - kernel_type_m (
Int): M dimension used to select the kernel variant, or0if unknown. - num_threads (
Int): Number of worker threads to use (defaults to-1, which selects automatically). - ctx (
Optional[DeviceContext[CompilationTarget()]]): Device context governing parallelism (defaults toNone).
def matmul[EpilogueFnType: ElementwiseEpilogueFn, //, *, transpose_b: Bool = False, b_packed: Bool = False, saturated_vnni: Bool = False](c: TileTensor[Engine=c.Engine, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, linear_idx_type=b.linear_idx_type], epilogue_fn: EpilogueFnType, kernel_type_m: Int, num_threads: Int = Int(-1), ctx: Optional[DeviceContext[CompilationTarget()]] = None)
TileTensor matmul dispatcher with a fused elementwise epilogue.
The kernel accumulates into c, then calls epilogue_fn with the
(m, n) coordinates and value of each finished output chunk.
Parameters:
- EpilogueFnType (
ElementwiseEpilogueFn): Type ofepilogue_fn(inferred). - transpose_b (
Bool): Whether the B operand is transposed (defaults toFalse). - b_packed (
Bool): Whether B was pre-packed offline in the cache-friendly layout (defaults toFalse). - saturated_vnni (
Bool): WhenTrue, uses the saturating x86 variant, which requires theaoperand to lie in[0, 127]; it saves instructions only on the AVX2 emulation path used when the target lacks VNNI (defaults toFalse).
Args:
- c (
TileTensor[Engine=c.Engine, linear_idx_type=c.linear_idx_type]): Output matrix buffer accumulating the matmul result. - a (
TileTensor[Engine=a.Engine, linear_idx_type=a.linear_idx_type]): Left operand of the matmul. - b (
TileTensor[Engine=b.Engine, linear_idx_type=b.linear_idx_type]): Right operand of the matmul. - epilogue_fn (
EpilogueFnType): Epilogue applied to each finished output chunk. - kernel_type_m (
Int): M dimension used to select the kernel variant, or0if unknown. - num_threads (
Int): Number of worker threads to use (defaults to-1, which selects automatically). - ctx (
Optional[DeviceContext[CompilationTarget()]]): Device context governing parallelism (defaults toNone).
def matmul[ComputeFnType: ElementwiseComputeFn, //, *, transpose_b: Bool = False, b_packed: Bool = False, saturated_vnni: Bool = False](c: TileTensor[Engine=c.Engine, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, linear_idx_type=b.linear_idx_type], compute_fn: ComputeFnType, kernel_type_m: Int, num_threads: Int = Int(-1), ctx: Optional[DeviceContext[CompilationTarget()]] = None)
TileTensor matmul dispatcher with a fused elementwise compute epilogue.
The kernel accumulates into c, then stores compute_fn of each
finished output chunk back into c, so compute_fn never needs to
capture c.
Parameters:
- ComputeFnType (
ElementwiseComputeFn): Type ofcompute_fn(inferred). - transpose_b (
Bool): Whether the B operand is transposed (defaults toFalse). - b_packed (
Bool): Whether B was pre-packed offline in the cache-friendly layout (defaults toFalse). - saturated_vnni (
Bool): WhenTrue, uses the saturating x86 variant, which requires theaoperand to lie in[0, 127]; it saves instructions only on the AVX2 emulation path used when the target lacks VNNI (defaults toFalse).
Args:
- c (
TileTensor[Engine=c.Engine, linear_idx_type=c.linear_idx_type]): Output matrix buffer accumulating the matmul result. - a (
TileTensor[Engine=a.Engine, linear_idx_type=a.linear_idx_type]): Left operand of the matmul. - b (
TileTensor[Engine=b.Engine, linear_idx_type=b.linear_idx_type]): Right operand of the matmul. - compute_fn (
ComputeFnType): Compute epilogue applied to each finished output chunk. - kernel_type_m (
Int): M dimension used to select the kernel variant, or0if unknown. - num_threads (
Int): Number of worker threads to use (defaults to-1, which selects automatically). - ctx (
Optional[DeviceContext[CompilationTarget()]]): Device context governing parallelism (defaults toNone).