vllm.distributed.kv_transfer.kv_connector.v1.moriio.moriio_common
¶
Classes:
-
HandshakeError–Exception raised when handshake fails.
-
LayerTransferPlan–Plan for transferring a single layer.
-
MoRIIOConfig– -
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.
-
TransferBatchState–Verdict for a group of transfer statuses that belong to one request.
-
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
MoRIIOConfig
dataclass
¶
Methods:
-
later_stage_notify_ports–Notify ports of this worker's counterparts in the later pipeline
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
later_stage_notify_ports()
¶
Notify ports of this worker's counterparts in the later pipeline stages, to which the first stage forwards the decode's messages.
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
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
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
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
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()
¶
TransferBatchState
¶
Bases: Enum
Verdict for a group of transfer statuses that belong to one request.
A request's KV transfer is spread over one status per layer (two for a KDA layer), so a single status never decides the request: PENDING means at least one is still in flight and none has failed, FAILED means at least one failed, DONE means all succeeded.
Source code in vllm/distributed/kv_transfer/kv_connector/v1/moriio/moriio_common.py
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.