In this article
Reduce-scatter and all-gather expose where reduced shards are owned; the next consumer determines whether reconstructing the full tensor is necessary.
An all-reduce can be understood as a reduce-scatter followed by an all-gather. The first operation combines values while distributing ownership of reduced portions; the second makes those portions available everywhere. This decomposition is useful for reasoning about sharded algorithms because some consumers need only a reduced shard and can avoid gathering the complete tensor immediately.
Reduce-scatter combines and partitions
Each rank contributes input values to a reduction, but receives only its designated reduced portion. The operation therefore changes both values and ownership layout. It is not equivalent to cutting each original input into pieces without combining corresponding contributions. Draw symbolic elements from every rank and show which contributions form each output element. This makes the reduction semantics visible before discussing transport or memory savings.
Primary reference: NCCL User Guide: Collective Operations.
All-gather reconstructs an ordered collection
All-gather distributes each rank’s contributed portion so all participants receive the combined collection in the specified rank order. It does not perform another arithmetic reduction. When its inputs are the reduced portions from reduce-scatter, the result has the all-reduce meaning. Matching shard sizes, data types, and ordering assumptions is essential. A tensor with correct values in the wrong rank order can still break the next computational stage.
Primary reference: CUDA Programming Guide: Asynchronous Execution.
A local consumer may not need the full result
Suppose the next operation uses only the shard owned by its rank. Performing all-gather immediately may create unnecessary replication and transport. Keeping the reduced shard can be valid if every later dependency respects that layout. This is an algorithmic decision, not a free substitution for any all-reduce call. Trace the next consumers and their required coordinates before removing a collective phase from a working implementation.
Primary reference: CUDA C++ Best Practices Guide.
Memory lifetime follows the representation
An implementation may need temporary input, reduced shards, and gathered output at different moments. Reducing replication can lower live storage, but overlap can keep several representations alive concurrently. Count peak live allocations rather than simply comparing final tensor sizes. Ensure that an input buffer is not recycled while a collective still uses it. In-place operations have documented layout constraints that should be checked separately from an out-of-place conceptual diagram.
Validate the decomposition end to end
Compare the composed operations with a reference all-reduce using matching participants and an appropriate floating-point tolerance. Verify shard ownership explicitly with distinguishable values. Measure communication and subsequent computation together when evaluating a delayed gather. The improvement may come from eliminating replication, scheduling a gather later, or overlapping independent work. A report should say which mechanism changed rather than attributing every gain to a collective operation’s name.
Related reading: A GPU inference benchmark you can trust; Reproducible inference stacks: preserving a GPU pilot’s result.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.