vllm.models.flint.ops.norm
¶
Flint's RMSNorm, fused residual-add RMSNorm and SiLU-and-mul (Triton).
Numerics of the reference implementation's CUDA norm and activation kernels, everything in fp32 with one output rounding:
rms_norm:bf16(x * rsqrt(mean(x^2) + eps) * w).fused_add_rms_norm:s = x + residualin fp32,residual_out = bf16(s),out = bf16(s * rsqrt(mean(s^2) + eps) * w)from the unroundeds.silu_and_mul:bf16(g / (1 + exp(-g)) * u)(preciseexpfand division).
rsqrt is rsqrt.approx.ftz.f32 (rsqrtf under fast math). The fused
Flint kernels (qkv_fused, the decode MoE block's norm and shared expert, and
the GEMV SiLU epilogue) follow the same rules; the routed experts use the
approximate ex2 / rcp SiLU of the TRTLLM MoE (see moe).
Classes:
-
RMSNorm–Holds a norm
weight;rms_norm(x), or with a residual
Functions:
-
fused_add_rms_norm–In place:
residual = bf16(x + residual), ``x = rms_norm(x + -
silu_and_mul–silu(x[:, :D]) * x[:, D:]forx[M, 2D].
RMSNorm
¶
Bases: Module
Holds a norm weight; rms_norm(x), or with a residual
fused_add_rms_norm(x, residual).
Source code in vllm/models/flint/ops/norm.py
fused_add_rms_norm(x, residual, weight, eps)
¶
In place: residual = bf16(x + residual), x = rms_norm(x +
residual); returns (x, residual).
Source code in vllm/models/flint/ops/norm.py
silu_and_mul(x)
¶
silu(x[:, :D]) * x[:, D:] for x [M, 2D].