[Perf][Attention] Avoid redundant sparse attention metadata operations (#57885)

Signed-off-by: Woosuk Kwon <woosuk@inferact.ai>
Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
Woosuk Kwon
2026-09-21 00:08:43 -07:00
committed by GitHub
co-authored by OpenAI Codex
parent 3c84ad13ed
commit 97dc6b19d2
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -613,7 +613,7 @@ class DeepseekSparseSWAMetadataBuilder(AttentionMetadataBuilder):
)
is_valid_token = self.is_valid_token[: slot_mapping.shape[0]]
is_valid_token.copy_(slot_mapping >= 0)
torch.ge(slot_mapping, 0, out=is_valid_token)
if replay_start is None:
# Graph captures build without it; their dummy batches replay nothing.
replay_start = self.no_replay_start