From 6c58595c2d0d37c338cd757d55d48f446a68a7da Mon Sep 17 00:00:00 2001 From: Wentao Ye <44945378+yewentao256@users.noreply.github.com> Date: Tue, 1 Sep 2026 15:03:30 -0400 Subject: [PATCH] [Feature] Avoid flashinfer autotune each time when vllm source change (#54794) Signed-off-by: yewentao256 --- vllm/config/vllm.py | 10 +++++++--- .../model_executor/warmup/flashinfer_autotune_cache.py | 5 ++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/vllm/config/vllm.py b/vllm/config/vllm.py index 7fb53cdc24..0cf2f1f93a 100644 --- a/vllm/config/vllm.py +++ b/vllm/config/vllm.py @@ -438,7 +438,7 @@ class VllmConfig: remaining requests are aborted once the timeout is reached. """ - def compute_hash(self) -> str: + def compute_hash(self, include_version: bool = True) -> str: """ WARNING: Whenever a new field is added to this config, ensure that it is included in the factors list if @@ -449,14 +449,18 @@ class VllmConfig: graph from input ids/embeddings to the final hidden states, excluding anything before input ids/embeddings and after the final hidden states. + + Args: + include_version: Include the vLLM version in the hash. """ factors: list[Any] = [] # summarize vllm config vllm_factors: list[Any] = [] - from vllm import __version__ + if include_version: + from vllm import __version__ - vllm_factors.append(__version__) + vllm_factors.append(__version__) if self.model_config: vllm_factors.append(self.model_config.compute_hash()) if ( diff --git a/vllm/model_executor/warmup/flashinfer_autotune_cache.py b/vllm/model_executor/warmup/flashinfer_autotune_cache.py index 8c5bbb0fd4..37ea4812fc 100644 --- a/vllm/model_executor/warmup/flashinfer_autotune_cache.py +++ b/vllm/model_executor/warmup/flashinfer_autotune_cache.py @@ -10,15 +10,14 @@ from pathlib import Path from typing import TYPE_CHECKING import vllm.envs as envs -from vllm.compilation.caching import aot_compile_hash_factors if TYPE_CHECKING: from vllm.v1.worker.gpu_model_runner import GPUModelRunner def flashinfer_autotune_cache_hash(runner: "GPUModelRunner") -> str: - factors = aot_compile_hash_factors(runner.vllm_config) - return hashlib.sha256(str(factors).encode()).hexdigest() + config_hash = runner.vllm_config.compute_hash(include_version=False) + return hashlib.sha256(config_hash.encode()).hexdigest() def resolve_flashinfer_autotune_file(runner: "GPUModelRunner") -> Path: