[CI] fix compile test | refactor VLLM_DISABLE_COMPILE_CACHE for tests (#49770)
Signed-off-by: Divakar Verma <divakar.verma@amd.com>
Divakar Verma committed
Jul 25, 2026 at 00:15 UTC
aaaeda98dcc14af75cd5fbd26386751a0e8b79c9
4 files changed
+23
-14
tests/compile/passes/test_fusion_attn.py
+1
-4
@@ -290,12 +290,9 @@ def test_attention_quant_pattern(
290
model_class: type[AttentionQuantPatternModel],
291
backend: AttentionBackendEnum,
292
dist_init,
293
- monkeypatch,
294
- use_fresh_inductor_cache,
293
+ disable_vllm_compile_cache,
294
):
295
"""Test AttentionStaticQuantPattern fusion pass"""
297
- monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
298
-
296
if backend == AttentionBackendEnum.FLASHINFER and (
297
not current_platform.is_device_capability((10, 0)) or not has_flashinfer()
298
):
tests/compile/passes/test_mla_attn_quant_fusion.py
+1
-4
@@ -419,8 +419,7 @@ def test_mla_attention_quant_pattern(
419
model_class: type[MLAAttentionQuantPatternModel],
420
backend: AttentionBackendEnum,
421
dist_init,
422
- monkeypatch,
423
- use_fresh_inductor_cache,
422
+ disable_vllm_compile_cache,
423
):
424
"""Test MLA AttentionQuantPattern fusion pass"""
425
if (
@@ -429,8 +428,6 @@ def test_mla_attention_quant_pattern(
428
):
429
pytest.skip("NVFP4 is not supported on this GPU (requires SM 100+).")
430
432
- monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
433
-
431
custom_ops_list = custom_ops.split(",") if custom_ops else []
432
433
device = torch.device(f"{DEVICE_TYPE}:0")
tests/compile/test_compile_ranges.py
+5
-6
@@ -66,7 +66,7 @@ class PostGradRangeChecker(InductorPass):
66
return InductorPass.hash_dict(state)
67
68
69
-def test_compile_ranges(use_fresh_inductor_cache):
69
+def test_compile_ranges(disable_vllm_compile_cache):
70
post_grad_range_checker = PostGradRangeChecker(
71
[
72
Range(start=1, end=8),
@@ -168,7 +168,7 @@ class PostGradStaticShapeChecker(InductorPass):
168
return InductorPass.hash_dict(state)
169
170
171
-def test_compile_sizes_produce_static_shapes(use_fresh_inductor_cache):
171
+def test_compile_sizes_produce_static_shapes(disable_vllm_compile_cache):
172
"""Verify that compile_sizes entries are compiled with fully concrete
173
shapes (no SymInts), while compile_ranges entries retain dynamic shapes."""
174
checker = PostGradStaticShapeChecker()
@@ -209,10 +209,9 @@ def test_compile_sizes_produce_static_shapes(use_fresh_inductor_cache):
209
)
210
211
212
-def test_inductor_cache_compile_ranges(monkeypatch, use_fresh_inductor_cache):
213
- # To force multiple compilations, we disable the compile cache
214
- monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
215
-
212
+def test_inductor_cache_compile_ranges(disable_vllm_compile_cache):
213
+ # disable_vllm_compile_cache sets VLLM_DISABLE_COMPILE_CACHE=1 to force
214
+ # multiple compilations by disabling vLLM's on-disk compile cache.
215
post_grad_range_checker = PostGradRangeChecker(
216
ranges=[
217
Range(start=1, end=8),
tests/conftest.py
+16
@@ -1768,6 +1768,22 @@ def use_fresh_inductor_cache():
1768
yield
1769
1770
1771
+@pytest.fixture
1772
+def disable_vllm_compile_cache(monkeypatch, use_fresh_inductor_cache):
1773
+ """
1774
+ Use a fresh inductor cache AND disable vLLM's on-disk torch.compile cache.
1775
+
1776
+ This forces compilation (and any custom compile passes) to actually run
1777
+ instead of being served from a warm cache left behind by previous runs
1778
+ (e.g. on persistent CI agents). Use this for tests that inspect what
1779
+ happens during compilation; use ``use_fresh_inductor_cache`` (or
1780
+ ``fresh_vllm_cache``) instead when the vLLM compile cache must stay
1781
+ enabled (e.g. cache save/load tests).
1782
+ """
1783
+ monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
1784
+ yield
1785
+
1786
+
1787
@pytest.fixture
1788
def fresh_vllm_cache(monkeypatch, use_fresh_inductor_cache):
1789
"""Temporary VLLM_CACHE_ROOT combined with a fresh inductor cache."""