Skip to content

Commit b4c8be5

Browse files
committed
[compile] Add fallback path to AOT compile when serialization fails.
Summary: Fixing issue #27348 For dynamo caching, it's possible that the compilation succeeds but the serialization step fails. In this case, the failure of serialization step shouldn't block user from getting compilation results correctly. Therefore we add a handling of the serialization error and only give warning when model saving fails. When saving fails, VLLM model runner should be able to just fallback to the old path, and in the next process, it will fail to load dynamo cache but still fallback to retracing with dynamo + loading inductor cache, which is the same behavior to AOT compile turned of off. This is mostly a short term fix and in the long term we should resolve the serialization bugs by eliminating pickling of graph modules. i.e. Once #25205 is merged, we should be able to resolve the issue at a lower level. Test Plan: pytest tests/lora/test_quant_model.py Reviewers: Subscribers: Tasks: Tags: Signed-off-by: zhxchen17 <zhxchen17@fb.com>
1 parent 4d0f266 commit b4c8be5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

vllm/compilation/decorators.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,17 @@ def patched_inline_call(self_):
402402
output = self.aot_compiled_fn(self, *args, **kwargs)
403403
assert aot_compilation_path is not None
404404
assert cache_dir is not None
405-
os.makedirs(cache_dir, exist_ok=True)
406-
self.aot_compiled_fn.save_compiled_function(aot_compilation_path)
405+
try:
406+
os.makedirs(cache_dir, exist_ok=True)
407+
self.aot_compiled_fn.save_compiled_function(
408+
aot_compilation_path
409+
)
410+
except Exception as e:
411+
logger.warning(
412+
"Cannot save aot compilation to path %s, error: %s",
413+
aot_compilation_path,
414+
str(e),
415+
)
407416
else:
408417
output = self.compiled_callable(*args, **kwargs)
409418
return output

0 commit comments

Comments
 (0)