From 617c8b67b1e4d31a2bafa7fba7fe67150787d298 Mon Sep 17 00:00:00 2001 From: Alexandr <117110413+Allor-maker@users.noreply.github.com> Date: Mon, 19 Oct 2026 05:36:16 +0300 Subject: [PATCH] [Fix] Z-Image: Synchronize device after warmup request (#44306) --- python/sglang/multimodal_gen/runtime/managers/gpu_worker.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py b/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py index 061ce945d9..fcb31631c8 100644 --- a/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py +++ b/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py @@ -840,6 +840,11 @@ class GPUWorker(GPUWorkerPostTrainingMixin): req_label = req.request_id[:8] if req.request_id else "unnamed" with maybe_record_function(f"SAVE_OUTPUTS {req_label}"): self._materialize_output_transport(output_batch, req, save_output_paths) + if req.is_warmup and not current_platform.is_cpu(): + # A warmup saves no output, so nothing waits for its device work; + # drain it here or the next request's first blocking op pays for it. + torch.get_device_module().synchronize() + self._record_output_peak_memory(output_batch, is_warmup=req.is_warmup) collect_perf = (