moe_topk_softmax_bias

Function moe_topk_softmax_bias 

Source
pub fn moe_topk_softmax_bias(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    gate_logits: DevicePtr,
    bias: DevicePtr,
    expert_indices: DevicePtr,
    expert_weights: DevicePtr,
    zero_accum: DevicePtr,
    num_logits: u32,
    num_routed: u32,
    top_k: u32,
    normalize: bool,
    scaling_factor: f32,
    stream: u64,
) -> Result<()>
Expand description

GPU-side MoE top-K sigmoid routing (Nemotron-H).

Uses sigmoid scoring (not softmax). Bias affects expert selection only, not their weights. Weights come from pre-bias sigmoid scores.

Kernel: moe_topk_sigmoid(gate_logits, bias, expert_indices, expert_weights, num_experts, top_k, normalize, scaling_factor) Grid: (1, 1, 1) Block: (256, 1, 1) LongCat softmax + e_score_correction_bias router with the zero-expert fold (single token). zero_accum receives the token’s summed zero-expert weight; folded slots are rewritten (expert 0, weight 0).