For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
gemm_kernel_apple_8x8
def gemm_kernel_apple_8x8[c_type: DType, a_type: DType, b_type: DType, c_layout: TensorLayout, a_layout: TensorLayout, b_layout: TensorLayout, c_storage: TensorStorage, a_storage: TensorStorage, b_storage: TensorStorage, transpose_b: Bool = False, elementwise_lambda_fn: Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None] = None, s_type: DType = get_accum_type[c_type](), BLOCK_M: Int = Int(64), BLOCK_N: Int = Int(64), BLOCK_K: Int = Int(16), NUM_SIMDGROUPS: Int = Int(4)](c: TileTensor[c_type, c_layout, MutAnyOrigin, Storage=c_storage], a: TileTensor[a_type, a_layout, ImmutAnyOrigin, Storage=a_storage], b: TileTensor[b_type, b_layout, ImmutAnyOrigin, Storage=b_storage], m: Int, n: Int, k: Int)
Launchable wrapper for the 8x8 simdgroup-matrix GEMM (bench/test).
Parameters:
- βc_type (
DType): Element type of the outputCtile. - βa_type (
DType): Element type of the inputAtile. - βb_type (
DType): Element type of the inputBtile. - βc_layout (
TensorLayout): Memory layout of the outputCtile. - βa_layout (
TensorLayout): Memory layout of the inputAtile. - βb_layout (
TensorLayout): Memory layout of the inputBtile. - βc_storage (
TensorStorage): Storage kind of the outputCtile. - βa_storage (
TensorStorage): Storage kind of the inputAtile. - βb_storage (
TensorStorage): Storage kind of the inputBtile. - βtranspose_b (
Bool): WhetherBis stored as(N, K)rather than(K, N)(defaults toFalse). - βelementwise_lambda_fn (
Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None]): Optional epilogue applied to each output element before store (defaults toNone). - βs_type (
DType): Accumulator element type (defaults to the accumulator type ofc_type). - βBLOCK_M (
Int): M-dimension block tile size (defaults to 64). - βBLOCK_N (
Int): N-dimension block tile size (defaults to 64). - βBLOCK_K (
Int): K-dimension block tile size (defaults to 16). - βNUM_SIMDGROUPS (
Int): Simdgroups per threadgroup, each owning a 32x32 subtile (defaults to 4).
Args:
- βc (
TileTensor[c_type, c_layout, MutAnyOrigin, Storage=c_storage]): OutputTileTensorof shape(m, n). - βa (
TileTensor[a_type, a_layout, ImmutAnyOrigin, Storage=a_storage]): InputTileTensorof shape(m, k). - βb (
TileTensor[b_type, b_layout, ImmutAnyOrigin, Storage=b_storage]): InputTileTensorof shape(k, n), or(n, k)whentranspose_bis set. - βm (
Int): Number of rows inCandA. - βn (
Int): Number of columns inCandB. - βk (
Int): Contraction dimension shared byAandB.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!