A symbol scan over every tracked file found 123 top-level definitions in vllm/ with zero references, including references inside strings. All of them came from features this fork deleted earlier. - Delete dead attention helpers: MLADCPManager, split_prefill_chunks, the reshape helpers, compute_varlen_chunk_metadata, the LINEAR backend's unused BailingLinearAttentionBackend, and the sparse flash-attn entry points. - Delete the CPU and AMX op wrappers from _custom_ops.py: cpu_mla_decode, cpu_mla_extend, cpu_mla_get_scheduler_metadata, gather_mla_context_cache_cpu. - Delete dead quantization helpers: awq_pack, gptq_pack, gptq_quantize_weights, get_and_maybe_dequant_weights, marlin_quant_fp8_torch, the rand_marlin_weight_*_like pair, ocp_mx_weight_dtype_and_rows, get_fp8_block_weight_scale, input_to_float8. - Delete dead model helpers: resolve_visual_encoder_outputs, run_dp_sharded_vision_model, fast_topk, get_layer_index, is_pp_missing_parameter, skip_spec_layers, KimiK3MergedQKVGateLinear, selective_scan_fn, causal_conv1d_update_torch. - Delete dead utils: format_kib, format_mib, chunk_list, prev_power_of_2, split_host_port, join_host_port, make_zmq_path, make_async_with_semaphore, is_meta_module, is_non_overlapping_and_dense, supports_xpu_graph, create_kv_caches_with_random*, and the unused has_* capability probes. - Delete the unreachable deep-gemm mega-MoE warmup path, which imported vllm.models.deepseek_v4.nvidia.model and vllm.models.kimi_k3.nvidia.model, neither of which exists anymore. - Drop the imports and the two now-empty guards left behind. Verified statically: every changed file compiles, no unused import remains, and no deleted name is referenced in vllm, tests or csrc. The runtime gates still need the Python environment rebuilt. Co-authored-by: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
105 lines
3.5 KiB
Python
105 lines
3.5 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
"""EC connector helper utilities."""
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
|
|
from vllm.logger import init_logger
|
|
from vllm.v1.outputs import ECConnectorOutput, ModelRunnerOutput
|
|
|
|
if TYPE_CHECKING:
|
|
from vllm.config import ModelConfig
|
|
|
|
logger = init_logger(__name__)
|
|
|
|
|
|
class PlaceholderMetadataResolver:
|
|
"""Resolves which processed keys a model needs published per modality.
|
|
|
|
Reads `MultiModalDataParser.embedding_fields`, the same declaration the
|
|
consumer's parser requires, so the two cannot drift. An empty set means
|
|
the modality cannot be delivered out of band, and the consumer will
|
|
process the media itself.
|
|
"""
|
|
|
|
def __init__(self, model_config: "ModelConfig") -> None:
|
|
self._model_config = model_config
|
|
self._cache: dict[str, set[str]] = {}
|
|
|
|
def fields_for(self, modality: str) -> set[str]:
|
|
if modality in self._cache:
|
|
return self._cache[modality]
|
|
|
|
fields: set[str] = set()
|
|
try:
|
|
from vllm.multimodal import MULTIMODAL_REGISTRY
|
|
|
|
info = MULTIMODAL_REGISTRY.create_processor(self._model_config).info
|
|
fields = info.data_parser.placeholder_metadata_fields(modality)
|
|
except Exception:
|
|
logger.warning(
|
|
"Could not determine the placeholder metadata fields for "
|
|
"modality %s; the consumer will preprocess the media itself.",
|
|
modality,
|
|
exc_info=True,
|
|
)
|
|
|
|
self._cache[modality] = fields
|
|
return fields
|
|
|
|
|
|
class ECOutputAggregator:
|
|
"""Merge every worker's EC connector output onto the single
|
|
ModelRunnerOutput that reaches the scheduler.
|
|
|
|
Mirrors KVOutputAggregator: only `output_rank`'s output is returned to the
|
|
scheduler, but the EC connector may have run on any rank.
|
|
"""
|
|
|
|
def aggregate(
|
|
self, outputs: list[ModelRunnerOutput | None], output_rank: int = 0
|
|
) -> ModelRunnerOutput | None:
|
|
output = outputs[output_rank]
|
|
if not output:
|
|
return None
|
|
|
|
finished_sending = set[str]()
|
|
finished_recving = set[str]()
|
|
worker_meta = None
|
|
connector_stats = None
|
|
for model_runner_output in outputs:
|
|
assert model_runner_output is not None
|
|
ec_output = model_runner_output.ec_connector_output
|
|
if not ec_output:
|
|
continue
|
|
|
|
finished_sending |= ec_output.finished_sending or set()
|
|
finished_recving |= ec_output.finished_recving or set()
|
|
|
|
if meta := ec_output.ec_connector_worker_meta:
|
|
worker_meta = (
|
|
meta if worker_meta is None else worker_meta.aggregate(meta)
|
|
)
|
|
|
|
if stats := ec_output.ec_connector_stats:
|
|
connector_stats = (
|
|
stats
|
|
if connector_stats is None
|
|
else connector_stats.aggregate(stats)
|
|
)
|
|
|
|
aggregated = ECConnectorOutput(
|
|
finished_sending=finished_sending or None,
|
|
finished_recving=finished_recving or None,
|
|
ec_connector_stats=connector_stats,
|
|
ec_connector_worker_meta=worker_meta,
|
|
)
|
|
if aggregated.is_empty():
|
|
output.ec_connector_output = None
|
|
return output
|
|
|
|
# `output` is the shared empty output whenever `output_rank` had no work,
|
|
# so attach through the copy-on-write helper.
|
|
return ModelRunnerOutput.with_ec_conn_output(output, aggregated)
|