Skip to content

feat(ascend): add HCCL backend support - #73

Open
baominghelly wants to merge 1 commit into
masterfrom
feat/ascend-hccl-backend
Open

baominghelly wants to merge 1 commit into
masterfrom
feat/ascend-hccl-backend

Conversation

@baominghelly

Copy link
Copy Markdown

Summary

Add the minimal Ascend HCCL backend required for single-node tensor parallelism. The implementation supports communicator initialization with infinicclCommInitAll, collective reduction with infinicclAllReduce, and communicator cleanup with infinicclCommDestroy.

The scope is intentionally limited to the communication path currently exercised by InfiniLM pure TP inference.

Changes

  • Ascend device integration

    • Add Ascend device registration, runtime operations, memory-space detection, and CANN discovery.
    • Add the WITH_ASCEND build option and automatic Ascend environment detection.
  • HCCL backend

    • Add the WITH_HCCL build option, backend registration, and HCCL dependency discovery.
    • Add Ascend/HCCL data type and reduction operation mappings.
    • Implement CommInitAll, AllReduce, and CommDestroy.
    • Resolve a null caller stream through a thread-local Ascend stream.
  • Common communicator initialization

    • Update the internal CommInitAll contract to return one communicator per requested device.
    • Adapt the OpenMPI implementation to the updated internal contract without changing its public API.

Platform and Backend Affected

Platform

  • CPU (shared CommInitAll dispatch path)
  • NVIDIA GPU
  • Iluvatar GPU
  • MetaX GPU
  • Moore Threads GPU
  • Cambricon MLU
  • HYGON DCU
  • Ascend NPU

Backend

  • OpenMPI (internal CommInitAll adapter)
  • MPICH
  • NCCL
  • MCCL
  • HCCL

Performance Impact

  • No performance impact
  • Performance improved
  • Performance regression possible

N/A. This adds a new backend and does not change an existing communication kernel.

Known Issues & Future Work

  • The HCCL backend currently exposes only CommInitAll, AllReduce, and CommDestroy.
  • Rank-based multi-process initialization and additional collectives are outside this PR's pure-TP scope.
  • OpenMPI regression validation and repository example integration remain pending before the PR is marked ready for review.

Test Results

Environment:

  • Ascend 910C, two logical devices (0,1)
  • CANN 9.0.0
  • openEuler 24.03, AArch64
  • GCC 12.3.1

Results:

  • Fresh CMake configuration with WITH_ASCEND=ON, WITH_HCCL=ON, and WITH_OMPI=OFF: passed.
  • InfiniCCL build and installation: passed.
  • Dynamic dependency and exported-symbol checks: passed.
  • Two-device CommInitAll + AllReduce(sum) + CommDestroy smoke test: passed.
    • Device 0 input: all elements 1.0.
    • Device 1 input: all elements 2.0.
    • Both outputs: all elements 3.0.
  • git diff --check: passed.
  • ruff check scripts/gen_bridge.py: passed.
  • ruff format --check scripts/gen_bridge.py: passed.
  • clang-format-diff.py on changed C++ lines: clean with clang-format 21.1.8.

Test Involved Platform

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

Test Involved Backend

  • OpenMPI
  • MPICH
  • NCCL
  • MCCL
  • HCCL

Checklist

Title, Branch, and Commits

  • PR title follows Conventional Commits.
  • Branch name follows <type>/xxx-yyyy-zzzz.
  • Each commit message follows Conventional Commits.
  • The PR contains one squashable commit.
  • The branch is rebased cleanly on the current master.
  • No fixup!, squash!, or wip commits remain.

Scope and Design

  • Changes are limited to the minimal pure-TP HCCL path and its required build/runtime integration.
  • No debug code, commented-out blocks, or unrelated formatting churn is included.
  • The internal CommInitAll change is intentional and its OpenMPI implementation is adapted in the same commit.

General Code Hygiene

  • git diff --check passes.
  • Comments and error messages added by this PR are in English.
  • Modified and added files end with a trailing newline.

C++ Specific

  • Changed C++ lines pass clang-format-diff.py.
  • clang-format 16 CI is pending; local validation used clang-format 21.1.8.
  • No exceptions are introduced.

Python Specific

  • ruff check passes.
  • ruff format --check passes.

Testing

  • Repository example programs are pending; the out-of-tree two-device HCCL smoke test passes.

Build, CI, and Tooling

  • Ascend and HCCL are included in build options and auto-detection.
  • GitHub CI is pending.

Documentation

  • User-facing documentation is intentionally deferred while the backend remains limited to the pure-TP API subset.

Security and Safety

  • No secrets, internal URLs, customer data, or hardware identifiers are committed.
  • No third-party source code is copied into the repository.

@baominghelly
baominghelly marked this pull request as ready for review September 9, 2026 06:06
@baominghelly
baominghelly requested a review from Ziminli September 9, 2026 06:07
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