Measure encoder compile time seperate from llm backbone (#39240)

Signed-off-by: Lucas Kabela <lucaskabela@meta.com>
This commit is contained in:
Lucas Kabela
2026-04-14 10:52:49 -04:00
committed by GitHub
parent f02b3269e7
commit c08f3b2a62
9 changed files with 186 additions and 147 deletions
+13 -3
View File
@@ -265,6 +265,7 @@ class CompilerManager:
compile_range: Range,
graph_index: int = 0,
num_graphs: int = 1,
is_encoder: bool = False,
) -> Any:
if graph_index == 0:
# before compiling the first graph, record the start time
@@ -282,7 +283,10 @@ class CompilerManager:
# after loading the last graph for this shape, record the time.
# there can be multiple graphs due to piecewise compilation.
elapsed = time.perf_counter() - compilation_start_time
compilation_config.compilation_time += elapsed
if is_encoder:
compilation_config.encoder_compilation_time += elapsed
else:
compilation_config.compilation_time += elapsed
logger.info_once(
"Directly load the compiled graph(s) for compile range %s "
"from the cache, took %.3f s",
@@ -387,7 +391,10 @@ class CompilerManager:
# after compiling the last graph, record the end time
if graph_index == num_graphs - 1:
elapsed = time.perf_counter() - compilation_start_time
compilation_config.compilation_time += elapsed
if is_encoder:
compilation_config.encoder_compilation_time += elapsed
else:
compilation_config.compilation_time += elapsed
logger.info_once(
"Compiling a graph for compile range %s takes %.2f s",
str(compile_range),
@@ -1130,7 +1137,10 @@ class VllmBackend:
logger.info_once(
"Dynamo bytecode transform time: %.2f s", dynamo_time, scope="local"
)
self.compilation_config.compilation_time += dynamo_time
if self.is_encoder:
self.compilation_config.encoder_compilation_time += dynamo_time
else:
self.compilation_config.compilation_time += dynamo_time
# Record Dynamo time in tracing if available
start_time = int(torch_compile_start_time * 1e9)
+1
View File
@@ -270,6 +270,7 @@ class PiecewiseBackend:
compile_range=range_entry.compile_range,
graph_index=self.piecewise_compile_index,
num_graphs=self.total_piecewise_compiles,
is_encoder=self.vllm_backend.is_encoder,
)
range_entry.compiled = True