[Perf] Restore zero-init of swizzled NVFP4 scale buffer to recover Blackwell decode throughput (#45739)
Signed-off-by: Albert Cheng <albertching0112@gmail.com> Co-authored-by: Vadim Gimpelson <156319763+vadiklyutiy@users.noreply.github.com>
Albert Cheng committed
Jun 30, 2026 at 15:56 UTC
92c7fac640fa7f230f63e6e2e571965570010bc6
1 file changed
+7
-1
vllm/_custom_ops.py
+7
-1
@@ -57,7 +57,13 @@ def create_fp4_scale_tensor(
57
rounded_m = round_up(m, 128)
58
scale_n = n // block_size
59
rounded_n = round_up(scale_n, 4)
60
- return torch.empty(
60
+ # Must be zero-initialized: the swizzled scale buffer is padded to
61
+ # (round_up(m, 128), round_up(scale_n, 4) // 4) but the NVFP4 quant
62
+ # kernel does not write every padded element that the downstream
63
+ # NVFP4 GEMM reads. torch.empty leaves those padded scale factors
64
+ # uninitialized, which corrupts dequantization and causes a severe
65
+ # Blackwell NVFP4 decode throughput/output-length regression.
66
+ return torch.zeros(
67
(rounded_m, rounded_n // 4), device=device, dtype=torch.int32
68
)
69
else: