[Feature] Avoid flashinfer autotune each time when vllm source change (#54794)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
+7
-3
@@ -438,7 +438,7 @@ class VllmConfig:
|
|||||||
remaining requests are aborted once the timeout is reached.
|
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,
|
WARNING: Whenever a new field is added to this config,
|
||||||
ensure that it is included in the factors list if
|
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,
|
graph from input ids/embeddings to the final hidden states,
|
||||||
excluding anything before input ids/embeddings and after
|
excluding anything before input ids/embeddings and after
|
||||||
the final hidden states.
|
the final hidden states.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
include_version: Include the vLLM version in the hash.
|
||||||
"""
|
"""
|
||||||
factors: list[Any] = []
|
factors: list[Any] = []
|
||||||
|
|
||||||
# summarize vllm config
|
# summarize vllm config
|
||||||
vllm_factors: list[Any] = []
|
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:
|
if self.model_config:
|
||||||
vllm_factors.append(self.model_config.compute_hash())
|
vllm_factors.append(self.model_config.compute_hash())
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -10,15 +10,14 @@ from pathlib import Path
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import vllm.envs as envs
|
import vllm.envs as envs
|
||||||
from vllm.compilation.caching import aot_compile_hash_factors
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from vllm.v1.worker.gpu_model_runner import GPUModelRunner
|
from vllm.v1.worker.gpu_model_runner import GPUModelRunner
|
||||||
|
|
||||||
|
|
||||||
def flashinfer_autotune_cache_hash(runner: "GPUModelRunner") -> str:
|
def flashinfer_autotune_cache_hash(runner: "GPUModelRunner") -> str:
|
||||||
factors = aot_compile_hash_factors(runner.vllm_config)
|
config_hash = runner.vllm_config.compute_hash(include_version=False)
|
||||||
return hashlib.sha256(str(factors).encode()).hexdigest()
|
return hashlib.sha256(config_hash.encode()).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def resolve_flashinfer_autotune_file(runner: "GPUModelRunner") -> Path:
|
def resolve_flashinfer_autotune_file(runner: "GPUModelRunner") -> Path:
|
||||||
|
|||||||
Reference in New Issue
Block a user