Skip to content

feat: add T-Head platform support across runtime, device, build, and launcher stack - #78

Merged
Ziminli merged 9 commits into
masterfrom
feat/support-ali-platform
Oct 14, 2026
Merged

Ziminli merged 9 commits into
masterfrom
feat/support-ali-platform

Conversation

@Ziminli

@Ziminli Ziminli commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds T-Head PPU support to InfiniCCL through its CUDA-compatible runtime and NCCL API surface. The branch introduces the public thead device identifier and WITH_THEAD build option, adds the corresponding device runtime and NCCL backend adapter, and wires the platform into CMake device and backend auto-detection. The implementation reuses the existing CUDA and NCCL abstractions.

Changes

  • Build and Auto-Detection

    • Add WITH_THEAD and lazy, memoized discovery of T-Head SDK locations from relevant environment variables;
    • Discover the T-Head NCCL-compatible library using platform-owned targets/x86_64-linux/{include,lib} search suffixes;
    • Preserve explicit NVIDIA selection while ignoring NVIDIA auto-detection on an unrequested T-Head host.
  • Device and Backend Support

    • Add Device::Type::kThead with public device name thead.
    • Add T-Head runtime, memory-space, data-type, and casting specializations under src/devices/thead/.
    • Add the T-Head NCCL API adapter under src/backends/ccl/nccl/thead/ and register NCCL as a supported backend/device combination.
    • Link T-Head examples against the CUDA-compatible runtime.
  • Launcher and Generated Dispatch

    • Recognize loopback, IPv6 localhost, hostname aliases, resolved addresses, and interface addresses as local in scripts/icclrun_logic.py.
    • Keep bridge generation driven by the normalized thead directory and device name, without a device-specific enum mapping in scripts/gen_bridge.py.
  • Documentation and Template Updates

    • Updated .github/pull_request_template.md to include T-Head as a supported platform;
    • Updated README.md to include T-Head as a supported platform.

Platform and Backend Affected

Platform

  • CPU
  • NVIDIA GPU
  • Iluvatar GPU
  • MetaX GPU
  • Moore Threads GPU
  • Cambricon MLU
  • HYGON DCU
  • T-Head PPU

Backend

  • OpenMPI
  • MPICH
  • NCCL/RCCL
  • MCCL
  • CNCL

Performance Impact

  • No performance impact
  • Performance improved
  • Performance regression possible

If applicable, provide benchmark results.

Known Issues & Future Work

  • The placement of the function _collect_thead_hints in CMakeLists.txt is not ideal. An architecture should be designed to abstract out and organize platform/device-related utility functions instead of all residing in the root CMakeLists.txt.

Test Results

Test Involved Platform

  • CPU
  • NVIDIA GPU
  • Iluvatar GPU
  • MetaX GPU
  • Moore Threads GPU
  • Cambricon MLU
  • HYGON DCU
  • T-Head PPU

Test Involved Backend

  • OpenMPI
  • MPICH
  • NCCL/RCCL
  • MCCL
  • CNCL

NVIDIA (OMPI+NCCL):
ccl_mpi_hybrid_all_gather.log
ccl_mpi_hybrid_all_reduce.log
ccl_mpi_hybrid_send_recv.log

HYGON (RCCL):
ccl_all_gather.log
ccl_all_reduce.log
ccl_send_recv.log

T-Head (OMPI + NCCL):
ccl_mpi_hybrid_all_gather.log
ccl_mpi_hybrid_all_reduce.log
ccl_mpi_hybrid_send_recv.log

T-Head (NCCL):
ccl_all_gather.log
ccl_all_reduce.log
ccl_send_recv.log


Checklist

Every contributor must verify every item below before requesting
review. Tick each box only after the check has actually been performed —
do not tick speculatively. If an item truly does not apply, replace the
checkbox with N/A and briefly explain why in an inline comment.

Title, Branch, and Commits

  • PR title follows Conventional Commits (e.g. feat: …, fix(nccl): …).
  • Branch name follows <type>/xxx-yyyy-zzzz where <type> matches the PR title's Conventional Commits type and words are joined with hyphens (see CONTRIBUTING.md §Branches).
  • Each commit message follows Conventional Commits.
  • Small PR is a single squashable commit; or, for a large PR, every commit is meaningful, well-formed, and independently reviewable (see CONTRIBUTING.md §Pull Requests).
  • No stray merge commits from master — the branch is rebased cleanly on top of the current master.
  • No fixup! / squash! / wip commits remain.

Scope and Design

  • Changes are minimal — no unrelated modifications were introduced (CONTRIBUTING.md §Code/General).
  • No dead code, commented-out blocks, debug prints, printf/std::cout/print(...) left behind, or TODO without an owner and issue link.
  • No unrelated formatting churn that would obscure the diff.
  • N/A- Public API changes (if any) are intentional, documented, and reflected in affected callers/tests.

General Code Hygiene

  • The code is self-explanatory; comments were added only where the intent or rationale is non-obvious (CONTRIBUTING.md §Code/General).
  • Every modified or added file ends with a single trailing newline (CONTRIBUTING.md §Code/General).
  • No trailing whitespace, inconsistent indentation, or mixed formatting styles remain.
  • Identifiers referenced in comments or error messages are wrapped in Markdown backticks (e.g. the `AllReduce` implementation) (CONTRIBUTING.md §Code/General).
  • All comments and error messages are in English (CONTRIBUTING.md §Code/General).
  • Comments and error messages are complete sentences — capitalized first letter, terminal punctuation — unless the language/framework convention says otherwise (CONTRIBUTING.md §Code/General; §Python).

C++ Specific (if C++ files changed)

  • Code follows the Google C++ Style Guide strictly.
  • clang-format (version 16, per .github/workflows/clang-format.yml) has been run against all modified applicable files; the diff is clean.
  • No exceptions are thrown. Error paths use assert with messages that include at least __FILE__, __LINE__, and __func__ (CONTRIBUTING.md §C++).
  • Error and warning message wording follows the LLVM Coding Standards (CONTRIBUTING.md §C++).
  • Constructor initializer list order matches member declaration order (CONTRIBUTING.md §C++).
  • Exactly one blank line between classes, between classes and functions, and between functions (CONTRIBUTING.md §C++).
  • Exactly one blank line between members (functions and variables) within a class (CONTRIBUTING.md §C++).
  • Exactly one blank line before and after the contents of a namespace (CONTRIBUTING.md §C++).

Python Specific (if Python files changed)

  • Code is PEP 8 compliant; ruff check passes cleanly on CI (see .github/workflows/ruff.yml).
  • ruff format --check passes cleanly — if not, run ruff format and commit the result.
  • Comments are complete English sentences, starting with a capital letter and ending with punctuation; Markdown backticks are used for code references (CONTRIBUTING.md §Python).
  • Framework-specific conventions (e.g. lowercase pytest.skip messages without terminal period) are honored where applicable (CONTRIBUTING.md §Python).
  • No blank line between the function signature and the body when there is no docstring or comment (CONTRIBUTING.md §Python).
  • A blank line is present before and after if, for, and similar control-flow statements (CONTRIBUTING.md §Python).
  • A blank line appears before each return, except when it directly follows a control-flow statement (CONTRIBUTING.md §Python).
  • Docstrings (if any) follow PEP 257 (CONTRIBUTING.md §Python).
  • Type hints are added / kept consistent with the surrounding code.

Testing

  • All applicable example programs have been built and tested successfully on at least one supported heterogeneous cluster setup.

Build, CI, and Tooling

  • New backends or devices have been added to auto-detection in CMakeLists.txt under if(AUTO_DETECT_DEVICES) or to if(AUTO_DETECT_BACKENDS) if applicable.
  • Both CI workflows (clang-format.yml, ruff.yml) are green locally (or expected to be green on CI).

Documentation

  • README.md, CONTRIBUTING.md, or inline docs updated when behavior, build flags, or developer workflow changed.
  • N/A- Any user-visible breaking change is called out explicitly under "Summary" and in the commit/PR title with a ! or BREAKING CHANGE: footer.

Security and Safety

  • No secrets, access tokens, internal URLs, customer data, or personal hardware identifiers have been committed.
  • N/A- Third-party code is license-compatible and attributed.
  • No unsafe pointer arithmetic, uninitialized reads, or missing bounds checks were introduced.

 - Rename public Ali identifiers to T-Head
 - Prevent false NVIDIA auto-detection while preserving explicit NVIDIA selection.
Collect T-Head SDK hints lazily and reuse them across device, NCCL, and toolkit discovery. Keep NCCL search suffixes scoped to their platform-specific paths.
Use `thead` as the public device name and source-directory identifier, derive `kThead` through standard bridge generation, and remove the T-Head enum mapping. Also retain the memoized T-Head hints in function scope so first-use backend detection resolves SDK paths correctly.
@Ziminli Ziminli self-assigned this Oct 14, 2026
@Ziminli
Ziminli merged commit 3294bc4 into master Oct 14, 2026
2 checks passed
@Ziminli
Ziminli deleted the feat/support-ali-platform branch October 14, 2026 11:10
@Ziminli Ziminli mentioned this pull request Oct 14, 2026
35 of 56 tasks
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