[Bugfix] Patch Hopper MXFP4 OOB scales reads leading to NaN (#47910)

Signed-off-by: Yifan Zong <yzong@redhat.com>

yzong-rh committed Jul 7, 2026 at 18:51 UTC 7d2ce5750e045777ccbc7290a0267e7342603691
1 file changed +6
vllm/model_executor/layers/quantization/utils/mxfp4_utils.py
+6
@@ -87,6 +87,12 @@ def _swizzle_mxfp4(quant_tensor, scale, num_warps=8):
87 "split_k": 1,
88 }
89 opt_flags.update_opt_flags_constraints(constraints)
90 + # Patches #47303: pad K (num scale groups) to 0 mod 4
91 + # TODO: Remove once we upgrade to Triton 3.8.0+ kernels
92 + if scale.numel() > 0:
93 + K = scale.shape[-1]
94 + pad_k = -K % 4
95 + scale = torch.nn.functional.pad(scale, (0, pad_k))
96 elif current_platform.is_device_capability_family(100):
97 constraints = {
98 "is_persistent": True,