vllm.models.minimax_m3.nvidia.ops.norm_mxfp8
¶
Gemma RMSNorm (optionally fused with the residual add) in one Triton pass.
With an sf scale buffer the output is E4M3 data plus UE8M0 scales in the
128x4 swizzled layout, replacing the BF16 norm followed by a separate MXFP8
quantize (which re-reads the full normed activation). Without it, the output
is the plain BF16 norm. The residual is bitwise the BF16 norm's; the
quantized data and scales match the reference quantize within one E4M3 step
(the rstd reduction order differs).
Functions:
-
gemma_rmsnorm_mxfp8–GemmaRMSNorm of
x(plusresidualin place when given).
gemma_rmsnorm_mxfp8(x, weight, eps, residual=None, mxfp8=True)
¶
GemmaRMSNorm of x (plus residual in place when given).
Parameters:
-
(x¶Tensor) –(num_tokens, hidden) BF16 activation, contiguous along the row (any row stride). Read only.
-
(weight¶Tensor) –(hidden,) norm weight; the norm scales by (1 + weight).
-
(eps¶float) –RMS norm epsilon.
-
(residual¶Tensor | None, default:None) –same shape/dtype/stride(1) as x; updated in place to x + residual. None for a plain norm.
-
(mxfp8¶bool, default:True) –return MXFP8 (E4M3 data + UE8M0 scales) or the plain BF16 normed activation.
Returns:
-
Tensor–(data, scale): withmxfp8=True, E4M3 data (num_tokens, -
Tensor | None–hidden) and UE8M0 scales in the 128x4 swizzled layout with zeroed
-
tuple[Tensor, Tensor | None]–padding rows; with
mxfp8=False, the BF16 normed activation and -
tuple[Tensor, Tensor | None]–None.