vllm.distributed.kv_transfer.kv_connector.v1.moriio.moriio_common ¶
Classes:
-
HandshakeError–Exception raised when handshake fails.
-
LayerTransferPlan–Plan for transferring a single layer.
-
MoRIIOConnectorMetadata– -
MoRIIOConstants–Constants for MoRIIO connector.
-
MoRIIOError–Base exception for MoRIIO operations.
-
RemoteAllocInfo–Information about remote block allocation.
-
ReqMeta–Metadata for a single request.
-
RoleManager–Manages role state across the connector.
-
TransferError–Exception raised when transfer fails.
Functions:
-
fold_local_rank–Fold a global DP rank into its pod-local rank [0, dp_size_local).
-
get_peer_zmq_from_request_id–Extract the peer's zmq_address from the vLLM router request_id.
-
get_role–Get the global role.
-
parse_moriio_zmq_address–Parse the MoRI-IO zmq address into its components.
-
pod_index–Pod index (0-based) a global DP rank lives on for Wide-EP multi-pod.
-
resolve_host_ip–The IP this MoRIIO process advertises for KV transfer.
-
set_role–Set the global role.
-
zmq_ctx–Context manager for a ZMQ socket
HandshakeError ¶
Bases: MoRIIOError
Exception raised when handshake fails.
LayerTransferPlan dataclass ¶
Plan for transferring a single layer.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
MoRIIOConnectorMetadata ¶
Bases: KVConnectorMetadata
Methods:
-
add_new_req–Ingest a peer's
kv_transfer_paramsinto a typedReqMeta.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | |
add_new_req(request_id, local_block_ids, kv_transfer_params, write_mode=False) ¶
Ingest a peer's kv_transfer_params into a typed ReqMeta.
This is the single place peer info enters the connector. The kv_transfer_params contract (as produced by the llm-d sidecar / vLLM router, or echoed by the prefill leg's request_finished):
Required (always): * transfer_id -- stable id shared by both legs. * remote_engine_id -- peer engine id for the handshake table. * remote_block_ids -- peer block ids (may be [] in WRITE mode, where decode allocates its own blocks).
Peer address -- ONE of the following two must resolve
- embedded in
request_id(vLLM-router PD id form), OR - explicit
remote_host+remote_handshake_port+remote_notify_port(llm-d sidecar / returnable path). If neither resolves we raise -- there is no safe default host/port.
Optional (defaulted): * tp_size (default 1) -- peer TP size. * remote_dp_size (default 1) -- peer GLOBAL DP size. * remote_dp_size_local (default = remote_dp_size) -- per-pod DP size for Wide-EP multi-pod port/host folding; 0/absent means single-pod. * remote_hosts (default [remote_host]) -- per-pod IP list indexed by pod_idx = rank // dp_local.
Routing keys consumed elsewhere (NOT here): remote_dp_rank / remote_dp_rank_override gate the decode->prefill notify target in MoRIIOConnectorScheduler; they are router-authoritative and never self-derived (see that class's request routing contract).
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | |
MoRIIOConstants ¶
Constants for MoRIIO connector.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
MoRIIOError ¶
RemoteAllocInfo dataclass ¶
Information about remote block allocation.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
ReqMeta dataclass ¶
Metadata for a single request.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
RoleManager ¶
Manages role state across the connector.
Methods:
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
get_role() ¶
TransferError ¶
Bases: MoRIIOError
Exception raised when transfer fails.
fold_local_rank(global_dp_rank, dp_size_local) ¶
Fold a global DP rank into its pod-local rank [0, dp_size_local).
dp_size_local == 0 is the external-DP sentinel (local size unknown): return the rank unchanged, since a global DP rank is always < the global DP size so no folding is needed and the modulo is skipped (never divides by zero).
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
get_peer_zmq_from_request_id(request_id, is_producer) ¶
Extract the peer's zmq_address from the vLLM router request_id.
The producer (prefill) needs the decode's address; the consumer (decode) needs the prefill's address.
Returns None when the request_id does not encode peer info. The llm-d routing sidecar (llm-d-inference-scheduler) does not embed addresses in request_id; instead it passes remote_host, remote_handshake_port and remote_notify_port explicitly in kv_transfer_params. Callers must handle the None return by falling back to those fields. See add_new_req for the canonical fallback path.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
get_role() ¶
parse_moriio_zmq_address(zmq_address) ¶
Parse the MoRI-IO zmq address into its components.
Parses "host:IP,handshake:PORT,notify:PORT" into (host, handshake_port, notify_port).
Each key-value pair is split on the first colon so that IPv6 addresses (e.g. host:::1) are handled correctly. Raises ValueError if any of host, handshake, or notify keys are absent or if the port values are non-numeric.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
pod_index(global_dp_rank, dp_size_local) ¶
Pod index (0-based) a global DP rank lives on for Wide-EP multi-pod.
dp_size_local == 0 (external-DP sentinel) collapses to a single pod.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
resolve_host_ip(extra_config) ¶
The IP this MoRIIO process advertises for KV transfer.
Honors an explicit host_ip in kv_connector_extra_config before falling back to get_ip(). An external router/orchestrator can set it to the node's routable address; this is required under frameworks (e.g. Ray) where get_ip() resolves to an unroutable public IP and VLLM_HOST_IP cannot be propagated to the worker processes that bind the transfer engine.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
set_role(role) ¶
zmq_ctx(socket_type, addr) ¶
Context manager for a ZMQ socket