Skip to content

vllm.config.kv_transfer

Classes:

  • KVCacheAccess –

    How a KV connector accesses the device KV cache, as flags of what it

  • KVTransferConfig –

    Configuration for distributed KV cache transfer.

KVCacheAccess

Bases: IntFlag

How a KV connector accesses the device KV cache, as flags of what it requires from the allocation; MultiConnector combines its children's.

Methods:

Attributes:

  • EXPORTS_FABRIC –

    Another process on the host imports it through FABRIC handles (UCX

  • EXPORTS_FD –

    Another process imports it through POSIX file descriptors, or FABRIC

  • IN_PROCESS –

    In-process only (torch ops, copy kernels): any allocation works.

  • LEGACY_IPC –

    Shares it through legacy CUDA IPC: the extensible KV cache is unsupported.

  • REGISTERS –

    Registers it with UCX or RDMA: one physical allocation per segment.

EXPORTS_FABRIC = enum.auto() class-attribute instance-attribute

Another process on the host imports it through FABRIC handles (UCX cuda_ipc): one physical allocation per segment, and an IMEX channel.

EXPORTS_FD = enum.auto() class-attribute instance-attribute

Another process imports it through POSIX file descriptors, or FABRIC handles alongside EXPORTS_FABRIC: the extensible KV cache, exportable, with one physical allocation per segment.

IN_PROCESS = 0 class-attribute instance-attribute

In-process only (torch ops, copy kernels): any allocation works.

LEGACY_IPC = enum.auto() class-attribute instance-attribute

Shares it through legacy CUDA IPC: the extensible KV cache is unsupported.

REGISTERS = enum.auto() class-attribute instance-attribute

Registers it with UCX or RDMA: one physical allocation per segment.

needs_single_chunk()

Whether each segment must be backed by one physical allocation.

KVTransferConfig

Configuration for distributed KV cache transfer.

Methods:

Attributes:

enable_permute_local_kv = False class-attribute instance-attribute

Experiment feature flag to enable HND to NHD KV Transfer

engine_id = None class-attribute instance-attribute

The engine id for KV transfers.

kv_buffer_device = field(default_factory=kv_buffer_device_default_factory) class-attribute instance-attribute

The device used by kv connector to buffer the KV cache. Choices are 'cuda', 'cpu' and 'xpu'.

kv_connector = None class-attribute instance-attribute

The KV connector for vLLM to transmit KV caches between vLLM instances.

kv_connector_extra_config = field(default_factory=dict) class-attribute instance-attribute

any extra config that the connector may need.

kv_connector_module_path = None class-attribute instance-attribute

The Python module path to dynamically load the KV connector from. Only supported in V1.

kv_load_failure_policy = 'fail' class-attribute instance-attribute

Policy for handling KV cache load failures. 'recompute': reschedule the request to recompute failed blocks 'fail': immediately fail the request with an error finish reason (default)

kv_port = 14579 class-attribute instance-attribute

The KV connector port, used to build distributed connection.

kv_role = None class-attribute instance-attribute

Whether this vLLM instance produces, consumes KV cache, or both. Choices are 'kv_producer', 'kv_consumer', and 'kv_both'. With MultiConnector, the roles of its connectors decide this instead.

_connector_roles()

The kv_role of each connector. MultiConnector does not pass its own kv_role to its connectors, so only theirs count.

compile_factors()

This config does not affect the compiled graph.

If a field starts affecting it, return get_compile_factors(self, ignored_factors) with every other field in ignored_factors.

has_connector(connector_name)

Whether connector_name is configured, directly or in MultiConnector.

kv_cache_access()

How the configured connectors reach the device KV cache, directly or in MultiConnector. Imports the connector class to ask it, through KVConnectorBase_V1.kv_cache_access.

registers_kv_cache_memory()

Whether a connector registers the device KV cache with UCX or RDMA, or another process imports it, directly or in MultiConnector: each segment must then be backed by one physical allocation.

uses_custom_mem_pool()

Whether a connector allocates the KV cache from its own memory pool (custom_mem_pool), directly or in MultiConnector.