[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:
co-authored by
OpenAI Codex
parent
3c84ad13ed
commit
97dc6b19d2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user