[c10d][xccl2] Add backend-agnostic TorchComms helpers for xccl2 - #5
Open
frost-intel wants to merge 1 commit into
Open
frost-intel wants to merge 1 commit into
frost-intel wants to merge 1 commit into
Conversation
xccl2 needs three of the backend-agnostic helpers that nccl2 uses:
TracingGuard (profiler and flight-recorder records), Logging (TC_LOG) and
Batch (BatchSendRecv). All three were upstreamed from torchcomms'
comms/torchcomms/utils/ and contain no backend-specific code, but they
currently live under c10d/nccl2/ behind USE_C10D_NCCL and compile into
libtorch_cuda. An XPU-only build never compiles them, so xccl2 cannot link
against them.
Vendor a copy under c10d/xccl2/ in namespace c10d::xccl2. The files are
identical to the nccl2 originals apart from the namespace, the compile guard
(USE_C10D_XCCL) and the include paths. nccl2's Utils.{hpp,cpp} is deliberately
not copied: xccl2 takes its rank and size from the c10d Store rather than from
query_ranksize(), so none of its entry points are reachable here.
This duplicates the helpers rather than relocating the originals, so that
landing xccl2 requires no changes to nccl2. Consolidating the copies into a
shared directory is left to a follow-up that can be reviewed on its own merits,
once both backends are in tree.
No functional change to any existing backend.
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stack (bottom → top)
xccl2/01-foundationxccl2/02-apixccl2/03-workxccl2/04-engine-declxccl2/05-engine-implxccl2/06-backend-surfacexccl2/07-build-wiringxccl2/08-testsxccl2/09-integration-testsEach PR is exactly one commit and targets the one below it. Review bottom-up.
xccl2 needs three of the backend-agnostic helpers that nccl2 uses:
TracingGuard (profiler and flight-recorder records), Logging (TC_LOG) and
Batch (BatchSendRecv). All three were upstreamed from torchcomms'
comms/torchcomms/utils/ and contain no backend-specific code, but they
currently live under c10d/nccl2/ behind USE_C10D_NCCL and compile into
libtorch_cuda. An XPU-only build never compiles them, so xccl2 cannot link
against them.
Vendor a copy under c10d/xccl2/ in namespace c10d::xccl2. The files are
identical to the nccl2 originals apart from the namespace, the compile guard
(USE_C10D_XCCL) and the include paths. nccl2's Utils.{hpp,cpp} is deliberately
not copied: xccl2 takes its rank and size from the c10d Store rather than from
query_ranksize(), so none of its entry points are reachable here.
This duplicates the helpers rather than relocating the originals, so that
landing xccl2 requires no changes to nccl2. Consolidating the copies into a
shared directory is left to a follow-up that can be reviewed on its own merits,
once both backends are in tree.
No functional change to any existing backend.