diff --git a/vllm/compilation/compiler_interface.py b/vllm/compilation/compiler_interface.py index b45c694fd7f8..407ba77937f4 100644 --- a/vllm/compilation/compiler_interface.py +++ b/vllm/compilation/compiler_interface.py @@ -228,7 +228,20 @@ def hijacked_compile_fx_inner(*args, **kwargs): inductor_compiled_graph = output if inductor_compiled_graph is not None: nonlocal file_path - file_path = inductor_compiled_graph.current_callable.__code__.co_filename # noqa + compiled_fn = inductor_compiled_graph.current_callable + file_path = compiled_fn.__code__.co_filename # noqa + if not file_path.startswith(self.cache_dir): + # hooked in the align_inputs_from_check_idxs function + # in torch/_inductor/utils.py + for cell in compiled_fn.__closure__: + if not callable(cell.cell_contents): + continue + code = cell.cell_contents.__code__ + if code.co_filename.startswith(self.cache_dir): + # this is the real file path + # compiled from Inductor + file_path = code.co_filename + break hash_str = inductor_compiled_graph._fx_graph_cache_key return output