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_gemv
def apple_gemv[*, b_packed: Bool, 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](c: TileTensor[Storage=c.Storage, linear_idx_type=c.linear_idx_type], a: TileTensor[Storage=a.Storage, linear_idx_type=a.linear_idx_type], b: TileTensor[Storage=b.Storage, linear_idx_type=b.linear_idx_type], ctx: Optional[DeviceContext] = None)
Performs a parallelized and vectorized GEMV for the M=1 case on Apple CPUs.
Used as an alternative to apple_matmul when M=1 and the Apple Accelerate
cblas_sgemm path exhibits suboptimal performance for single-row inputs.
Iterates over columns of B using SIMD FMA and optional parallelism.
Parameters:
- βb_packed (
Bool): Whether B is already in packed (transposed) layout. - βtranspose_b (
Bool): Whether to treat B as transposed. - β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 element-wise to output.
Args:
- βc (
TileTensor[Storage=c.Storage, linear_idx_type=c.linear_idx_type]): Output matrix tile (M=1). - βa (
TileTensor[Storage=a.Storage, linear_idx_type=a.linear_idx_type]): Input A matrix tile (M=1). - βb (
TileTensor[Storage=b.Storage, linear_idx_type=b.linear_idx_type]): Input B matrix tile. - βctx (
Optional[DeviceContext]): Optional device context for parallelism control.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!