[CI] fix compile test | refactor VLLM_DISABLE_COMPILE_CACHE for tests (#49770)

Signed-off-by: Divakar Verma <divakar.verma@amd.com>
This commit is contained in:
Divakar Verma
2026-07-24 23:15:19 -05:00
committed by GitHub
parent d9cd774198
commit aaaeda98dc
4 changed files with 23 additions and 14 deletions
+1 -4
View File
@@ -290,12 +290,9 @@ def test_attention_quant_pattern(
model_class: type[AttentionQuantPatternModel], model_class: type[AttentionQuantPatternModel],
backend: AttentionBackendEnum, backend: AttentionBackendEnum,
dist_init, dist_init,
monkeypatch, disable_vllm_compile_cache,
use_fresh_inductor_cache,
): ):
"""Test AttentionStaticQuantPattern fusion pass""" """Test AttentionStaticQuantPattern fusion pass"""
monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
if backend == AttentionBackendEnum.FLASHINFER and ( if backend == AttentionBackendEnum.FLASHINFER and (
not current_platform.is_device_capability((10, 0)) or not has_flashinfer() not current_platform.is_device_capability((10, 0)) or not has_flashinfer()
): ):
@@ -419,8 +419,7 @@ def test_mla_attention_quant_pattern(
model_class: type[MLAAttentionQuantPatternModel], model_class: type[MLAAttentionQuantPatternModel],
backend: AttentionBackendEnum, backend: AttentionBackendEnum,
dist_init, dist_init,
monkeypatch, disable_vllm_compile_cache,
use_fresh_inductor_cache,
): ):
"""Test MLA AttentionQuantPattern fusion pass""" """Test MLA AttentionQuantPattern fusion pass"""
if ( if (
@@ -429,8 +428,6 @@ def test_mla_attention_quant_pattern(
): ):
pytest.skip("NVFP4 is not supported on this GPU (requires SM 100+).") pytest.skip("NVFP4 is not supported on this GPU (requires SM 100+).")
monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
custom_ops_list = custom_ops.split(",") if custom_ops else [] custom_ops_list = custom_ops.split(",") if custom_ops else []
device = torch.device(f"{DEVICE_TYPE}:0") device = torch.device(f"{DEVICE_TYPE}:0")
+5 -6
View File
@@ -66,7 +66,7 @@ class PostGradRangeChecker(InductorPass):
return InductorPass.hash_dict(state) return InductorPass.hash_dict(state)
def test_compile_ranges(use_fresh_inductor_cache): def test_compile_ranges(disable_vllm_compile_cache):
post_grad_range_checker = PostGradRangeChecker( post_grad_range_checker = PostGradRangeChecker(
[ [
Range(start=1, end=8), Range(start=1, end=8),
@@ -168,7 +168,7 @@ class PostGradStaticShapeChecker(InductorPass):
return InductorPass.hash_dict(state) return InductorPass.hash_dict(state)
def test_compile_sizes_produce_static_shapes(use_fresh_inductor_cache): def test_compile_sizes_produce_static_shapes(disable_vllm_compile_cache):
"""Verify that compile_sizes entries are compiled with fully concrete """Verify that compile_sizes entries are compiled with fully concrete
shapes (no SymInts), while compile_ranges entries retain dynamic shapes.""" shapes (no SymInts), while compile_ranges entries retain dynamic shapes."""
checker = PostGradStaticShapeChecker() checker = PostGradStaticShapeChecker()
@@ -209,10 +209,9 @@ def test_compile_sizes_produce_static_shapes(use_fresh_inductor_cache):
) )
def test_inductor_cache_compile_ranges(monkeypatch, use_fresh_inductor_cache): def test_inductor_cache_compile_ranges(disable_vllm_compile_cache):
# To force multiple compilations, we disable the compile cache # disable_vllm_compile_cache sets VLLM_DISABLE_COMPILE_CACHE=1 to force
monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1") # multiple compilations by disabling vLLM's on-disk compile cache.
post_grad_range_checker = PostGradRangeChecker( post_grad_range_checker = PostGradRangeChecker(
ranges=[ ranges=[
Range(start=1, end=8), Range(start=1, end=8),
+16
View File
@@ -1768,6 +1768,22 @@ def use_fresh_inductor_cache():
yield yield
@pytest.fixture
def disable_vllm_compile_cache(monkeypatch, use_fresh_inductor_cache):
"""
Use a fresh inductor cache AND disable vLLM's on-disk torch.compile cache.
This forces compilation (and any custom compile passes) to actually run
instead of being served from a warm cache left behind by previous runs
(e.g. on persistent CI agents). Use this for tests that inspect what
happens during compilation; use ``use_fresh_inductor_cache`` (or
``fresh_vllm_cache``) instead when the vLLM compile cache must stay
enabled (e.g. cache save/load tests).
"""
monkeypatch.setenv("VLLM_DISABLE_COMPILE_CACHE", "1")
yield
@pytest.fixture @pytest.fixture
def fresh_vllm_cache(monkeypatch, use_fresh_inductor_cache): def fresh_vllm_cache(monkeypatch, use_fresh_inductor_cache):
"""Temporary VLLM_CACHE_ROOT combined with a fresh inductor cache.""" """Temporary VLLM_CACHE_ROOT combined with a fresh inductor cache."""