[Perf] Remove redundant clone for GLM, Deepseek etc (#46651)

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

Wentao Ye committed Jun 25, 2026 at 16:09 UTC 8b4d93ba2b4e4e79062fd59a35a623e381dcf6b0
4 files changed +4 -4
vllm/model_executor/models/AXK1.py
+1 -1
@@ -649,7 +649,7 @@ class AXK1DecoderLayer(nn.Module):
649 ) -> tuple[torch.Tensor, torch.Tensor]:
650 # Self Attention
651 if residual is None:
652 - residual = hidden_states.clone()
652 + residual = hidden_states
653 hidden_states = self.input_layernorm(hidden_states)
654 else:
655 hidden_states, residual = self.input_layernorm(hidden_states, residual)
vllm/model_executor/models/deepseek_v2.py
+1 -1
@@ -1186,7 +1186,7 @@ class DeepseekV2DecoderLayer(nn.Module):
1186 ) -> torch.Tensor:
1187 # Self Attention
1188 if residual is None:
1189 - residual = hidden_states.clone()
1189 + residual = hidden_states
1190 hidden_states = self.input_layernorm(hidden_states)
1191 else:
1192 hidden_states, residual = self.input_layernorm(hidden_states, residual)
vllm/model_executor/models/glm4_moe_lite.py
+1 -1
@@ -184,7 +184,7 @@ class Glm4MoeLiteDecoderLayer(nn.Module):
184 ) -> torch.Tensor:
185 # Self Attention
186 if residual is None:
187 - residual = hidden_states.clone()
187 + residual = hidden_states
188 hidden_states = self.input_layernorm(hidden_states)
189 else:
190 hidden_states, residual = self.input_layernorm(hidden_states, residual)
vllm/model_executor/models/openpangu.py
+1 -1
@@ -935,7 +935,7 @@ class OpenPanguDecoderLayer(nn.Module):
935 residual: torch.Tensor | None,
936 ) -> torch.Tensor:
937 if residual is None:
938 - residual = hidden_states.clone()
938 + residual = hidden_states
939 hidden_states = self.input_layernorm(hidden_states)
940 else:
941 hidden_states, residual = self.input_layernorm(hidden_states, residual)