From e3d81866662e0ce398a2985b82e59075f327f51f Mon Sep 17 00:00:00 2001 From: Zhengxu Chen Date: Tue, 28 Oct 2025 12:54:26 -0400 Subject: [PATCH] [compile] Add fallback path to AOT compile when serialization fails. (#27350) Signed-off-by: zhxchen17 Co-authored-by: Cyrus Leung --- vllm/compilation/decorators.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vllm/compilation/decorators.py b/vllm/compilation/decorators.py index 376039e4f133e..69fb93601f935 100644 --- a/vllm/compilation/decorators.py +++ b/vllm/compilation/decorators.py @@ -403,8 +403,17 @@ def _support_torch_compile( output = self.aot_compiled_fn(self, *args, **kwargs) assert aot_compilation_path is not None assert cache_dir is not None - os.makedirs(cache_dir, exist_ok=True) - self.aot_compiled_fn.save_compiled_function(aot_compilation_path) + try: + os.makedirs(cache_dir, exist_ok=True) + self.aot_compiled_fn.save_compiled_function( + aot_compilation_path + ) + except Exception as e: + logger.warning( + "Cannot save aot compilation to path %s, error: %s", + aot_compilation_path, + str(e), + ) else: output = self.compiled_callable(*args, **kwargs) return output