[Mini-VLLM] Remove LoRA, plugins, speech-to-text and scale-out surfaces

Production runs one static model behind the OpenAI-compatible API. Every
adapter path and non-OpenAI HTTP surface is unreachable there.

- Delete the LoRA stack: vllm/lora, LoRARequest on the engine wire, the
  scheduler, worker, cudagraph and MoE plumbing, LoRA metrics, the lora
  CLI group, and the LoRA tests.
- Drop the plugin loader in vllm/plugins. Platform resolution is now
  CUDA-only and the general/stat-logger plugin hooks are gone.
- Delete the speech-to-text and realtime entrypoints, the scale-out
  render routes, and vllm/config/speech_to_text.py. GenerationTask is
  generate-only.
- Cut DecodeBenchConnector and the disagg-prefill doc and image. The
  Multi, Offloading and Example connectors stay; production uses the
  CPU KV offload tier.
- Delete the ROCm-only fused KDA chunk kernel (2346 lines) with its CMake
  arch gate, declarations and op registrations. The CUDA build never
  defined the guard and no Python caller existed.
- Delete the orphan Mistral and Pixtral chat fixtures and examples/.
- Fix _check_model: removing the LoRA early return made every request
  fail with "The model ... does not exist. Valid aliases: ...".

Verified on an RTX 3090: import sweep reports 1242 modules with 7 known
optional-dependency failures; a live server answers chat, completions,
responses, tokenize and detokenize with zero log errors and 404 for the
removed surfaces; collection yields 8558 tests with the 3 pre-existing
errors; ruff adds no new finding; the incremental _C build succeeds.

Co-authored-by: Hinata <hinata@idihore.id>
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-10-19 21:06:19 +07:00
co-authored by Hinata
parent 5f3c7bd8ab
commit 5aa2ac64f8
269 changed files with 417 additions and 29932 deletions
+16 -80
View File
@@ -6,7 +6,7 @@ from collections import defaultdict
from collections.abc import Callable, Iterable, Sequence
from contextlib import ExitStack
from dataclasses import dataclass, replace
from itertools import groupby, product
from itertools import groupby
from typing import TYPE_CHECKING, Any, NamedTuple, Protocol
import torch
@@ -80,7 +80,6 @@ class BatchExecutionDescriptor:
# uniform_token_count unset, so this is what keeps a prefill batch out of one:
# the runner passes None for any batch with a prefill.
max_query_len: int | None = None
num_active_loras: int = 0
# Number of microbatches the batch is split into (DBO). 1 means no splitting.
num_ubatches: int = 1
@@ -113,7 +112,6 @@ def _is_compatible(
num_reqs: int,
num_tokens: int,
uniform_token_count: int | None,
num_active_loras: int,
max_query_len: int | None,
num_ubatches: int,
) -> bool:
@@ -133,7 +131,6 @@ def _is_compatible(
)
and (desc.num_reqs is None or desc.num_reqs >= num_reqs)
and desc.num_tokens >= num_tokens
and desc.num_active_loras == num_active_loras
and desc.num_ubatches == num_ubatches
)
@@ -154,7 +151,6 @@ class CudaGraphManager:
device: torch.device,
cudagraph_mode: CUDAGraphMode,
decode_query_len: int,
lora_capture_cases: list[int] | None = None,
varlen_decode: bool = False,
ubatch_runner: "UBatchRunner | None" = None,
):
@@ -172,10 +168,6 @@ class CudaGraphManager:
self.tp_size = vllm_config.parallel_config.tensor_parallel_size
self.is_first_pp_rank = get_pp_group().is_first_rank
self.is_last_pp_rank = get_pp_group().is_last_rank
self.lora_capture_cases = lora_capture_cases or [0]
# Precompute actual num_active_loras -> captured case mapping so that
# dispatch() is a plain dict lookup instead of a per-call bisect.
self._lora_dispatch_map, self._max_lora_case = self._build_lora_dispatch_map()
self.graphs: dict[BatchExecutionDescriptor, torch.cuda.CUDAGraph] = {}
self.pool = current_platform.get_global_graph_pool() if cudagraph_mode else None
@@ -188,7 +180,7 @@ class CudaGraphManager:
self._max_full_descs_to_capture: int | None = None
self._capture_mem_samples: list[int] | None = None
self._candidates: dict[tuple[int, int], list[BatchExecutionDescriptor]] = {}
self._candidates: dict[int, list[BatchExecutionDescriptor]] = {}
self._capture_descs: dict[CUDAGraphMode, list[BatchExecutionDescriptor]] = {}
# Breakable CUDA graph (PW CUDA graph without torch.compile)
@@ -200,32 +192,6 @@ class CudaGraphManager:
self._init_candidates()
def _build_lora_dispatch_map(self) -> tuple[dict[int, int], int]:
"""Precompute actual num_active_loras -> effective captured case.
Mirrors the num_tokens candidate expansion in ``_init_candidates``:
every possible active-LoRA count is mapped ahead of time to the
smallest captured case that can serve it, so ``dispatch`` is a plain
dict lookup instead of a per-call bisect.
"""
captured_with_lora = sorted(c for c in self.lora_capture_cases if c > 0)
if not captured_with_lora:
return {}, 0
dispatch_map: dict[int, int] = {}
case_idx = 0
for n in range(1, captured_with_lora[-1] + 1):
while captured_with_lora[case_idx] < n:
case_idx += 1
dispatch_map[n] = captured_with_lora[case_idx]
return dispatch_map, captured_with_lora[-1]
def _resolve_effective_loras(self, num_active_loras: int) -> int:
"""Map an actual active-LoRA count to its captured graph case."""
if num_active_loras <= 0 or not self._lora_dispatch_map:
return num_active_loras
# Counts above the largest captured case clamp to it.
return self._lora_dispatch_map.get(num_active_loras, self._max_lora_case)
def _maybe_ubatch_twin(
self, desc: BatchExecutionDescriptor
) -> BatchExecutionDescriptor | None:
@@ -302,9 +268,7 @@ class CudaGraphManager:
capture_varlen_decode = (
separate_decode_routine and bool(decode_mode) and self.varlen_decode
)
for num_tokens, num_active_loras in product(
capture_sizes, self.lora_capture_cases
):
for num_tokens in capture_sizes:
# Varlen decode graphs take any mix of 1..decode_query_len tokens per
# request, worst case 1 token per request (or max_num_reqs)
if capture_varlen_decode and num_tokens <= max_decode_tokens:
@@ -313,7 +277,6 @@ class CudaGraphManager:
num_tokens=num_tokens,
num_reqs=min(num_tokens, self.max_num_reqs),
max_query_len=self.decode_query_len,
num_active_loras=num_active_loras,
)
descs_by_mode[decode_mode].append(desc)
# Capture uniform decode specfifc graphs if required
@@ -335,7 +298,6 @@ class CudaGraphManager:
num_tokens=rounded_num_tokens,
num_reqs=rounded_num_reqs,
uniform_token_count=decode_query_len,
num_active_loras=num_active_loras,
)
# avoid duplicate graphs
@@ -365,7 +327,6 @@ class CudaGraphManager:
cg_mode=mixed_mode,
num_tokens=num_tokens,
num_reqs=num_reqs,
num_active_loras=num_active_loras,
)
descs_by_mode[mixed_mode].append(desc)
@@ -379,19 +340,14 @@ class CudaGraphManager:
for mode in (CUDAGraphMode.FULL, CUDAGraphMode.PIECEWISE):
mode_descs = tuple(reversed(descs_by_mode.get(mode, [])))
for num_active_loras in self.lora_capture_cases:
lora_descs = [
d for d in mode_descs if d.num_active_loras == num_active_loras
]
current_range_start = 0
# Dynamic speculative decoding can produce multiple graphs with the same
# num_tokens. Group them so each graph covers the same candidate range.
for num_tokens, group in groupby(lora_descs, lambda d: d.num_tokens):
matching = list(group)
for i in range(current_range_start, num_tokens + 1):
key = (i, num_active_loras)
self._candidates.setdefault(key, []).extend(matching)
current_range_start = num_tokens + 1
current_range_start = 0
# Dynamic speculative decoding can produce multiple graphs with the same
# num_tokens. Group them so each graph covers the same candidate range.
for num_tokens, group in groupby(mode_descs, lambda d: d.num_tokens):
matching = list(group)
for i in range(current_range_start, num_tokens + 1):
self._candidates.setdefault(i, []).extend(matching)
current_range_start = num_tokens + 1
@property
def dp_size(self) -> int:
@@ -515,31 +471,25 @@ class CudaGraphManager:
self._graphs_captured = True
def captured_token_counts(self) -> list[int]:
"""Sorted token counts with a captured graph, ignoring LoRA variants."""
return sorted(
{desc.num_tokens for desc in self.graphs if desc.num_active_loras == 0}
)
"""Sorted token counts with a captured graph."""
return sorted({desc.num_tokens for desc in self.graphs})
def dispatch(
self,
num_reqs: int,
num_tokens: int,
uniform_token_count: int | None,
num_active_loras: int,
max_query_len: int | None = None,
num_ubatches: int = 1,
) -> BatchExecutionDescriptor:
"""Find matching cudagraph descriptor from priority-ordered candidates."""
effective_loras = self._resolve_effective_loras(num_active_loras)
key = (num_tokens, effective_loras)
if self._graphs_captured and num_tokens > 0 and key in self._candidates:
for desc in self._candidates[key]:
if self._graphs_captured and num_tokens > 0 and num_tokens in self._candidates:
for desc in self._candidates[num_tokens]:
if _is_compatible(
desc,
num_reqs,
num_tokens,
uniform_token_count,
effective_loras,
max_query_len,
num_ubatches,
):
@@ -548,7 +498,6 @@ class CudaGraphManager:
cg_mode=CUDAGraphMode.NONE,
num_tokens=num_tokens,
num_reqs=num_reqs,
num_active_loras=effective_loras,
num_ubatches=num_ubatches,
)
@@ -590,7 +539,6 @@ class ModelCudaGraphManager(CudaGraphManager):
device: torch.device,
cudagraph_mode: CUDAGraphMode,
decode_query_len: int,
lora_capture_cases: list[int] | None = None,
varlen_decode: bool = False,
ubatch_runner: "UBatchRunner | None" = None,
):
@@ -599,7 +547,6 @@ class ModelCudaGraphManager(CudaGraphManager):
device,
cudagraph_mode,
decode_query_len,
lora_capture_cases=lora_capture_cases,
varlen_decode=varlen_decode,
ubatch_runner=ubatch_runner,
)
@@ -618,9 +565,7 @@ class ModelCudaGraphManager(CudaGraphManager):
attn_groups: list[list[AttentionGroup]],
kv_cache_config: KVCacheConfig,
pcp_manager: "PCPManager | None" = None,
has_lora: bool = False,
use_aux_hidden_state_outputs: bool = False,
lora_capture_hook: Callable[[int, int, int], None] | None = None,
progress_bar_desc: str = "Capturing CUDA graphs",
) -> None:
"""Capture CUDA graphs for model forward pass."""
@@ -673,10 +618,6 @@ class ModelCudaGraphManager(CudaGraphManager):
num_tokens = desc.num_tokens
num_reqs = desc.num_reqs or min(num_tokens, self.max_num_reqs)
# Set LoRA state before capture so kernels see correct adapters.
if lora_capture_hook is not None:
lora_capture_hook(desc.num_active_loras, num_reqs, num_tokens)
num_tokens_across_dp = (
torch.full((self.dp_size,), num_tokens, dtype=torch.int32, device="cpu")
if self.dp_size > 1
@@ -752,11 +693,7 @@ class ModelCudaGraphManager(CudaGraphManager):
def forward_fn(cg_mode: CUDAGraphMode) -> None:
batch_descriptor = None
if cg_mode == CUDAGraphMode.PIECEWISE:
batch_descriptor = BatchDescriptor(
num_tokens=num_tokens,
has_lora=has_lora,
num_active_loras=desc.num_active_loras,
)
batch_descriptor = BatchDescriptor(num_tokens=num_tokens)
with set_forward_context(
attn_metadata,
self.vllm_config,
@@ -1091,6 +1028,5 @@ def _teardown_profiling_state(runner: "GPUModelRunner") -> None:
clear_layer_kv_caches(layers)
release_hisparse_profiling_cache(runner.compilation_config.static_forward_context)
runner.cache_config.num_gpu_blocks = None
runner.maybe_remove_all_loras(runner.lora_config)
gc.collect()
torch.accelerator.empty_cache()