moe_weighted_sum_blend

Function moe_weighted_sum_blend 

Source
pub fn moe_weighted_sum_blend(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    output: DevicePtr,
    expert_out: DevicePtr,
    expert_weights: DevicePtr,
    shared_out: DevicePtr,
    input: DevicePtr,
    gate_weight: DevicePtr,
    hidden: u32,
    top_k: u32,
    k: u32,
    stream: u64,
) -> Result<()>
Expand description

2026-09-25: The MoE combine for one token: output[j] = sum_e weights[e] * expert_out[e, j] + sigmoid(dot(input, gate_weight)) * shared_out[j]. Every block computes the gate dot product itself. A null gate_weight means an ungated shared expert, blended at weight 1.