[diffusion] fix: fix serving with dit-layerwise-offload enabled (#16066)

Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
This commit is contained in:
Mick
2025-12-30 00:21:42 +08:00
committed by GitHub
parent c31f62722c
commit 8e08207c18
8 changed files with 110 additions and 9 deletions

View File

@@ -98,8 +98,11 @@ class LayerwiseOffloadManager:
continue
self._offload_tensor(name, buf, layer_idx)
self.prefetch_layer(0, non_blocking=False)
if self.copy_stream is not None:
self.prepare_for_next_denoise(non_blocking=False)
def prepare_for_next_denoise(self, non_blocking=True):
self.prefetch_layer(0, non_blocking=non_blocking)
if not non_blocking and self.copy_stream is not None:
torch.cuda.current_stream().wait_stream(self.copy_stream)
@torch.compiler.disable