@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 0283f303d8
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 4, 18:45 UTC

[BE] Fix compile time message to be consistent (use monitoring) (#40641)

Signed-off-by: Lucas Kabela <lucaskabela@meta.com>

Lucas Kabela committed Apr 22, 2026 at 17:12 UTC 0283f303d8c6f19f670306c50dba00e897ae94f9
3 files changed +14 -15
vllm/compilation/backends.py
+4 -13
@@ -283,10 +283,6 @@ class CompilerManager:
283 # after loading the last graph for this shape, record the time.
284 # there can be multiple graphs due to piecewise compilation.
285 elapsed = time.perf_counter() - compilation_start_time
286 - if is_encoder:
287 - compilation_config.encoder_compilation_time += elapsed
288 - else:
289 - compilation_config.compilation_time += elapsed
286 logger.info_once(
287 "Directly load the compiled graph(s) for compile range %s "
288 "from the cache, took %.3f s",
@@ -388,10 +384,6 @@ class CompilerManager:
384 # after compiling the last graph, record the end time
385 if graph_index == num_graphs - 1:
386 elapsed = time.perf_counter() - compilation_start_time
391 - if is_encoder:
392 - compilation_config.encoder_compilation_time += elapsed
393 - else:
394 - compilation_config.compilation_time += elapsed
387 logger.info_once(
388 "Compiling a graph for compile range %s takes %.2f s",
389 str(compile_range),
@@ -1129,11 +1121,10 @@ class VllmBackend:
1121 from .monitor import torch_compile_start_time
1122
1123 dynamo_time = time.perf_counter() - torch_compile_start_time
1132 - logger.info_once("Dynamo bytecode transform time: %.2f s", dynamo_time)
1133 - if self.is_encoder:
1134 - self.compilation_config.encoder_compilation_time += dynamo_time
1135 - else:
1136 - self.compilation_config.compilation_time += dynamo_time
1124 + logger.info_once(
1125 + "Dynamo bytecode transform time: %.2f s",
1126 + dynamo_time,
1127 + )
1128
1129 # Record Dynamo time in tracing if available
1130 start_time = int(torch_compile_start_time * 1e9)
vllm/compilation/decorators.py
+5 -2
@@ -285,7 +285,7 @@ def _try_load_aot_compiled_fn(
285 Re-raises on failure when ``VLLM_FORCE_AOT_LOAD`` is set.
286 """
287 try:
288 - with monitor_torch_compile(model.vllm_config):
288 + with monitor_torch_compile(model.vllm_config, is_encoder=model._is_encoder):
289 with (
290 set_current_vllm_config(model.vllm_config),
291 open(aot_compilation_path, "rb") as f,
@@ -617,7 +617,9 @@ def _support_torch_compile(
617 # store the path for saving after warmup
618 self._aot_compilation_path = aot_compilation_path
619 self._aot_cache_dir = cache_dir
620 - with monitor_torch_compile(self.vllm_config):
620 + with monitor_torch_compile(
621 + self.vllm_config, is_encoder=self._is_encoder
622 + ):
623 self.aot_compiled_fn = self.aot_compile(*args, **kwargs)
624 compilation_counter.num_aot_compiles += 1
625 # All compilation is done at this point, save the
@@ -631,6 +633,7 @@ def _support_torch_compile(
633 self.vllm_config,
634 "torch.compile and initial profiling/warmup "
635 "run together took %.2f s in total",
636 + is_encoder=self._is_encoder,
637 ):
638 output = TorchCompileWithNoGuardsWrapper.__call__(
639 self, # type: ignore[arg-type]
vllm/compilation/monitor.py
+5
@@ -18,6 +18,7 @@ torch_compile_start_time: float = 0.0
18 def monitor_torch_compile(
19 vllm_config: VllmConfig,
20 message: str = "torch.compile took %.2f s in total",
21 + is_encoder: bool = False,
22 ) -> Generator[None, None, None]:
23 """Context manager that times torch.compile and manages depyf debugging.
24
@@ -45,6 +46,10 @@ def monitor_torch_compile(
46 else:
47 total_compile_time = time.perf_counter() - torch_compile_start_time
48 if compilation_config.mode == CompilationMode.VLLM_COMPILE:
49 + if is_encoder:
50 + compilation_config.encoder_compilation_time += total_compile_time
51 + else:
52 + compilation_config.compilation_time += total_compile_time
53 logger.info_once(message, total_compile_time)
54 finally:
55 if depyf_cm is not None: