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 4, 16:15 UTC
[BE][Bugfix] Respect TORCH_COMPILE_DISABLE env var at the vLLM config level for torch 2.12 (#40715)
Signed-off-by: Lucas Kabela <lucaskabela@meta.com>
Lucas Kabela committed
Apr 24, 2026 at 16:25 UTC
ce6a199ecc0996254efcf6fe532c40d9b9432922
2 files changed
+23
tests/compile/test_config.py
+16
@@ -205,6 +205,22 @@ def test_enforce_eager(vllm_runner, monkeypatch):
205
pass
206
207
208
+@pytest.mark.forked
209
+def test_torch_compile_disable(vllm_runner, monkeypatch):
210
+ monkeypatch.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
211
+ monkeypatch.setenv("TORCH_COMPILE_DISABLE", "1")
212
+ monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
213
+
214
+ with (
215
+ compilation_counter.expect(num_graphs_seen=0, stock_torch_compile_count=0),
216
+ vllm_runner(
217
+ "facebook/opt-125m",
218
+ gpu_memory_utilization=0.4,
219
+ ) as _,
220
+ ):
221
+ pass
222
+
223
+
224
def test_splitting_ops_dynamic():
225
# Default config
226
config = VllmConfig()
vllm/config/vllm.py
+7
@@ -900,6 +900,13 @@ class VllmConfig:
900
self.compilation_config.mode = CompilationMode.NONE
901
self.compilation_config.cudagraph_mode = CUDAGraphMode.NONE
902
903
+ if os.environ.get("TORCH_COMPILE_DISABLE") == "1":
904
+ logger.warning(
905
+ "TORCH_COMPILE_DISABLE is set, disabling torch.compile. "
906
+ "This is equivalent to setting -cc.mode=none"
907
+ )
908
+ self.compilation_config.mode = CompilationMode.NONE
909
+
910
if self.compilation_config.backend == "eager" or (
911
self.compilation_config.mode is not None
912
and self.compilation_config.mode != CompilationMode.VLLM_COMPILE