vllm.distributed.eplb.eplb_communicator
¶
EPLB communicator implementations and factory.
Classes:
-
EplbCommunicator–Abstract EPLB communicator for expert weight transfers.
-
NixlEplbCommunicator–EPLB communicator backed by NIXL READ transfers.
-
PyNcclEplbCommunicator–EPLB communicator backed by PyNcclCommunicator using ncclSend/ncclRecv.
-
SymmMemEplbCommunicator–Push expert rows into peers' receive buffers over symmetric memory.
-
TorchDistGlooStagedEplbCommunicator–EPLB communicator using gloo P2P with CPU staging.
-
TorchDistNcclEplbCommunicator–EPLB communicator backed by torch.distributed isend/irecv.
-
TorchDistXCCLStagedEplbCommunicator–EPLB communicator using XCCL device-to-device P2P on XPU.
Functions:
-
create_eplb_communicator–Create an EPLB communicator for the given backend.
-
has_nixl–Whether the optional NIXL package is available.
EplbCommunicator
¶
Bases: ABC
Abstract EPLB communicator for expert weight transfers.
Methods:
-
execute–Complete all enqueued transfers.
-
set_transfer_context–Pre-set layer context before add_send/add_recv calls.
Attributes:
-
needs_profile_buffer_reservation(bool) –Whether the profile path must run a dummy collective operation to reserve
-
needs_recv_rows(bool) –Whether set_transfer_context must be given every rank's recv rows.
-
owned_expert_buffer(list[Tensor] | None) –Backend-allocated receive buffer, or
Noneto use the caller's.
needs_profile_buffer_reservation
property
¶
Whether the profile path must run a dummy collective operation to reserve communication buffers.
needs_recv_rows
property
¶
Whether set_transfer_context must be given every rank's recv rows.
owned_expert_buffer
property
¶
Backend-allocated receive buffer, or None to use the caller's.
execute()
abstractmethod
¶
Complete all enqueued transfers.
Some backends perform communication here; others (e.g. NIXL) issue transfers eagerly in add_recv and only wait here. On return, all data is available in the destination buffers.
set_transfer_context(old_indices, layer_idx, recv_rows=None)
¶
Pre-set layer context before add_send/add_recv calls.
Default is a no-op; overridden by backends (e.g. NIXL) that need layer-level context to issue transfers inside add_recv.
Parameters:
-
(old_indices¶ndarray) –Global physical-to-logical map before the move.
-
(layer_idx¶int) –Index of the MoE layer being transferred.
-
(recv_rows¶Sequence[dict[int, int]] | None, default:None) –Per EP rank, the
expert_bufferrow each expert received by that rank lands in. Only push backends need it.
NixlEplbCommunicator
¶
Bases: EplbCommunicator
EPLB communicator backed by NIXL READ transfers.
Methods:
-
__init__–Create a NIXL-backed EPLB communicator.
__init__(cpu_group, all_expert_weights, expert_buffer)
¶
_create_peer_xfer(src, local_descs, remote_descs)
¶
Create a batched xfer for multiple descriptors from one peer.
Each element in local_descs / remote_descs is an
(address, size, device_id) tuple.
Returns (local_dlist, remote_dlist, xfer_handle).
_exchange_remote_send_meta()
¶
Exchange per-layer per-tensor metadata so receivers can compute remote RDMA addresses at transfer time.
_init_remote_state()
¶
Exchange NIXL agent metadata and RDMA pointer info with all peers.
This is a collective operation (uses all_gather_object twice).
_make_agent_name()
¶
Build a deployment-unique nixl agent name.
_post_read_barrier()
¶
Correctness fence: prevents overwrite-while-remote-read race.
We avoid torch.distributed.monitored_barrier because it
calls get_backend(group) which fails for stateless groups
(elastic EP). An async all_reduce + wait(timeout)
works with both regular and stateless groups and provides
equivalent timeout detection.
PyNcclEplbCommunicator
¶
SymmMemEplbCommunicator
¶
Bases: EplbCommunicator
Push expert rows into peers' receive buffers over symmetric memory.
Senders copy from their live weights into the receiver's expert_buffer
row, which every rank derives from the global placements; execute is
collective. CPU barriers only: GPU spin barriers can deadlock MegaMoE
cooperative launches.
TorchDistGlooStagedEplbCommunicator
¶
TorchDistNcclEplbCommunicator
¶
TorchDistXCCLStagedEplbCommunicator
¶
create_eplb_communicator(group_coordinator, backend, expert_weights, expert_buffer)
¶
Create an EPLB communicator for the given backend.
Parameters:
-
(group_coordinator¶GroupCoordinator) –Process-group coordinator that provides the device and CPU communication groups.
-
(backend¶str) –Communicator backend name (
"torch_nccl","torch_gloo","pynccl","nixl", or"symm_mem"). Falls back to"torch_nccl"when None. Stateless (elastic EP) groups support"torch_nccl","pynccl", and"nixl";"torch_nccl"is silently promoted to"pynccl". When tensors reside on CPU,"torch_gloo"or"torch_nccl"are used via the CPU process group. -
(expert_weights¶Sequence[Sequence[Tensor]]) –Expert weight tensors for all MoE layers. Shape
(num_layers)(num_tensors_per_layer). NixlEplbCommunicator registers all layers with NIXL for zero-copy RDMA reads. -
(expert_buffer¶Sequence[Tensor] | None) –Pre-allocated receive buffer tensors (one per weight tensor in a single layer).
symm_memignores it and uses its ownowned_expert_buffer.
has_nixl()
¶
Whether the optional NIXL package is available.