vllm.distributed.kv_transfer.kv_connector.v1.nixl.tp_mapping
¶
TP mapping computation for NIXL KV cache transfers.
Classes:
-
ReadSpec–Specification for a single remote block read operation.
-
TPMapping–Complete local-to-remote TP mapping for one remote engine.
Functions:
-
compute_head_offset–Return the offset in local head slices within the remote KV block.
-
compute_tp_mapping–Build the complete local-to-remote TP mapping.
ReadSpec
dataclass
¶
Specification for a single remote block read operation.
TPMapping
dataclass
¶
Complete local-to-remote TP mapping for one remote engine.
Generated once per remote engine during handshake.
compute_head_offset(tp_rank, tp_size, remote_tp_size, total_num_kv_heads)
¶
Return the offset in local head slices within the remote KV block.
compute_tp_mapping(transfer_topology, remote_tp_size, group_spec_types, remote_dcp_size=1, head_sharded_kv_heads=None)
¶
Build the complete local-to-remote TP mapping.
Computes source ranks, head slot assignments, and the rank offset factor in a single pass.
DCP support is scoped to MLA only, with a side is either fully replicated or fully sharded. DCP-branch reuses the same rank set used at handshake selection.
head_sharded_kv_heads maps head-sharded KV with that many total KV heads
instead of the topology's, e.g. a GQA draft under an MLA target.