[Platform] Replace torch.cuda.Event with torch.Event (#47140)

Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Kunshang Ji
2026-06-30 08:39:59 -07:00
committed by GitHub
co-authored by Harry Mellor
parent fcaa84efa7
commit e840f0d3f5
31 changed files with 60 additions and 70 deletions
@@ -51,7 +51,7 @@ class MoELoRAContext:
# Events are paired one-per-overlap-pair: events[0,1] for w13,
# events[2,3] for w2, so the two pairs do not race on the same event.
aux_stream: torch.cuda.Stream | None = None
events: tuple[torch.cuda.Event, ...] | None = None
events: tuple[torch.Event, ...] | None = None
# Per-rank token→LoRA mapping after EP dispatch. Set by
# FusedMoEPrepareAndFinalizeModular.prepare() when EP+LoRA is active, read
+2 -2
View File
@@ -388,7 +388,7 @@ class _ModuleOffloader:
# Event to signal when H2D copy to static buffer is complete.
# Used for per-layer synchronization (both eager and capture modes).
self._copy_done_event = torch.cuda.Event()
self._copy_done_event = torch.Event()
# Track whether _copy_done_event is valid for eager-mode wait_event.
# False when: (1) never recorded, or (2) last recorded during a
@@ -518,7 +518,7 @@ class _ModuleOffloader:
# Fork: record event on compute stream, copy_stream waits on it
# This joins copy_stream to any active CUDA graph capture
fork_event = torch.cuda.Event()
fork_event = torch.Event()
torch.cuda.current_stream().record_event(fork_event)
self.copy_stream.wait_event(fork_event)