vllm.models.muse_spark.nvidia.ops.prepare_trtllm_nvfp4
¶
Pre-expert RMSNorm fused with the TRT-LLM MoE's NVFP4 input quantization.
Matches MuseSpark1xRMSNorm (one BF16 rounding) followed by
scaled_fp4_quant(..., is_sf_swizzled_layout=False) with the static global
scale, and reads the pooler output either contiguous or in the rank-block
layout [tp, M, H / tp] left by a column all-gather.
Functions:
-
norm_quant_trtllm_nvfp4–RMSNorm + NVFP4 quant of
[M, H]pooled states, in any rank-block layout.
_quantize_nvfp4_global_scale(values, global_scale, BLOCK_K)
¶
scaled_fp4_quant's arithmetic (nvfp4_utils.cuh), linear scales.
Source code in vllm/models/muse_spark/nvidia/ops/prepare_trtllm_nvfp4.py
norm_quant_trtllm_nvfp4(pooled, num_tokens, norm_weight, norm_eps, gain_center, global_scale)
¶
RMSNorm + NVFP4 quant of [M, H] pooled states, in any rank-block layout.
pooled is [M, H] or the [tp * M, H / tp] output of a dim-0
all-gather of column shards. Returns packed [M, H/2] uint8 values and
linear [M, H/16] uint8 (E4M3) block scales.