@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / b29cbf0652
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 3, 03:00 UTC

[Perf] `zeros` -> `empty` to remove additional fill (#42988)

Signed-off-by: yewentao256 <zhyanwentao@126.com>

Wentao Ye committed May 21, 2026 at 16:00 UTC b29cbf06525254693f29d98686e038eaf225be8c
4 files changed +4 -5
vllm/_custom_ops.py
+2 -2
@@ -57,11 +57,11 @@ 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.zeros(
60 + return torch.empty(
61 (rounded_m, rounded_n // 4), device=device, dtype=torch.int32
62 )
63 else:
64 - return torch.zeros((m, n // block_size), device=device, dtype=torch.uint8)
64 + return torch.empty((m, n // block_size), device=device, dtype=torch.uint8)
65
66
67 def create_fp4_output_tensors(
vllm/model_executor/layers/mamba/gdn_linear_attn.py
-1
@@ -1094,7 +1094,6 @@ class GatedDeltaNetAttention(PluggableLayer, MambaBase):
1094 )
1095
1096 core_attn_out.zero_()
1097 - z_out.zero_()
1097 num_tokens_all = qkvz.shape[0]
1098 mixed_qkv, z, b, a = self.prepare_gdn_attention_core_inputs(
1099 qkvz, ba, num_tokens_all
vllm/model_executor/layers/quantization/utils/fp8_utils.py
+1 -1
@@ -255,7 +255,7 @@ def silu_mul_quant_fp8_packed_triton(
255 if output_q is None:
256 output_q = torch.empty((M, N_2), dtype=fp8_dtype, device=input.device)
257
258 - output_scale_packed = torch.zeros(
258 + output_scale_packed = torch.empty(
259 (num_packed_groups, tma_aligned_M),
260 dtype=torch.int32,
261 device=input.device,
vllm/v1/attention/backends/turboquant_attn.py
+1 -1
@@ -454,7 +454,7 @@ class TurboQuantAttentionImpl(AttentionImpl["TurboQuantMetadata"]):
454 )
455 else:
456 # Mixed batch: decodes first (guaranteed by reorder_batch).
457 - attn_out = torch.zeros(
457 + attn_out = torch.empty(
458 N, self.num_heads, self.head_size, device=device, dtype=q.dtype
459 )
460