Summary:
Introduce the torchcomms _single collective names on the C++ c10d::Backend and migrate the in-tree backends to define them, while keeping the old names fully working for backward compatibility.
Backend now declares all_gather_single, all_gather_single_coalesced, reduce_scatter_single, reduce_scatter_single_coalesced, and all_to_all_single alongside the existing _allgather_base, allgather_into_tensor_coalesced, _reduce_scatter_base, reduce_scatter_tensor_coalesced, and alltoall_base, which are kept as overridable, forwarding aliases.
Backward compatibility is preserved in both directions: each new method and its old-name alias forward to each other, so a Backend subclass may override EITHER name and a caller may invoke EITHER name. The old aliases simply forward to the canonical _single method; each canonical method opens with the C10D_BACKEND_FORWARDING_GUARD() macro, which installs a function-local thread-local re-entry flag using __func__ for the message. If a backend overrides neither name the mutual forwarding re-enters the canonical method, the flag trips, and it reports "does not support " instead of recursing forever. As a result, existing callers of the old names (first-party and out-of-tree) and existing out-of-tree backends that override the old names both keep working unchanged. Removing the old overrides outright would have broken out-of-tree backends on the dispatch path, and dropping the old caller-facing names would have broken direct callers; the bidirectional forwarding avoids both.
The old names are intentionally NOT marked C10_DEPRECATED_MESSAGE in this change. PyTorch's open-source build compiles the bundled third_party/torch-xpu-ops submodule with -Werror -Wdeprecated, and its XPU collective op registration (xccl/Register.cpp) still calls the old Backend names, so a compile-time deprecation turns into a hard build error there. The deprecation will be reintroduced in a follow-up once those callers (and any other out-of-tree backends that are built in-tree) are migrated to the _single names and the submodule pin is bumped.
The in-tree backends are migrated to define the new names: ProcessGroupNCCL, ProcessGroupGloo, ProcessGroupMPI, ProcessGroupUCC, ProcessGroupWrapper, FakeProcessGroup, NCCLXStub, and the torch_openreg (ProcessGroupOCCL) test backend. The dispatcher op implementations in Ops.cpp, ProcessGroupWrapper's forwarders, and the Backend pybind bindings in init.cpp use the new names.
The underlying aten / c10d dispatcher op names (c10d::_allgather_base_, c10d::alltoall_base_, etc.), their schema strings, the IMPL_* macro names in Ops.cpp, and the OpType enum values are intentionally left unchanged for backward compatibility.
Suggested review order: Backend.hpp (the new/old method pairs and the bidirectional forwarding + ForwardingGuard), then the per-backend subclass renames, then the Ops.cpp / ProcessGroupWrapper / init.cpp call sites.
This diff was authored with the assistance of an AI coding agent (Claude).
Test Plan:
This revision only removes the compile-time deprecation annotations (C10_DEPRECATED_MESSAGE), their -Wdeprecated-declarations suppressions, and the now-unused <c10/util/Deprecated.h> include. The _single rename and the bidirectional forwarding/recursion guard are unchanged, so there is no runtime or codegen change -- dropping the annotations only removes deprecation warnings.
Verified by open-source CI on the exported commit: the full libtorch build across platforms, the linux-noble-xpu-n-py3.10 / build-osdc job (which compiles the bundled torch-xpu-ops xccl/Register.cpp with -Werror -Wdeprecated and previously failed on -Werror=deprecated-declarations), and the lintrunner-clang format jobs.
Reviewed By: kapilsh
Differential Revision: D108364288
SOCIAL SHARE CARD GENERATOR