vllm-project / vllm-project/vllm
[Bug]: Standalone torch.compile cache uses stale artifact path after relocation
- Dominant language
- Python
- Stars
- 92k
- Forks
- 22.3k
- PR merge metrics
- PR metrics pending
Description
### Your current environment
The output of python collect_env.py
```text
Collecting environment information...
==============================
System Info
==============================
OS : Ubuntu 24.04.3 LTS (x86_64)
GCC version : (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Clang version : Could not collect
CMake version : version 4.4.2
Libc version : glibc-2.39
==============================
PyTorch Info
==============================
PyTorch version : 2.13.0+cpu
Is debug build : False
CUDA used to build PyTorch : Could not collect
ROCM used to build PyTorch : N/A
XPU used to build PyTorch : N/A
==============================
Python Environment
==============================
Python version : 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] (64-bit runtime)
Python platform : Linux-5.4.239-1.el7.elrepo.x86_64-x86_64-with-glibc2.39
==============================
CPU Info
==============================
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz
CPU family: 6
Model: 106
Thread(s) per core: 2
Core(s) per socket: 32
Socket(s): 2
Stepping: 6
BogoMIPS: 4000.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local wbnoinvd dtherm arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid md_clear pconfig flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 3 MiB (64 instances)
L1i cache: 2 MiB (64 instances)
L2 cache: 80 MiB (64 instances)
L3 cache: 96 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-31,64-95
NUMA node1 CPU(s): 32-63,96-127
==============================
Versions of relevant libraries
==============================
[pip3] numpy==2.3.5
[pip3] pyzmq==27.1.0
[pip3] torch==2.13.0+cpu
[pip3] torchaudio==2.11.0+cpu
[pip3] torchcodec==0.15.0
[pip3] torchvision==0.28.0+cpu
[pip3] transformers==5.15.0
[pip3] triton==3.7.1
[conda] Could not collect
==============================
vLLM Info
==============================
ROCM Version : Could not collect
vLLM Version : 0.27.2rc1.dev29+g50ba4bc6b (git sha: 50ba4bc6b)
vLLM Build Flags:
CUDA Archs: 7.5 8.0 8.6 9.0 10.0 12.0+PTX; ROCm: Disabled; XPU: Disabled
GPU Topology:
[redacted: host interconnect / NIC topology]
==============================
Environment Variables
==============================
NVIDIA_VISIBLE_DEVICES=,
CUBLAS_VERSION=13.1.0.3
NVIDIA_REQUIRE_CUDA=cuda>=9.0
TORCHINDUCTOR_LOOP_ORDERING_AFTER_FUSION=0
TORCH_CUDA_ARCH_LIST=7.5 8.0 8.6 9.0 10.0 12.0+PTX
NCCL_VERSION=2.28.8
NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
TORCH_NCCL_USE_COMM_NONBLOCKING=0
CUDA_ARCH_LIST=7.5 8.0 8.6 9.0 10.0 12.0
NVIDIA_PRODUCT_NAME=PyTorch
CUDA_VERSION=13.0.2.006
PYTORCH_VERSION=2.10.0a0+b558c98
PYTORCH_BUILD_NUMBER=0
CUBLASMP_VERSION=0.6.0.84
CUDNN_FRONTEND_VERSION=1.15.0
CUDA_COMPONENT_LIST=cccl crt nvrtc driver-dev culibos-dev cudart cudart-dev nvcc
CUDNN_VERSION=9.15.0.58
PYTORCH_HOME=/opt/pytorch/pytorch
NVIDIA_BUILD_ID=231036167
CUDA_DRIVER_VERSION=580.95.05
PYTORCH_BUILD_VERSION=2.10.0a0+b558c98
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
CUDA_MODULE_LOADING=LAZY
NVIDIA_REQUIRE_JETPACK_HOST_MOUNTS=
NVIDIA_PYTORCH_VERSION=25.11
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE=1
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
```
### 🐛 Describe the bug
vLLM's [`torch.compile` compilation cache documentation](https://docs.vllm.ai/en/stable/design/torch_compile/#compilation-cache)
documents that the `torch_compile_cache` directory can be copied in deployment
scenarios to reuse compilation artifacts.
For standalone Inductor compilation, an artifact handle is persisted as:
```text
(artifact_key, absolute_path)
```
`InductorStandaloneAdaptor.load()` currently resolves the artifact directly
from the persisted absolute path:
```python
path = handle[1]
```
If the compile cache is relocated to a different cache root, the artifact
moves with the cache, but the persisted handle still points to its original
location. Once that location is unavailable, loading through the persisted
handle attempts to access the stale path.
### Minimal reproducer
The following reproduces the path-resolution behavior on vLLM main at commit
`50ba4bc6b` without requiring a model or an existing compiled artifact:
```python
from unittest.mock import MagicMock, patch
from vllm.compilation.compiler_interface import InductorStandaloneAdaptor
old_cache_dir = "/tmp/vllm-cache-old"
new_cache_dir = "/tmp/vllm-cache-new"
artifact_key = "artifact_shape_None_subgraph_0"
adaptor = InductorStandaloneAdaptor(save_format="binary")
adaptor.initialize_cache(new_cache_dir)
handle = (
artifact_key,
f"{old_cache_dir}/{artifact_key}",
)
with (
patch(
"torch._inductor.CompiledArtifact.load",
return_value=MagicMock(),
) as load_mock,
patch(
"torch._inductor.compile_fx.graph_returns_tuple",
return_value=True,
),
):
adaptor.load(
handle=handle,
graph=MagicMock(),
example_inputs=[],
graph_index=0,
compile_range=MagicMock(),
)
print("current cache dir:", new_cache_dir)
print("persisted path: ", handle[1])
print("path used by load:", load_mock.call_args.kwargs["path"])
```
Observed output:
```text
current cache dir: /tmp/vllm-cache-new
persisted path: /tmp/vllm-cache-old/artifact_shape_None_subgraph_0
path used by load: /tmp/vllm-cache-old/artifact_shape_None_subgraph_0
```
Although the adaptor is initialized with the relocated cache directory,
`CompiledArtifact.load()` is still called with the absolute path from the
original cache location.
I also verified the failure with an existing standalone compiled artifact by
relocating the same artifact from cache root A to cache root B:
```text
ORIGINAL_PATH_LOAD = PASS
STALE_PATH_LOAD = FAIL (FileNotFoundError)
REBASED_PATH_LOAD = PASS
```
The artifact itself remains loadable from B after relocation. Loading through
the persisted handle fails when it still references A, which isolates the
stale absolute path as the failure condition.
### Expected behavior
A standalone compile cache should remain loadable when copied to a different
cache root for reuse and the cached artifacts are otherwise unchanged.
Artifact loading should resolve the corresponding artifact from the current
cache directory rather than depend on the cache's original absolute path.
A fix with regression coverage for both `binary` and `unpacked` standalone
artifact formats is available in #52142.
### Before submitting a new issue...
- [x] Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the [documentation page](https://docs.vllm.ai/en/latest/), which can answer lots of frequently asked questions.
Contributor guide
Research direction
Start at InductorStandaloneAdaptor.initialize_cache() and load() in vllm.compilation.compiler_interface, then inspect the standalone cache handle and relocation behavior shown in the reproducer. Compare the binary and unpacked formats and run the regression coverage available in #52142; done means copied artifacts load from the new cache root without using the stale absolute path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100