[NVIDIA TF] CollectiveAllToAllV2 + NCCL all-to-all fixes #60001
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a few small bugs with
CollectiveAllToAllV2and NCCL all-to-all:CollectiveAllToAllV2. We could potentially keepforward_input_or_allocate_outputand allocate a temporary buffer inside the NCCL backend only when the input is reused. This would allow other backends to still perform an in-place all-to-all. It looks like the ring algorithm uses temporary output buffers anyway.ncclSendandncclRecvto follow the mapping by usingglobal_rank. The TF runtime can sometimes reorder the GPUs to optimize the ring algorithms. While this PR fixes nccl all-to-all to follow the ordering, the ring algorithm is also affected and gives incorrect results.nccl_manager.ccwould cause a crash due to interpretting the data buffer as a string.