From 92c7fac640fa7f230f63e6e2e571965570010bc6 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 30 Jun 2026 15:56:56 -0700 Subject: [PATCH] [Perf] Restore zero-init of swizzled NVFP4 scale buffer to recover Blackwell decode throughput (#45739) Signed-off-by: Albert Cheng Co-authored-by: Vadim Gimpelson <156319763+vadiklyutiy@users.noreply.github.com> --- vllm/_custom_ops.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vllm/_custom_ops.py b/vllm/_custom_ops.py index 7dcb890aece..a609035560e 100644 --- a/vllm/_custom_ops.py +++ b/vllm/_custom_ops.py @@ -57,7 +57,13 @@ def create_fp4_scale_tensor( rounded_m = round_up(m, 128) scale_n = n // block_size rounded_n = round_up(scale_n, 4) - return torch.empty( + # Must be zero-initialized: the swizzled scale buffer is padded to + # (round_up(m, 128), round_up(scale_n, 4) // 4) but the NVFP4 quant + # kernel does not write every padded element that the downstream + # NVFP4 GEMM reads. torch.empty leaves those padded scale factors + # uninitialized, which corrupts dequantization and causes a severe + # Blackwell NVFP4 decode throughput/output-length regression. + return torch.zeros( (rounded_m, rounded_n // 4), device=device, dtype=torch.int32 ) else: