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 14, 05:30 UTC
fix test_simple_inductor_graph_partition (#26522)
Signed-off-by: Boyuan Feng <boyuan@meta.com>
Boyuan Feng committed
Oct 9, 2025 at 23:39 UTC
b545a0b20776cbb5eb9b9575954a55268edf5339
2 files changed
+13
-3
tests/compile/piecewise/test_simple.py
+5
-1
@@ -143,10 +143,14 @@ def test_simple_piecewise_compile(use_inductor):
143
144
@torch.inference_mode()
145
@pytest.mark.parametrize("splitting_ops", [["silly.attention"], []])
146
-def test_simple_inductor_graph_partition(splitting_ops):
146
+def test_simple_inductor_graph_partition(splitting_ops, monkeypatch):
147
if not is_torch_equal_or_newer("2.9.0.dev"):
148
pytest.skip("inductor graph partition is only available in PyTorch 2.9+")
149
150
+ # disable compile cache so that we run separately for different splitting_ops
151
+ # and get the expected number of cudagraphs captured.
152
+ monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
153
+
154
_run_simple_model(
155
# Inductor graph partition automatically resets splitting_ops to an empty list
156
splitting_ops=splitting_ops,
vllm/compilation/compiler_interface.py
+8
-2
@@ -332,7 +332,10 @@ class InductorAdaptor(CompilerInterface):
332
nonlocal file_path
333
compiled_fn = inductor_compiled_graph.current_callable
334
file_path = compiled_fn.__code__.co_filename # noqa
335
- if not file_path.startswith(self.base_cache_dir):
335
+ if (
336
+ not file_path.startswith(self.base_cache_dir)
337
+ and compiled_fn.__closure__ is not None
338
+ ):
339
# hooked in the align_inputs_from_check_idxs function
340
# in torch/_inductor/utils.py
341
for cell in compiled_fn.__closure__:
@@ -359,7 +362,10 @@ class InductorAdaptor(CompilerInterface):
362
nonlocal file_path
363
compiled_fn = inductor_compiled_graph.current_callable
364
file_path = compiled_fn.__code__.co_filename # noqa
362
- if not file_path.startswith(self.base_cache_dir):
365
+ if (
366
+ not file_path.startswith(self.base_cache_dir)
367
+ and compiled_fn.__closure__ is not None
368
+ ):
369
# hooked in the align_inputs_from_check_idxs function
370
# in torch/_inductor/utils.py
371
for cell in compiled_fn.__closure__: