moe_topk_sqrtsoftplus

Function moe_topk_sqrtsoftplus 

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

GPU-side MoE top-K sqrtsoftplus routing (DeepSeek-V4).

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

Kernel: moe_topk_sqrtsoftplus(gate_logits, bias, expert_indices, expert_weights, num_experts, top_k, normalize, scaling_factor) Grid: (1, 1, 1) Block: (256, 1, 1)