Enable Diffusion Image models asynchronous output (#4981)

Signed-off-by: zzh <943967662@qq.com>
Co-authored-by: dengyunyang <584797741@qq.com>
This commit is contained in:
zzhanddengyunyang authored and GitHub committed 2026-07-29 17:21:55 +00:00
1 parent f2d9eb1630
commit dba05c3517
22 files changed
+1440 -72

No files matched your search

+11
View File
@@ -273,6 +273,17 @@ class CudaOmniPlatform(OmniPlatform, CudaPlatformBase):
def synchronize(cls) -> None:
torch.accelerator.synchronize()
@classmethod
def record_device_event(cls) -> torch.Event | None:
"""Record a device event on the default stream to mark tensor readiness."""
try:
event = torch.Event()
event.record()
return event
except Exception:
logger.warning("Failed to record device event for cross-stream sync")
return None
@classmethod
def get_free_memory(cls, device: torch.device | None = None) -> int:
free, _ = torch.cuda.mem_get_info(device)