[HiSparse] Avoid host synchronization in eager backup (#41446)

This commit is contained in:
Shuwen Wang
2026-10-10 21:49:55 +08:00
committed by GitHub
parent 616178a596
commit 44bc478863
@@ -755,9 +755,11 @@ class HiSparseCoordinator:
if not backup_indices:
return
# Use a pinned, non-blocking H2D copy to avoid synchronizing the host
# with pending work on the schedule stream.
backup_indices_gpu = torch.tensor(
backup_indices, dtype=torch.int64, device=self.device
)
backup_indices, dtype=torch.int64, device="cpu", pin_memory=True
).to(self.device, non_blocking=True)
backup_req_indices = req_pool_indices[backup_indices_gpu]
# The previous compressed token's position and its device buffer slot: