Skip to content

vllm.distributed.weight_transfer.ipc_engine

IPC-based weight transfer engine using CUDA IPC for communication.

Classes:

IPCTrainerInitInfo dataclass

Bases: TrainerInitInfo

Trainer-side init info for IPC weight transfer. Rank 0 ships the merged IPC handles and the chunk size with the first chunk.

IPCTrainerWeightTransferEngine

Bases: TrainerWeightTransferEngine[IPCTrainerInitInfo]

Trainer-side CUDA IPC weight transfer engine.

Called on every trainer rank. For multi-rank (e.g. FSDP) trainers all ranks drive the source's iter_full() (materializing each tensor) and contribute to the IPC-handle all-gather, so every rank must own every parameter; only the sender (rank 0) ships the merged handles to the inference side. IPC transfer is straight-line (no concurrent broadcast like NCCL): update_weights is the transfer, and it rides the client, so it no-ops on non-senders.

packed / packed_buffer_size_bytes come from IPCTrainerInitInfo; the sender propagates packed to the worker at trainer_init.

_all_gather_and_merge_handles(handles)

Merge each index's {gpu_uuid: ipc_args} dicts across the trainer ranks (the default group) on the sender; no-op without a group.

_barrier() staticmethod

Barrier over the trainer ranks; no-op if single-GPU.

_do_send(names, dtype_names, shapes, ipc_handles, chunk_capacity=None, last=False)

Build one update payload and ship it via the client. Only the sender ships (non-sender ranks already contributed to the handle all-gather).

Emits raw ipc_handles; transports that cannot carry them natively (HTTP/JSON) pickle them in their client (see HTTPVLLMWeightSyncClient).

_post_send_sync() classmethod

Barrier + ipc_collect after a send.

_send_packed(source)

Send weights in chunks of one IPC buffer, between barriers so no rank refills its buffer before the workers read it.

_send_unpacked(source)

Iterate the source, build one IPC handle per param, all-gather the handles across ranks, and (sender) ship them in one update call.

Returns the strong refs to every contiguous copy. reduce_tensor's args do NOT keep storage alive, and non-contiguous inputs allocate fresh storage in .contiguous(); the caller must keep these alive until the post-send barrier (past finish) so the consumer's IPC views stay valid.

IPCWeightTransferEngine

Bases: WeightTransferEngine[IPCWeightTransferInitInfo, IPCWeightTransferUpdateInfo]

Weight transfer engine using CUDA IPC between trainer and workers.

This implementation uses CUDA IPC to transfer weights from the trainer (rank 0) to all inference workers in a process group. IPC handles are used to share memory between processes on the same node.

Methods:

_local_gpu()

This worker's GPU UUID and device index, for rebuilding handles.

finish_weight_update()

Finish reloading after all weights have been received.

init_transfer_engine(init_info)

Initialize the weight transfer mechanism. No data-plane rendezvous is needed for IPC; this just records the trainer-supplied wire params so the worker decodes exactly as the trainer encoded.

Parameters:

receive_weights(update_info)

Receive weights from the trainer via CUDA IPC handles and load them.

Whether the transfer is packed is read from self.packed, set at the init handshake from the trainer's init info, so it is guaranteed to match how the trainer encoded.

Parameters:

  • update_info

    (IPCWeightTransferUpdateInfo) –

    IPC update info containing parameter names, dtypes, shapes, and IPC handles. Each IPC handle is a mapping between physical GPU UUID and the rebuild_cuda_tensor args tuple.

start_weight_update()

Begin reloading the incoming checkpoint weights.

IPCWeightTransferInitInfo dataclass

Bases: WeightTransferInitInfo

Worker-side init info for IPC weight transfer; the trainer ships packed here at the handshake.

IPCWeightTransferUpdateInfo dataclass

Bases: WeightTransferUpdateInfo

Per-round update info for the IPC weight transfer backend.

Attributes:

chunk_capacity = None class-attribute instance-attribute

Packed mode: the chunk size in bytes, set on the first chunk.

ipc_handles = None class-attribute instance-attribute

IPC handles mapping physical GPU UUID to rebuild_cuda_tensor args. For non-packed mode: list of per-parameter handle dicts. For packed mode: the packed buffer's handle dict in the first chunk of a transfer with bytes, else empty.

ipc_handles_pickled = None class-attribute instance-attribute

Base64-encoded pickled IPC handles, used for HTTP transport.

last = False class-attribute instance-attribute

Packed mode: whether this chunk ends the transfer.

names instance-attribute

Packed mode: the tensors that start in this chunk (PackedIpcChunk).