Skip to content

vllm.distributed.eplb.eplb_communicator

EPLB communicator implementations and factory.

Classes:

Functions:

EplbCommunicator

Bases: ABC

Abstract EPLB communicator for expert weight transfers.

Methods:

Attributes:

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_buffer row 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 a NIXL-backed EPLB communicator.

Parameters:

  • cpu_group

    (ProcessGroup) –

    CPU process group for metadata exchange.

  • all_expert_weights

    (Sequence[Sequence[Tensor]]) –

    Expert weight tensors for all MoE layers.

  • expert_buffer

    (Sequence[Tensor]) –

    Pre-allocated receive buffer tensors.

_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

Bases: EplbCommunicator

EPLB communicator backed by PyNcclCommunicator using ncclSend/ncclRecv.

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

Bases: EplbCommunicator

EPLB communicator using gloo P2P with CPU staging.

TorchDistNcclEplbCommunicator

Bases: EplbCommunicator

EPLB communicator backed by torch.distributed isend/irecv.

TorchDistXCCLStagedEplbCommunicator

Bases: EplbCommunicator

EPLB communicator using XCCL device-to-device P2P on XPU.

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_mem ignores it and uses its own owned_expert_buffer.

has_nixl()

Whether the optional NIXL package is available.