Skip to content

Commit 5ccc709

Browse files
houseroadwuisawesome
authored andcommitted
Disable the torch.compile cache checks when VLLM_DISABLE_COMPILE_CACHE=1 (vllm-project#16573)
Signed-off-by: Lu Fang <[email protected]>
1 parent 4a91622 commit 5ccc709

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

vllm/compilation/compiler_interface.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import torch._inductor.compile_fx
1212
import torch.fx as fx
1313

14+
import vllm.envs as envs
1415
from vllm.config import VllmConfig
1516
from vllm.utils import is_torch_equal_or_newer
1617

@@ -317,10 +318,14 @@ def _get_shape_env() -> AlwaysHitShapeEnv:
317318
inner_compile=hijacked_compile_fx_inner,
318319
config_patches=current_config)
319320

320-
assert hash_str is not None, (
321-
"failed to get the hash of the compiled graph")
322-
assert file_path is not None, (
323-
"failed to get the file path of the compiled graph")
321+
# We treat VLLM_DISABLE_COMPILE_CACHE as the overall switch for torch
322+
# compilation cache. So turn off the checks if we disable the
323+
# compilation cache.
324+
if not envs.VLLM_DISABLE_COMPILE_CACHE:
325+
assert hash_str is not None, (
326+
"failed to get the hash of the compiled graph")
327+
assert file_path is not None, (
328+
"failed to get the file path of the compiled graph")
324329
return compiled_graph, (hash_str, file_path)
325330

326331
def load(self,

0 commit comments

Comments
 (0)