[Perf] zeros -> empty to remove additional fill (#42988)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
+2
-2
@@ -57,11 +57,11 @@ 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.zeros(
|
||||
return torch.empty(
|
||||
(rounded_m, rounded_n // 4), device=device, dtype=torch.int32
|
||||
)
|
||||
else:
|
||||
return torch.zeros((m, n // block_size), device=device, dtype=torch.uint8)
|
||||
return torch.empty((m, n // block_size), device=device, dtype=torch.uint8)
|
||||
|
||||
|
||||
def create_fp4_output_tensors(
|
||||
|
||||
@@ -1094,7 +1094,6 @@ class GatedDeltaNetAttention(PluggableLayer, MambaBase):
|
||||
)
|
||||
|
||||
core_attn_out.zero_()
|
||||
z_out.zero_()
|
||||
num_tokens_all = qkvz.shape[0]
|
||||
mixed_qkv, z, b, a = self.prepare_gdn_attention_core_inputs(
|
||||
qkvz, ba, num_tokens_all
|
||||
|
||||
@@ -255,7 +255,7 @@ def silu_mul_quant_fp8_packed_triton(
|
||||
if output_q is None:
|
||||
output_q = torch.empty((M, N_2), dtype=fp8_dtype, device=input.device)
|
||||
|
||||
output_scale_packed = torch.zeros(
|
||||
output_scale_packed = torch.empty(
|
||||
(num_packed_groups, tma_aligned_M),
|
||||
dtype=torch.int32,
|
||||
device=input.device,
|
||||
|
||||
@@ -454,7 +454,7 @@ class TurboQuantAttentionImpl(AttentionImpl["TurboQuantMetadata"]):
|
||||
)
|
||||
else:
|
||||
# Mixed batch: decodes first (guaranteed by reorder_batch).
|
||||
attn_out = torch.zeros(
|
||||
attn_out = torch.empty(
|
||||
N, self.num_heads, self.head_size, device=device, dtype=q.dtype
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user