Skip to content

feat(nccl): add all-gather communication - #59

Draft
voltjia wants to merge 1 commit into
feat/nccl-point-to-pointfrom
feat/nccl-all-gather
Draft

feat(nccl): add all-gather communication#59
voltjia wants to merge 1 commit into
feat/nccl-point-to-pointfrom
feat/nccl-all-gather

Conversation

@voltjia

@voltjia voltjia commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Implement the existing infinicclAllGather API for the NCCL backend, including communicator-aware backend selection, zero-count handling, and reliable NVIDIA and mixed-backend validation.

This PR is stacked on #58, which provides the shared supported-backend selection used by collective and point-to-point operations. #58 is stacked on #57, which keeps generated communication bridges current when provider headers change.

Changes

  • NCCL AllGather
    • Map the generic AllGather operation directly to ncclAllGather while preserving NCCL's per-rank count and legal in-place buffer contract.
    • Register the NCCL provider and validate the communicator backend, device, and handle before dispatch.
  • Backend selection
    • Reuse communicator-aware selection to fall back to a supported intra-node or inter-node backend without dispatching unsupported combinations.
    • Return success for zero-count operations, infinicclNotSupported when the communicator has no compatible provider, and an internal error when it has no initialized backend.
  • Validation
    • Add a two-GPU example covering out-of-place and NCCL-defined in-place AllGather with element-wise result validation.
    • Extend the backend-selection CTest for unsupported communicators, OpenMPI fallback, no-backend, and zero-count behavior.
    • Make the existing MPI AllGather example propagate validation failures through its exit status.

Platform and Backend Affected

Platform

  • CPU
  • NVIDIA GPU
  • Iluvatar GPU
  • MetaX GPU
  • Moore Threads GPU
  • Cambricon MLU
  • HYGON DCU

Backend

  • OpenMPI
  • MPICH
  • NCCL
  • MCCL

Performance Impact

  • No performance impact
  • Performance improved
  • Performance regression possible

N/A. This PR enables an existing API for NCCL and makes no performance claim.

Known Issues & Future Work

  • Other CCL backends remain unchanged and continue to report their existing support status.
  • Numerical integration coverage in this PR uses float32; datatype acceptance remains governed by the existing backend type map.

Test Results

Environment: ssh nvidia, accelerator-dev/nvidia:latest, two NVIDIA A100-SXM4-80GB GPUs, clean Release builds.

  • clang-format 16.0.6 --dry-run --Werror passed for every changed C++ file.
  • A clean [cpu,nvidia] / [nccl] full build passed, followed by CTest 2/2.
  • CUDA_VISIBLE_DEVICES=0,1 examples/ccl/all_gather passed out-of-place and NCCL-defined in-place element-wise validation and printed AllGather validation passed.
  • A clean [cpu,nvidia] / [ompi,nccl] full build passed, followed by CTest 2/2.
  • mpirun --allow-run-as-root --bind-to none -np 2 examples/mpi/all_gather passed with Correct: YES and rank-ordered blocks [r0: 1] [r1: 2].
  • git diff --check passed.

Test Involved Platform

  • CPU
  • NVIDIA GPU
  • Iluvatar GPU
  • MetaX GPU
  • Moore Threads GPU
  • Cambricon MLU
  • HYGON DCU

Test Involved Backend

  • OpenMPI
  • MPICH
  • NCCL
  • MCCL

Checklist

Title, Branch, and Commits

  • PR title follows Conventional Commits.
  • Branch name follows <type>/xxx-yyyy-zzzz where <type> matches the PR title's Conventional Commits type and words are joined with hyphens.
  • Each commit message follows Conventional Commits.
  • This small PR is a single squashable commit.
  • No stray merge commits are present; this PR is cleanly stacked on feat(nccl): add point-to-point communication #58.
  • No fixup! / squash! / wip commits remain.

Scope and Design

  • Changes are minimal and limited to NCCL AllGather and its reliable validation.
  • No dead code, commented-out blocks, debug prints, or unowned TODOs were introduced.
  • No unrelated formatting churn was introduced.
  • The existing public C API signature is unchanged; this PR provides its NCCL implementation.

General Code Hygiene

  • Comments are limited to non-obvious intent.
  • Every modified and added file ends with a trailing newline.
  • No trailing whitespace, inconsistent indentation, or mixed formatting styles remain.
  • Identifiers in comments and error messages use Markdown syntax where applicable.
  • Comments and error messages are in English.
  • Comments and error messages follow repository sentence conventions.

C++ Specific

  • Code follows the Google C++ Style Guide and the repository .clang-format.
  • clang-format version 16.0.6 passed with --dry-run --Werror.
  • No exceptions were introduced.
  • Error and warning wording follows repository conventions.
  • No constructor initializer-order issue was introduced.
  • Required blank-line conventions are satisfied.

Python Specific

N/A. This PR does not change Python files.

Testing

  • All applicable AllGather examples were built and run successfully on NVIDIA with NCCL and with the mixed OpenMPI/NCCL configuration described above.

Build, CI, and Tooling

N/A. This PR does not add a backend or device to auto-detection. The repository's C++ formatting gate was reproduced locally; hosted CI will run on the pushed branch.

Documentation

  • The new validated usage is documented by examples/ccl/all_gather.cc and this PR description.
  • No user-visible breaking change is introduced.

Security and Safety

  • No secrets, access tokens, internal URLs, customer data, or personal hardware identifiers were committed.
  • No third-party source code was added.
  • Buffer capacities and the NCCL-defined in-place offset are validated by the two-GPU example; no uninitialized reads were introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant