vllm.compilation.depyf_compat
¶
Keep depyf usable against Inductor versions newer than its last release.
depyf.prepare_debug replaces three torch functions with hooks of its own.
Two of them tolerate new arguments, but load_by_key_path has its signature
frozen at (key, path, linemap, attrs), and Inductor now also passes
set_sys_modules (pytorch#184285). Every compilation that reaches an
autotune code block while depyf is active therefore dies with a TypeError,
which surfaces as InductorError: Failed to run autotuning code block.
depyf has hit this before -- linemap and attrs broke the same hook in
thuml/depyf#80 -- but 0.20.0 is both the pinned version and the last release
upstream published, so a version bump cannot resolve it. Patch the hook here
instead, following what depyf itself does for lazy_format_graph_code:
accept **kwargs and forward them.
Route every depyf entry point through prepare_debug below so the patch is
never missed.
Functions:
-
prepare_debug–depyf.prepare_debugwith the compatibility patches applied.
_hook_accepts_inductor_keywords(hook)
¶
Whether depyf's hook already takes everything Inductor passes it.
Compares against the live PyCodeCache.load_by_key_path, so this only
means anything before depyf swaps that out for the hook.
Source code in vllm/compilation/depyf_compat.py
_patch_load_by_key_path()
¶
Forward unrecognised keywords through depyf's load_by_key_path hook.
Mirrors depyf's own implementation -- dump the generated source alongside
the rest of the debug output, then defer to the function depyf displaced --
and adds **kwargs so the call survives arguments depyf never knew about.
Source code in vllm/compilation/depyf_compat.py
prepare_debug(dump_src_dir)
¶
depyf.prepare_debug with the compatibility patches applied.