Skip to content

[c10d][xccl2] Port the XcclApi oneCCL abstraction - #6

Open
frost-intel wants to merge 1 commit into
xccl2/01-foundationfrom
xccl2/02-api
Open

frost-intel wants to merge 1 commit into
xccl2/01-foundationfrom
xccl2/02-api

Conversation

@frost-intel

@frost-intel frost-intel commented Aug 25, 2026 •

Copy link
Copy Markdown
Owner

Stack (bottom → top)

PR Branch
#5 xccl2/01-foundation
→ #6 xccl2/02-api
#7 xccl2/03-work
#8 xccl2/04-engine-decl
#9 xccl2/05-engine-impl
#10 xccl2/06-backend-surface
#11 xccl2/07-build-wiring
#12 xccl2/08-tests
#3 xccl2/09-integration-tests

Each PR is exactly one commit and targets the one below it. Review bottom-up.


First code commit of the in-tree TorchComms XCCL backend. Ports
comms/torchcomms/xccl/XcclApi.{hpp,cpp} to
torch/csrc/distributed/c10d/xccl2/, namespace c10d::xccl2, guarded by
USE_C10D_XCCL. Nothing references it yet; build wiring lands later in the
stack.

This binds the oneCCL C API (onecclXxx, <oneapi/ccl.h>) rather than the C++
ccl:: API used by the existing torch-xpu-ops ProcessGroupXCCL. The C API
mirrors NCCL's shape, which is what lets the backend built on top of it stay
structurally aligned with nccl2's NcclApi.

Deviations from the torchcomms original:

  • Streams are c10::xpu::XPUStream instead of the torchcomms xpuStream_t
    alias, so comms/torchcomms/device/xpu/XpuApi.* does not need porting.
    xpuStream_t was already c10::xpu::XPUStream, and XPUStream's
    operator sycl::queue* implicitly converts to the void* stream the oneCCL
    C API takes.
  • getErrorString returns std::string_view to match nccl2's NcclApi, with a
    null check: unlike ncclGetErrorString, oneCCL documents no non-null
    guarantee, and std::string_view(nullptr) is UB.
  • Drops the <oneapi/ccl.hpp> include; the C API header is sufficient.

commAbort/commGetAsyncError are kept in the interface but return
onecclNotImplemented. oneCCL declares onecclCommAbort and
onecclCommGetAsyncError with CCL_C_NOT_IMPLEMENTED, which expands to
attribute((error(...))) -- referencing them is a compile-time error, so
they cannot simply forward. The backend must therefore not depend on
abort-based teardown or async error polling for now.

Verified by compiling the TU with the real torch_xpu flags: 63 exported
symbols with USE_C10D_XCCL, 0 without, and all 26 undefined oneCCL references
resolve against libccl.so.2.

First code commit of the in-tree TorchComms XCCL backend. Ports
`comms/torchcomms/xccl/XcclApi.{hpp,cpp}` to
`torch/csrc/distributed/c10d/xccl2/`, namespace `c10d::xccl2`, guarded by
USE_C10D_XCCL. Nothing references it yet; build wiring lands later in the
stack.

This binds the oneCCL *C* API (`onecclXxx`, <oneapi/ccl.h>) rather than the C++
`ccl::` API used by the existing torch-xpu-ops ProcessGroupXCCL. The C API
mirrors NCCL's shape, which is what lets the backend built on top of it stay
structurally aligned with nccl2's NcclApi.

Deviations from the torchcomms original:
- Streams are `c10::xpu::XPUStream` instead of the torchcomms `xpuStream_t`
  alias, so `comms/torchcomms/device/xpu/XpuApi.*` does not need porting.
  `xpuStream_t` was already `c10::xpu::XPUStream`, and XPUStream's
  `operator sycl::queue*` implicitly converts to the `void* stream` the oneCCL
  C API takes.
- `getErrorString` returns `std::string_view` to match nccl2's NcclApi, with a
  null check: unlike ncclGetErrorString, oneCCL documents no non-null
  guarantee, and `std::string_view(nullptr)` is UB.
- Drops the `<oneapi/ccl.hpp>` include; the C API header is sufficient.

commAbort/commGetAsyncError are kept in the interface but return
onecclNotImplemented. oneCCL declares onecclCommAbort and
onecclCommGetAsyncError with CCL_C_NOT_IMPLEMENTED, which expands to
__attribute__((error(...))) -- referencing them is a *compile-time* error, so
they cannot simply forward. The backend must therefore not depend on
abort-based teardown or async error polling for now.

Verified by compiling the TU with the real torch_xpu flags: 63 exported
symbols with USE_C10D_XCCL, 0 without, and all 26 undefined oneCCL references
resolve against libccl.so.2.
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