IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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 output C tile.
  • ​a_type (DType): Element type of the input A tile.
  • ​b_type (DType): Element type of the input B tile.
  • ​c_layout (TensorLayout): Memory layout of the output C tile.
  • ​a_layout (TensorLayout): Memory layout of the input A tile.
  • ​b_layout (TensorLayout): Memory layout of the input B tile.
  • ​c_storage (TensorStorage): Storage kind of the output C tile.
  • ​a_storage (TensorStorage): Storage kind of the input A tile.
  • ​b_storage (TensorStorage): Storage kind of the input B tile.
  • ​transpose_b (Bool): Whether B is stored as (N, K) rather than (K, N) (defaults to False).
  • ​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 to None).
  • ​s_type (DType): Accumulator element type (defaults to the accumulator type of c_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:

Was this page helpful?