INNER CODE UNIT · Python
_warmup_primary_engine
raullenchai/Rapid-MLX · vllm_mlx/server.py:624
async def _warmup_primary_engine(engine: BaseEngine) -> None:
"""Compile the configured engine on its model-owning worker."""
import time as _time
logger.info("Warming up (compiling Metal shaders)...")
warmup_start = _time.monotonic()
try:
is_hybrid = _detect_hybrid_for_warmup(engine)
if not is_hybrid:
# `generate_warmup()` synchronously waits for the model-owning MLX
# executor. During eager boot there is no traffic yet, but on a
# demand load that wait must leave the event loop free for health
# probes and other coalesced requests.
await asyncio.to_thread(engine.generate_warmup)
else:
logger.info(
"Hybrid model: running full request warmup "