moe_expert_gate_up_shared

Function moe_expert_gate_up_shared 

Source
pub fn moe_expert_gate_up_shared(
    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,
    stream: u64,
) -> Result<()>
Expand description

Fused gate+up expert GEMV with shared expert as extra blockIdx.y slot.

blockIdx.y < top_k: routed expert (pointer table lookup). blockIdx.y == top_k: shared expert (direct weight pointers). Eliminates separate shared expert gate+up kernel launch.

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