A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 7, 20:15 UTC
[compile] Save aot compile artifacts atomically. (#35117)
Signed-off-by: zhxchen17 <zhxchen17@fb.com>
Zhengxu Chen committed
Feb 24, 2026 at 07:11 UTC
c77f3e1207d32d4101a202e92f5d684d1c6968e1
1 file changed
+5
-1
vllm/compilation/decorators.py
+5
-1
@@ -575,7 +575,11 @@ def _support_torch_compile(
575
logger.info("saving AOT compiled function to %s", self._aot_compilation_path)
576
try:
577
os.makedirs(self._aot_cache_dir, exist_ok=True)
578
- self.aot_compiled_fn.save_compiled_function(self._aot_compilation_path)
578
+ # File saving should be atomic, so we will save to a temporary location
579
+ # first. Should be upstreamed to PyTorch 2.12 as well.
580
+ tmp_file = f"{self._aot_compilation_path}.{os.getpid()}.tmp"
581
+ self.aot_compiled_fn.save_compiled_function(tmp_file)
582
+ os.replace(tmp_file, self._aot_compilation_path)
583
logger.info("saved AOT compiled function to %s", self._aot_compilation_path)
584
except Exception as e:
585
logger.warning(