Skip to main content

compile_to_cuda_forward_q8_moe_dp4a

Function compile_to_cuda_forward_q8_moe_dp4a 

Source
pub fn compile_to_cuda_forward_q8_moe_dp4a(
    source: &str,
    weights: &HashMap<String, (String, usize)>,
    q8: &HashMap<String, Q8Ref>,
    moe: &HashMap<String, MoeWeights>,
) -> Result<String, String>
Expand description

compile_to_cuda_forward_q8_moe emitting the sparse top-K, deeply-fused, coalesced int8-activation MoE path — THE SHIPPED DEFAULT: only the K selected experts’ weights are gathered per token (the “A3B = 3B active” sparsity), and the FFN collapses to three kernels — router+topk, gate+up+SwiGLU fused, down+combine fused — so every intermediate stays off HBM. One __dp4a per 32-block (single-pass int8 activation) is the shortest dependency chain, the fastest batch-1 path at llama.cpp-matched activation precision (the A100 head-to-head beat: identical greedy token, more tok/s). For logits within ~1e-3 of the f64 reference — the correctness mode llama.cpp does not have — use compile_to_cuda_forward_q8_moe_exact.