From 3fa1f4f2c14dce3a7ead8a1e07f839d9c45b5459 Mon Sep 17 00:00:00 2001 From: Guobao Sun Date: Thu, 22 Oct 2026 20:12:08 -0700 Subject: [PATCH] Remove external consumers of TorchComms `rccl` and `rcclx` (#224) Summary: X-link: https://github.com/meta-pytorch/torchrec/pull/4928 Prepare for removing `rccl` and `rcclx` from TorchComms by removing their external build and runtime consumers. Retire `DMPCollection`'s built-in RCCLX sharded-relay integration and its internal PyTorch adapter, utility module, unit tests, and AMD benchmark. The default `replica_pg.allreduce_coalesced` path handles reductions by dtype, preserves `ReduceOp.SUM`/`ReduceOp.AVG` options, and waits for completion. Custom reducer hooks remain available. The `use_sharded_relay` constructor option is removed, and TorchRec no longer reads `NCCL_SHARDED_RELAY_MODE_ENABLE`. Remove PARAM's RCCLX extension dependency on AMD and its advertised `rccl`/`rcclx` TorchComms backend choices. Reject AMD selection of the `pytorch-torchcomms` stack before device or communicator initialization, directing users to `--nw-stack pytorch-dist`. Native PyTorch distributed benchmarks on AMD continue to use their existing underlying RCCL library dependencies. Move the RCCLX PARAM smoke test (`rcclx_comms_test`) off the TorchComms `rcclx` backend, which this change removes from PARAM, onto `--nw-stack pytorch-dist --backend nccl`. On AMD, c10d's `nccl` backend links the RCCLX build that the test's `rcclx-dev` modifier selects, so the test still runs an all-reduce on RCCLX. Remove obsolete TorchComms RCCL/RCCLX build-all entries, Buck auto-mode mappings, and the Infer exclusion. Update the `DperExporter` packaging test's module list to omit the deleted utility. Behavior change: this retires the built-in sharded-relay optimization. Workloads relying on it can lose throughput and need review before landing. Existing packaged copies of the old TorchRec integration load its dependencies dynamically, so they keep loading and fall back to the default all-reduce. This draft covers external consumers and tooling. TorchComms backend implementation and OSS build/packaging removal follow separately. Review `model_parallel.py` and PARAM's backend selection changes first, followed by the build rules and deletion list. Prepared with Codex and Claude Code assistance. Differential Revision: D126865303 --- train/comms/pt/pytorch_backend_utils.py | 2 +- train/comms/pt/pytorch_torchcomms_backend.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/train/comms/pt/pytorch_backend_utils.py b/train/comms/pt/pytorch_backend_utils.py index 1a59b766..5a4570c2 100644 --- a/train/comms/pt/pytorch_backend_utils.py +++ b/train/comms/pt/pytorch_backend_utils.py @@ -31,7 +31,7 @@ class CollectiveArgsMixin: supportedDevices = ["cpu", "cuda", "rocm", "tpu"] supportedC10dBackends = ["nccl", "gloo", "mpi", "ucc", "xla", "mccl"] -supportedTorchcommsBackends = ["rcclx", "ncclx", "rccl", "mccl"] +supportedTorchcommsBackends = ["ncclx", "mccl"] supportedCollectives = [ "reduce", "all_reduce", diff --git a/train/comms/pt/pytorch_torchcomms_backend.py b/train/comms/pt/pytorch_torchcomms_backend.py index e6019381..4d8b428f 100644 --- a/train/comms/pt/pytorch_torchcomms_backend.py +++ b/train/comms/pt/pytorch_torchcomms_backend.py @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) -_VALID_BACKENDS = ["nccl", "ncclx", "rcclx", "mccl"] +_VALID_BACKENDS = ["nccl", "ncclx", "mccl"] class PyTorchTorchcommsBackend(backendFunctions): @@ -742,6 +742,11 @@ def initialize_backend( self, master_ip, master_port, backend="ncclx", eager_mode=False ): """Initialize the torchcomms backend""" + if torch.version.hip is not None: + raise ValueError( + "The pytorch-torchcomms stack does not support AMD GPUs. " + "Use --nw-stack pytorch-dist for AMD benchmarks." + ) if backend not in _VALID_BACKENDS: raise ValueError( f"Invalid backend {backend}. Valid backends are {_VALID_BACKENDS}"