[NPU] Fix device mismatch in SWA mask for DSpark verify graph capture (#39353)

This commit is contained in:
iridiumine
2026-09-14 19:36:33 +08:00
committed by GitHub
parent 66c7bc838e
commit 87db743021
@@ -802,7 +802,8 @@ class AscendAttnBackend(AttentionBackend):
and _is_dflash_verify(spec_info)
and seq_lens_cpu is not None
):
seq_lens_int = seq_lens_cpu[:bs].int()
# seq_lens_cpu may be a CPU tensor; swa_indices is on-device.
seq_lens_int = seq_lens_cpu[:bs].int().to(self.device)
else:
seq_lens_int = seq_lens[:bs].int()
starts = torch.clamp(seq_lens_int - self.sliding_window_size, min=0)