vllm.model_executor.layers.fused_moe.silu_mul_token_quant
¶
SiLU-and-mul fused with dynamic per-token FP8 quantization.
Replaces silu_and_mul + scaled_fp8_quant(use_per_token_if_dynamic=True) in the
Triton MoE experts when the second GEMM takes per-token-quantized activations (for
example PTPC-FP8). Under expert parallelism the first GEMM only writes the rows whose
expert is local. This kernel reads the same expert_map[topk_ids] mask and skips the
other rows instead of activating and quantizing them. The second GEMM and the
finalize never read those rows.
Functions:
-
silu_mul_token_quant–SiLU-and-mul of
x([rows, 2H], gate then up), quantized to FP8 per row.
silu_mul_token_quant(x, topk_ids=None, expert_map=None, num_experts=None, out=None)
¶
SiLU-and-mul of x ([rows, 2H], gate then up), quantized to FP8 per row.
Returns the FP8 activation [rows, H] and float32 scales [rows, 1]. With
topk_ids ([rows] once flattened) and expert_map, rows routed to a remote
expert, or to an id outside [0, num_experts), are skipped and their outputs are
left untouched. num_experts defaults to expert_map.numel(). out optionally
supplies the two output tensors.