Skip to content

vllm.distributed.kv_transfer.kv_connector.v1.multi_connector

Classes:

MultiConnector

Bases: KVConnectorBase_V1, SupportsHMA

A wrapper for using multiple KVConnectors at the same time.

The current logic is: - Load KV from the first connector that advertises available tokens from get_num_new_matched_tokens(), based on the order in the config. - Save to all connectors.

Methods:

_sub_connector_handshake_metadata(metadata, index)

Return the entries of metadata that sub-connector index reported.

If a subclass overrides get_handshake_metadata to report a single sub-connector's metadata (e.g. Dynamo's PdConnector), every sub-connector receives metadata unchanged.

all_children_support_hma(kv_transfer_config) classmethod

Return True only if every configured child connector supports HMA.

get_handshake_metadata()

Collect every sub-connector's handshake metadata, so that the scheduler side can give each one only its own.

get_mem_pool_context()

Forward a custom KV cache memory pool from a child connector.

KV cache is allocated once and can only live in one pool, so at most one child may provide a context.

get_required_kvcache_layout(vllm_config) classmethod

Get the required KV cache layout for this connector.

Parameters:

Returns:

  • str ( str | None ) –

    the required KV cache layout. e.g. HND, or NHD.

  • str | None –

    None if the connector does not require a specific layout.

handle_preemptions(kv_connector_metadata)

Handle preempted requests for all sub-connectors.

requires_piecewise_for_cudagraph(extra_config) classmethod

MultiConnector requires PIECEWISE CUDA graph mode if any of its child connectors require it.

set_host_xfer_buffer_ops(copy_operation)

Set xPU-specific copy ops for all sub-connectors.

MultiKVConnectorHandshakeMetadata dataclass

Bases: KVConnectorHandshakeMetadata

One worker's handshake metadata, an entry per sub-connector.

MultiKVConnectorStats dataclass

Bases: KVConnectorStats

Maintain a dict of KVConnectorStats objects, one for each connector. This is used to aggregate the stats from all connectors separately.