Adds ALL files needed for Dockerfile build:
- qwen3_6_scripts/ (baseline patches + our optimizations)
- vllm/ (full vllm package)
- paged_attention_v2_pytorch.py (V2 with single-bmm optimization)
- Dockerfile + computility-run.yaml
Our optimizations vs baseline:
1. paged_attn.py: pre-gathered context KV (eliminates 194 gather calls),
Triton try/fallback, V2 heuristic, threshold 32K→64K
2. paged_attention_v2_pytorch.py: fills NotImplementedError,
single-bmm Phase 1 (195 launches → 3)
3. patch_enable_triton.py: HAS_TRITON=True with safety fallback
4. patch_triton_tuning.py: BLOCK=64, NUM_WARPS=4 for BI-V100
5. computility-run.yaml: gpu-memory-utilization 0.9→0.95,
max-num-batched-tokens 8192→16384
This repo can now be submitted to dev.modelhub.org.cn as-is.
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
import logging
|
|
from typing import Callable, Dict, Optional, Union
|
|
|
|
import vllm.envs as envs
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def load_general_plugins():
|
|
"""WARNING: plugins can be loaded for multiple times in different
|
|
processes. They should be designed in a way that they can be loaded
|
|
multiple times without causing issues.
|
|
"""
|
|
import sys
|
|
if sys.version_info < (3, 10):
|
|
from importlib_metadata import entry_points
|
|
else:
|
|
from importlib.metadata import entry_points
|
|
|
|
allowed_plugins = envs.VLLM_PLUGINS
|
|
|
|
discovered_plugins = entry_points(group='vllm.general_plugins')
|
|
for plugin in discovered_plugins:
|
|
logger.info("Found general plugin: %s", plugin.name)
|
|
if allowed_plugins is None or plugin.name in allowed_plugins:
|
|
try:
|
|
func = plugin.load()
|
|
func()
|
|
logger.info("Loaded general plugin: %s", plugin.name)
|
|
except Exception:
|
|
logger.exception("Failed to load general plugin: %s",
|
|
plugin.name)
|
|
|
|
|
|
_torch_compile_backend: Optional[Union[Callable, str]] = None
|
|
|
|
|
|
def set_torch_compile_backend(backend: Union[Callable, str]):
|
|
global _torch_compile_backend
|
|
_torch_compile_backend = backend
|
|
|
|
|
|
def get_torch_compile_backend() -> Optional[Union[Callable, str]]:
|
|
return _torch_compile_backend
|
|
|
|
|
|
_inductor_additional_configs: Dict = {}
|
|
|
|
|
|
def set_inductor_additional_configs(configs: Dict):
|
|
global _inductor_additional_configs
|
|
_inductor_additional_configs = configs
|
|
|
|
|
|
def get_inductor_additional_configs() -> Dict:
|
|
return _inductor_additional_configs
|