moe_expert_gate_up_shared_bf16_batch2

Function moe_expert_gate_up_shared_bf16_batch2 

Source
pub fn moe_expert_gate_up_shared_bf16_batch2(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    input: DevicePtr,
    gate_weight_ptrs: DevicePtr,
    gate_out: DevicePtr,
    up_weight_ptrs: DevicePtr,
    up_out: DevicePtr,
    expert_indices: DevicePtr,
    sh_gate_weight: DevicePtr,
    sh_gate_out: DevicePtr,
    sh_up_weight: DevicePtr,
    sh_up_out: DevicePtr,
    n: u32,
    k: u32,
    top_k: u32,
    stream: u64,
) -> Result<()>
Expand description

Fused gate+up expert GEMV with shared expert for BF16 weights — K=2 batch.

BF16 K=2 variant of moe_expert_gate_up_shared_fp8_batch2: processes 2 tokens (MTP verify) in one launch. Direct BF16 weight pointers, no scale. Output layout matches the FP8 batch2 path (routed at flat_slot=token*top_k+ slot, shared at token). For models loaded via the FP8-dequant-on-load path.

Grid: (ceil(N/8), 2top_k+1, 2) Block: (128, 1, 1) y in [0,2top_k) = routed (per token); y==2*top_k = shared (both tokens).