Skip to content

Commit 6278bc8

Browse files
zou3519youkaichao
andauthored
Fix incorrect filenames in vllm_compile_cache.py (#15494)
Signed-off-by: <zou3519@gmail.com> Signed-off-by: youkaichao <youkaichao@gmail.com> Co-authored-by: youkaichao <youkaichao@gmail.com>
1 parent 3f532cb commit 6278bc8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

vllm/compilation/compiler_interface.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,20 @@ def hijacked_compile_fx_inner(*args, **kwargs):
229229
inductor_compiled_graph = output
230230
if inductor_compiled_graph is not None:
231231
nonlocal file_path
232-
file_path = inductor_compiled_graph.current_callable.__code__.co_filename # noqa
232+
compiled_fn = inductor_compiled_graph.current_callable
233+
file_path = compiled_fn.__code__.co_filename # noqa
234+
if not file_path.startswith(self.cache_dir):
235+
# hooked in the align_inputs_from_check_idxs function
236+
# in torch/_inductor/utils.py
237+
for cell in compiled_fn.__closure__:
238+
if not callable(cell.cell_contents):
239+
continue
240+
code = cell.cell_contents.__code__
241+
if code.co_filename.startswith(self.cache_dir):
242+
# this is the real file path
243+
# compiled from Inductor
244+
file_path = code.co_filename
245+
break
233246
hash_str = inductor_compiled_graph._fx_graph_cache_key
234247
return output
235248

0 commit comments

Comments
 (0)