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

Mojo function

grouped_matmul_amd_kernel_launcher

def grouped_matmul_amd_kernel_launcher[c_type: DType, a_type: DType, b_type: DType, LayoutC: TensorLayout, LayoutA: TensorLayout, LayoutB: TensorLayout, AOffsetsLayout: TensorLayout, ExpertIdsLayout: TensorLayout, transpose_b: Bool, config: MatmulConfig[a_type, b_type, c_type, transpose_b], elementwise_lambda_fn: Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> None] = None](c_tensor: TileTensor[c_type, LayoutC, MutAnyOrigin], a_tensor: TileTensor[a_type, LayoutA, MutAnyOrigin], b_tensor: TileTensor[b_type, LayoutB, MutAnyOrigin], a_offsets: TileTensor[DType.uint32, AOffsetsLayout, ImmUnsafeAnyOrigin], expert_ids: TileTensor[DType.int32, ExpertIdsLayout, ImmUnsafeAnyOrigin], num_active_experts: Int)

Computes the AMD GPU grouped matmul by dispatching per-expert tiles through AMDMatmul, with separate zero-fill handling for inactive (expert_id == -1) blocks.

For active experts, delegates the per-tile matmul (and optional elementwise epilogue) to AMDMatmul. For inactive experts, zeroes the output row range and invokes the epilogue with zero values so that LoRA-style inactive blocks still produce a defined output.