moe_gate_topk_fused

Function moe_gate_topk_fused 

Source
pub fn moe_gate_topk_fused(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    input: DevicePtr,
    gate_weight: &QuantizedWeight,
    expert_indices: DevicePtr,
    expert_weights: DevicePtr,
    num_experts: u32,
    k: u32,
    top_k: u32,
    normalize: u32,
    stream: u64,
) -> Result<()>
Expand description

2026-09-25: Fused gate GEMV and top-k for one token (kernel moe_gate_topk_fused): gate[num_experts] = A[K] @ B_gate[num_experts, K]^T with an NVFP4 gate weight, then the top-k expert indices and weights exp(logit - max) over those k, divided by their sum when normalize is nonzero. One 256-thread CTA; K BF16 values of dynamic shared memory hold the input.