pub fn moe_fp8_grouped_gemm(
gpu: &dyn GpuBackend,
kernel: KernelHandle,
input: DevicePtr,
weight_ptrs: DevicePtr,
scale_ptrs: DevicePtr,
output: DevicePtr,
expert_offsets: DevicePtr,
sorted_token_ids: DevicePtr,
num_experts: u32,
n: u32,
k: u32,
worklist: DevicePtr,
total_tiles: DevicePtr,
max_tiles: u32,
stream: u64,
) -> Result<()>Expand description
2026-09-25: FP8 grouped GEMM for sorted MoE prefill over the work-list from
moe_build_tile_worklist, which must run first on the same stream.
The kernel strides over the work-list by gridDim.x, so the grid is
max_tiles (the caller’s upper bound on the tile count) clamped to
1..=16384. Extra CTAs exit at once; a grid smaller than the list is
slower but still covers every tile.
input [total_tokens, K] BF16; weight_ptrs[e] points at [N, K] FP8
and scale_ptrs[e] at [N/128, K/128] FP32; output
[total_expanded, N] BF16; expert_offsets [num_experts + 1];
sorted_token_ids [total_expanded], or NULL to read input row i for
output row i.