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
apple_batched_matmul
def apple_batched_matmul[rank: Int, *, transpose_b: Bool = False, elementwise_epilogue_fn: Optional[def[c_type: DType, width: SIMDLength, rank: Int, *, alignment: Int = Int(1)](IndexList[rank], SIMD[c_type, width]) capturing thin -> None] = None](c: TileTensor[Storage=c.Storage, address_space=c.address_space, linear_idx_type=c.linear_idx_type], a: TileTensor[Storage=a.Storage, address_space=a.address_space, linear_idx_type=a.linear_idx_type], b: TileTensor[Storage=b.Storage, address_space=b.address_space, linear_idx_type=b.linear_idx_type], c_shape_idx: IndexList[rank])
Performs a batched single-precision matmul via the Apple Accelerate library.
Iterates over all batch dimensions (all axes except the last two), calling
apple_matmul for each 2D slice. Requires at least rank-3 tensors and
all operands to be DType.float32.
Parameters:
- βrank (
Int): The rank of the output tensor (must be >= 3). - βtranspose_b (
Bool): Whether to treat B as transposed. - βelementwise_epilogue_fn (
Optional[def[c_type: DType, width: SIMDLength, rank: Int, *, alignment: Int = Int(1)](IndexList[rank], SIMD[c_type, width]) capturing thin -> None]): Optional rank-aware epilogue applied to each output slice.
Args:
- βc (
TileTensor[Storage=c.Storage, address_space=c.address_space, linear_idx_type=c.linear_idx_type]): Output batched tensor tile. - βa (
TileTensor[Storage=a.Storage, address_space=a.address_space, linear_idx_type=a.linear_idx_type]): Input A batched tensor tile. - βb (
TileTensor[Storage=b.Storage, address_space=b.address_space, linear_idx_type=b.linear_idx_type]): Input B batched tensor tile. - βc_shape_idx (
IndexList[rank]): Shape of the output tensor used to compute batch strides.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!