[Model] Prime DLO cache retention with a startup warmup

Models whose request geometry opts out of the generic dummy run (H3: t2va
needs an explicit aspect ratio and a bounded duration) can declare a
dlo_dummy_run_recipe. Under distributed layerwise offload the engine's
startup warmup runs it, so the learned cache-retention budget is primed
before real traffic instead of on the first request.

H3 declares a maximum-duration t2va generation: duration is the only
workload variable at the fixed 768 short edge, so the learned peak
dominates every production request and no real request re-learns. Validated
on L20X: all cold-start releases happen during the startup warmup, zero
during requests; first request 15.91 s vs 16.7 s unwarmed, steady 14.9 s;
startup gains one max-length generation (~10-20 s). Non-DLO deployments
keep the opted-out generic warmup unchanged.

Signed-off-by: hsliuustc0106 <liuhongsheng4@huawei.com>
This commit is contained in:
hsliuustc0106 committed 2026-08-26 15:06:08 +08:00
1 parent c9bb65902e
commit f4394f1d3d
6 files changed
+201 -3

No files matched your search

+41 -2
View File
@@ -34,6 +34,7 @@ from vllm_omni.diffusion.diffusion_kv.config import DiffusionKVCacheMode, is_sch
from vllm_omni.diffusion.diffusion_kv.initialization import initialize_diffusion_kv_control_plane
from vllm_omni.diffusion.executor.abstract import DiffusionExecutor
from vllm_omni.diffusion.io_support import (
get_dlo_dummy_run_recipe,
get_dummy_run_num_frames,
get_dummy_run_num_image_inputs,
image_color_format,
@@ -1102,6 +1103,10 @@ class DiffusionEngine:
profile_requests.append(profile_request)
return profile_requests
# Sampling-recipe keys consumed by _make_dlo_dummy_request directly;
# everything else is forwarded through the request's extra_args.
_DLO_DUMMY_RUN_SAMPLING_KEYS = frozenset({"height", "width", "num_inference_steps", "num_frames", "guidance_scale"})
def _dummy_run(self):
"""A dummy run to warm up the model."""
req = self._make_dummy_request(
@@ -1110,13 +1115,47 @@ class DiffusionEngine:
guidance_scale=0.0,
)
if req is None:
logger.info("Skipping dummy warmup run (num_frames=0)")
return
req = self._make_dlo_dummy_request()
if req is None:
logger.info("Skipping dummy warmup run (num_frames=0)")
return
logger.info("dummy run to warm up the model")
output = self.add_req_and_wait_for_response(req)
if output.error:
raise RuntimeError(f"Dummy run failed: {output.error}")
def _make_dlo_dummy_request(self) -> OmniDiffusionRequest | None:
"""Build the model-declared startup warmup used under distributed offload.
Models whose request geometry needs model-specific sampling arguments
(task, duration, aspect ratio, ...) opt out of the generic dummy run
and declare ``dlo_dummy_run_recipe`` instead. Under distributed
layerwise offload one startup generation also primes the component
allocator-cache retention policy's observed-peak budget, so the
cold-start flushes land before real traffic.
"""
if not getattr(self.od_config, "enable_distributed_layerwise_offload", False):
return None
recipe = get_dlo_dummy_run_recipe(self.od_config.model_class_name)
if recipe is None:
return None
extra_args: dict[str, Any] = {"cfg_text_scale": 1.0, "cfg_img_scale": 1.0}
extra_args.update({k: v for k, v in recipe.items() if k not in self._DLO_DUMMY_RUN_SAMPLING_KEYS})
return OmniDiffusionRequest(
prompt={"prompt": "dummy run"},
request_id=DUMMY_DIFFUSION_REQUEST_ID,
sampling_params=OmniDiffusionSamplingParams(
height=int(recipe.get("height", 512)),
width=int(recipe.get("width", 512)),
num_inference_steps=int(recipe.get("num_inference_steps", 1)),
num_frames=int(recipe.get("num_frames", 0)),
guidance_scale=float(recipe.get("guidance_scale", 0.0)),
num_outputs_per_prompt=1,
extra_args=extra_args,
),
)
def _submit_rpc(
self,
method: str,
+16
View File
@@ -4,6 +4,7 @@
from __future__ import annotations
import inspect
from typing import Any
from vllm_omni.diffusion.data import OmniDiffusionConfig
from vllm_omni.diffusion.model_metadata import get_diffusion_model_metadata
@@ -54,6 +55,21 @@ def get_dummy_run_num_frames(model_class_name: str, supports_audio_input: bool)
return 2 if supports_audio_input or supports_audio_output(model_class_name) else 1
def get_dlo_dummy_run_recipe(model_class_name: str) -> dict[str, Any] | None:
"""Get the model-declared DLO startup-warmup recipe, or None.
Models that opt out of the generic dummy run (``dummy_run_num_frames = 0``)
because their request geometry needs model-specific sampling arguments can
still declare a recipe used only when distributed layerwise offload is
enabled, where one startup generation primes the component allocator-cache
retention policy.
"""
model_cls = DiffusionModelRegistry._try_load_model_cls(model_class_name)
recipe = getattr(model_cls, "dlo_dummy_run_recipe", None) if model_cls is not None else None
return dict(recipe) if recipe else None
def get_dummy_run_num_image_inputs(model_class_name: str) -> int:
"""Return the maximum advertised image-input count for profiling."""
@@ -704,6 +704,20 @@ class MiniMaxH3Pipeline(
"post_decode",
]
dummy_run_num_frames: ClassVar[int] = 0
# Startup warmup used only when distributed layerwise offload is enabled:
# the generic dummy run cannot satisfy t2va's required sampling arguments
# (explicit aspect ratio, bounded duration). Duration is the only workload
# variable at the fixed 768 short edge, so warming at the maximum makes the
# learned cache-retention peak dominate every production request and moves
# all cold-start flushes ahead of real traffic, at the cost of one
# max-length generation in boot time.
dlo_dummy_run_recipe: ClassVar[Mapping[str, Any] | None] = {
"task": "t2va",
"duration": MINIMAX_H3_MAX_OUTPUT_SECONDS,
"aspect_ratio": "16:9",
"num_inference_steps": 2,
"guidance_scale": 1.0,
}
# Only distilled releases pin a schedule, so the default keeps the legacy
# uniform path available to partially constructed pipelines.
_base_schedule_by_partition: ClassVar[Mapping[str, DMD2SigmaSchedule | None]] = {}