pub fn moe_expert_gate_up_shared_prefill(
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,
num_tokens: u32,
stream: u64,
) -> Result<()>Expand description
2026-09-25: Gate and up GEMVs for num_tokens tokens, routed and shared
experts in one launch. Row y < num_tokens * top_k is routed (token
y / top_k, expert expert_indices[y]) and writes gate_out/up_out
([num_tokens * top_k, n] BF16); the remaining num_tokens rows run the
shared expert and write sh_gate_out/sh_up_out ([num_tokens, n] BF16).
blockIdx.z picks gate (0) or up (1). input is [num_tokens, k] BF16.