moe_expert_gate_up_shared_batch2

Function moe_expert_gate_up_shared_batch2 

Source
pub fn moe_expert_gate_up_shared_batch2(
    gpu: &dyn GpuBackend,
    kernel: KernelHandle,
    input: DevicePtr,
    gate_packed_ptrs: DevicePtr,
    gate_scale_ptrs: DevicePtr,
    gate_scale2_vals: DevicePtr,
    gate_out: DevicePtr,
    up_packed_ptrs: DevicePtr,
    up_scale_ptrs: DevicePtr,
    up_scale2_vals: DevicePtr,
    up_out: DevicePtr,
    expert_indices: DevicePtr,
    sh_gate: &QuantizedWeight,
    sh_gate_out: DevicePtr,
    sh_up: &QuantizedWeight,
    sh_up_out: DevicePtr,
    n: u32,
    k: u32,
    top_k: u32,
    block_size: u32,
    stream: u64,
) -> Result<()>
Expand description

Fused gate+up expert GEMV for K=2 tokens with shared expert.

Expands blockIdx.y from (top_k+1) to 2*(top_k+1) to process both tokens. Token index = blockIdx.y / (top_k+1), expert slot = blockIdx.y % (top_k+1). Shared expert blocks use direct weight pointers; routed use pointer table.

Grid: (ceil(N/8), 2*(top_k+1), 2) Block: (128, 1, 1)