[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>
This commit is contained in:
Albert Cheng
2026-06-30 22:56:56 +00:00
committed by GitHub
co-authored by Vadim Gimpelson
parent ac521f6237
commit 92c7fac640
+7 -1
View File
@@ -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: