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
Fused gate GEMV + topK softmax for M=1 decode.
Single kernel that computes gate[num_experts] = A[K] @ B_gate[num_experts, K]
then extracts top-K indices + softmax weights. Saves 1 launch vs separate
gate GEMV + topK kernels.
Grid: (1, 1, 1) Block: (256, 1, 1) — single CTA, uses shared memory reduction