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 function

enqueue_apple_grouped_matmul

def enqueue_apple_grouped_matmul(c: TileTensor[Engine=c.Engine, address_space=c.address_space, linear_idx_type=c.linear_idx_type], a: TileTensor[Engine=a.Engine, address_space=a.address_space, linear_idx_type=a.linear_idx_type], b: TileTensor[Engine=b.Engine, address_space=b.address_space, linear_idx_type=b.linear_idx_type], a_offsets: TileTensor[.uint32, Engine=a_offsets.Engine, address_space=a_offsets.address_space, linear_idx_type=a_offsets.linear_idx_type], expert_ids: TileTensor[.int32, Engine=expert_ids.Engine, address_space=expert_ids.address_space, linear_idx_type=expert_ids.linear_idx_type], max_num_tokens_per_expert: Int, num_active_experts: Int, ctx: DeviceContext)

Enqueues the Apple M5 grouped matmul C = A @ b[expert]^T.

Routes on the largest group: up to APPLE_GROUPED_GEMV_MAX_TOKENS tokens per expert takes the GEMV (decode), anything larger the MMA GEMM (prefill). b is [num_experts, N, K] with static N and K; the operand types are those of enqueue_apple_grouped_gemv.

Raises:

If the attached GPU is not Apple M5 (compute_capability == 5).

Was this page helpful?