IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo module

apple_accelerate

Wraps the Apple Accelerate cblas_sgemm routine to provide single-precision matmul, GEMV, and batched matmul kernels for Apple CPUs.

comptime values

APPLE_ACCELERATE

comptime APPLE_ACCELERATE = _Global[StringSpan("APPLE_ACCELERATE"), _init_dylib, _on_error_msg]

Process-global lazily loaded handle to the Accelerate dynamic library.

cblas_gemm_type

comptime cblas_gemm_type = def(_CBLASOrder, _CBLASTranspose, _CBLASTranspose, Int32, Int32, Int32, Float32, Pointer[Float32, ImmutAnyOrigin], Int32, Pointer[Float32, ImmutAnyOrigin], Int32, Float32, Pointer[Float32, MutAnyOrigin], Int32) thin -> None

Function type matching the Accelerate cblas_sgemm C signature.

LIB_ACC_PATH

comptime LIB_ACC_PATH = "/System/Library/Frameworks/Accelerate.framework/Accelerate"

Filesystem path to the Apple Accelerate framework dynamic library.

Functions

  • apple_batched_matmul: Performs a batched single-precision matmul via the Apple Accelerate library.
  • apple_gemv: Performs a parallelized and vectorized GEMV for the M=1 case on Apple CPUs.
  • apple_matmul: Performs a single-precision matmul via a pre-loaded cblas_sgemm function pointer.
  • get_cblas_f32_function: Loads and returns the cblas_sgemm function pointer from the Apple Accelerate library.
  • use_apple_accelerate_lib: Returns whether the Apple Accelerate CBLAS library should be used for this dtype combination.