pub fn moe_build_tile_worklist(
gpu: &dyn GpuBackend,
kernel: KernelHandle,
expert_offsets: DevicePtr,
weight_ptrs: DevicePtr,
worklist: DevicePtr,
total_tiles: DevicePtr,
num_experts: u32,
n_tiles: u32,
m_tile: u32,
stream: u64,
) -> Result<()>Expand description
Build the compacted (expert, m_tile, n_tile) work-list for the
persistent grouped-GEMM grid. Single-block, thread-0 serial — mirrors the
moe_sort_by_expert launch style (grid [1,1,1], block [256,1,1]).
n_tiles = div_ceil(N, 64) (PM4_N_TILE) and m_tile = 128 (PM4_M_TILE).
Writes worklist[*total_tiles * 2] (word0=expert, word1=(m_tile<<6)|n_tile)
and total_tiles[0].
SAME-STREAM INVARIANT: the caller MUST launch moe_fp8_grouped_gemm on
the SAME stream so the kernel’s read of total_tiles/worklist
happens-after this write (no cross-stream event is inserted).