Unverified Commit e3d81866 authored by Zhengxu Chen's avatar Zhengxu Chen Committed by GitHub
Browse files

[compile] Add fallback path to AOT compile when serialization fails. (#27350)


Signed-off-by: default avatarzhxchen17 <zhxchen17@fb.com>
Co-authored-by: default avatarCyrus Leung <tlleungac@connect.ust.hk>
parent f5710ef0
...@@ -403,8 +403,17 @@ def _support_torch_compile( ...@@ -403,8 +403,17 @@ def _support_torch_compile(
output = self.aot_compiled_fn(self, *args, **kwargs) output = self.aot_compiled_fn(self, *args, **kwargs)
assert aot_compilation_path is not None assert aot_compilation_path is not None
assert cache_dir is not None assert cache_dir is not None
os.makedirs(cache_dir, exist_ok=True) try:
self.aot_compiled_fn.save_compiled_function(aot_compilation_path) 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: else:
output = self.compiled_callable(*args, **kwargs) output = self.compiled_callable(*args, **kwargs)
return output return output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment