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_mma
def enqueue_apple_grouped_mma[*, groups_per_launch: Int = Int(4)](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 grouped simdgroup-MMA GEMM (any token count).
Same operand contract as enqueue_apple_grouped_gemv.
One dispatch covering every group runs an MoE prefill at ~20 TF/s against ~50 for one dispatch per group: threadgroups from many groups run at once and evict each other's weight tiles from cache. Dispatching a few groups at a time keeps the concurrent working set small while still filling the GPU when groups are short (measured, M5 Max, 32 x 1024 tokens: 4 groups per dispatch 57-59 TF/s, 1 per dispatch 50, all 32 at once 20).
Parameters:
- groups_per_launch (
Int): Expert groups per kernel dispatch.