vllm.distributed.device_communicators.base_device_communicator
¶
Classes:
-
All2AllManagerBase– -
DeviceCommunicatorBase–Base class for device-specific communicator.
All2AllManagerBase
¶
Methods:
-
clean_buffers–Reset this rank's RDMA buffers and all2all mask state (rank-local).
-
query_active_mask–Return the all2all liveness mask for the EP ranks.
-
query_fault–Return a scalar bool tensor, True if a new fault appeared.
-
update_mask–Set the mask for a specific EP rank. Used during scale-down.
clean_buffers()
¶
Reset this rank's RDMA buffers and all2all mask state (rank-local).
Post-fault cleanup: a dispatch/combine that hit a dead peer or timed out can leave partially-written or stale tokens in the RDMA receive buffer, so it is zeroed to stop the next forward from reading that contaminated data.
query_active_mask()
¶
query_fault()
¶
Return a scalar bool tensor, True if a new fault appeared.
Compares the current mask against the baseline recorded at the last recovery point.
update_mask(rank, masked=True)
¶
Set the mask for a specific EP rank. Used during scale-down.
DeviceCommunicatorBase
¶
Base class for device-specific communicator.
It can use the cpu_group to initialize the communicator.
If the device has PyTorch integration (PyTorch can recognize its
communication backend), the device_group will also be given.
Methods:
-
all_to_all_single–All-to-all over dim 0, split evenly across ranks if sizes are None.
-
broadcast–Broadcast a tensor from source rank to all ranks.
-
checkpoint_prepare–Prepare reclaimable communicator state for checkpoint (default: no-op).
-
checkpoint_restore–Restore communicator state after checkpoint (default: no-op).
-
combine–Combine the hidden states and router logits from the appropriate device.
-
dispatch–Dispatch the hidden states and topk weights/ids to the appropriate device.
-
dispatch_router_logits–Dispatch the hidden states and router logits to the appropriate device.
-
gather–NOTE: We assume that the input tensor is on the same device across
-
recv–Receives a tensor from the source rank.
-
resume–Restore memory released by
suspend(default: no-op). -
send–Sends a tensor to the destination rank in a blocking way.
-
suspend–Release reclaimable communicator memory (default: no-op).
Attributes:
-
supports_sharded_sequential_sampling(bool) –Whether TP can exchange vocab shards and gather sequential drafts.
supports_sharded_sequential_sampling
property
¶
Whether TP can exchange vocab shards and gather sequential drafts.
all_to_all_single(input_, output_split_sizes=None, input_split_sizes=None)
¶
All-to-all over dim 0, split evenly across ranks if sizes are None.
broadcast(tensor, src=0)
¶
Broadcast a tensor from source rank to all ranks.
checkpoint_prepare()
¶
Prepare reclaimable communicator state for checkpoint (default: no-op).
checkpoint_restore()
¶
Restore communicator state after checkpoint (default: no-op).
combine(hidden_states, is_sequence_parallel=False)
¶
Combine the hidden states and router logits from the appropriate device. This is a no-op in the base class.
dispatch(hidden_states, topk_weights, topk_ids, is_sequence_parallel=False, extra_tensors=None)
¶
Dispatch the hidden states and topk weights/ids to the appropriate device. This is a no-op in the base class.
dispatch_router_logits(hidden_states, router_logits, is_sequence_parallel=False, extra_tensors=None)
¶
Dispatch the hidden states and router logits to the appropriate device. This is a no-op in the base class.
gather(input_, dst=0, dim=-1)
¶
NOTE: We assume that the input tensor is on the same device across
all the ranks.
NOTE: dst is the local rank of the destination rank.
recv(size, dtype, src=None)
¶
Receives a tensor from the source rank.
resume()
¶
Restore memory released by suspend (default: no-op).
send(tensor, dst=None)
¶
Sends a tensor to the destination rank in a blocking way.
suspend()
¶
Release reclaimable communicator memory (default: no-op).