This document is relevant for: Trn2, Trn3
nki.collectives.all_to_all_v_prepare#
- nki.collectives.all_to_all_v_prepare(srcs: List, dsts: List, replica_group: ReplicaGroup, metadata_tensor, recv_counts_known: bool = False, has_rdispls: bool = False, priority: Optional[int] = None, name: Optional[str] = None) NkiInstruction[source]#
Begin a split
all_to_all_v().A plain
all_to_all_v()couples its metadata setup with the execution of the a2a-v collective, so the setup cannot start until the instruction that fillssrcshas completed. Splitting it intoprepare+triggerlets the setup run ahead and overlap with unrelated compute, hiding its latency. This helps when the per-rank counts are known before the data is — e.g. in MoE, wheresend_countsfollow the router/top-k whilesrcsare only filled after a reshuffle.preparereadsmetadata_tensor, which must already hold valid data. It does not read the contents ofsrcs/dsts, so it may be issued before they are filled.Each prepare must be followed by exactly one
all_to_all_v_trigger(), with no other prepare in between. Prepares share a single slot, so an intervening prepare of any kind is rejected.All arguments match
all_to_all_v(); see it for their meaning. The trigger reuses them from this call, soall_to_all_v_trigger()takes only the instruction this call returns.Current restrictions:
NeuronSwitch-based instances (the Trn3 Ultraserver) do not currently support the prepare/trigger split. Use plain
all_to_all_v()on those instance types.- Returns:
The
NkiInstructionto pass to the pairedall_to_all_v_trigger().
This document is relevant for: Trn2, Trn3