Summary:
Raise the compile-time minimum NCCL version to 2.20 and remove the preprocessor and runtime version gates that guarded features introduced in NCCL 2.20 or earlier. Gates for features introduced after 2.20 are deliberately preserved so the code still compiles and behaves correctly against NCCL 2.20 through 2.26.
The introduction version of every feature was cross-checked against the NCCL release notes and the public nccl.h headers (each gated symbol was confirmed present in the v2.20.5 header where its gate is dropped, and absent there where its gate is retained) before deciding whether its gate could be removed:
| Feature | Introduced | Gate |
|---|---|---|
ncclAvg |
2.10 | removed |
PreMulSum (ncclRedOpCreatePreMulSum) |
2.11 | removed |
ncclGetLastError / ncclRemoteError |
2.13 | removed |
non-blocking comms + ncclConfig_t |
2.14 | removed |
ncclCommSplit |
2.18 | removed |
ncclCommRegister / ncclMemAlloc |
2.19 | removed |
group abort (ncclGroupStart/End for abort) |
2.22 | kept |
ncclCommInitRankScalable |
2.23 | kept |
FP8 e5m2/e4m3 |
2.24 | kept |
QoS / trafficClass |
2.26 | kept |
ncclCommShrink, ncclCommWindowRegister, symmetric memory, collnetEnable/CTAPolicy/nvlsCTAs |
2.27 | kept |
Suggested review order
NCCLUtils.hpp- thestatic_assertis bumped from 2.7 to 2.20. Macros for features at or below 2.20 are deleted and their feature code becomes unconditional (NCCL_HAS_COMM_NONBLOCKING,NCCL_HAS_COMM_SPLIT,ENABLE_NCCL_GET_LAST_ERROR,NCCL_REMOTE_ERROR,ENABLE_NCCL_ERROR_CHECKING,ENABLE_NCCL_P2P_SUPPORT,ENABLE_NCCL_PREMUL_SUM_SUPPORT,NCCL_HAS_CONFIG,NCCL_HAS_COMM_REGISTER,NCCL_HAS_MEM_ALLOC), while macros for features above 2.20 are retained (NCCL_HAS_INIT_RANK_SCALABLE2.23,NCCL_SUPPORTS_FP82.24,NCCL_HAS_QOS2.26, and the 2.27NCCL_HAS_COMM_WINDOW_REGISTER/NCCL_HAS_COLLNET/NCCL_HAS_CTA_POLICY/NCCL_HAS_NVLS_CTAS/NCCL_HAS_COMM_SHRINK).NCCLUtils.cpp,ProcessGroupNCCL.{hpp,cpp},init.cpp- dead#ifdef/#ifndef/#elsebranches for <= 2.20 features are removed and the live branch inlined; the runtimeversion < 2.19mem-allocator check is dropped. The retained gates guard only post-2.20 features: the runtimegetNcclVersionNumber() >= 2.22group-abort check, scalable init (2.23), the FP8 dtype mapping (2.24), the QoS / collnet / CTA-policy / NVLS config fields (2.26-2.27), andncclCommShrink/ window registration (2.27).cuda/nccl.{h,cpp}- the ancient NCCL 1.x / 2.0 / 2.7 / 2.12.10 / 2.13 / 2.14 guards are removed; only NCCL-presence gates (USE_NCCL,defined(NCCL_MAJOR)) and>= 2.28gates remain.symm_mem/nccl_dev_cap.hpp-NCCL_HAS_SYMMEM_SUPPORTstays a normal>= 2.27version gate, since symmetric memory is not available at the new 2.20 minimum.
Kept intentionally
Every gate for a feature newer than 2.20 is untouched: the runtime group-abort check (2.22), NCCL_HAS_INIT_RANK_SCALABLE (2.23), NCCL_SUPPORTS_FP8 (2.24), NCCL_HAS_QOS (2.26), the 2.27 symmetric-memory / shrink / window-registration / collnet / CTA-policy / NVLS-CTAs gates, the pre-existing >= 2.28 gates (ncclAlltoAll, NCCL_HAS_SYMMEM_DEVICE_SUPPORT, NCCL_HAS_COMM_OFFLOAD 2.29.7, NCCL_HAS_MAX_P2P_PEERS 2.30, etc.), and the defensive runtime version >= 2.27 check inside ProcessGroupNCCL::shrink().
HAS_NCCL_BF16_DATATYPE (nccl.h) keeps its CUDA-bf16 / ROCm structure with the simplified NCCL_MAJOR >= 2 subexpression (the bf16 dtype arrived in 2.10, below the new minimum), preserving the "NCCL absent => disabled" behavior its consumers (e.g. quantization_gpu.cu) rely on.
Test Plan:
This change is preprocessor-only; the new static_assert enforces the NCCL >= 2.20 minimum and the retained gates keep the 2.22-2.27 features behind their version checks.
Linted every changed file (fast linters, no issues):
arc lint fbcode/caffe2/torch/csrc/distributed/c10d/NCCLUtils.cpp fbcode/caffe2/torch/csrc/distributed/c10d/NCCLUtils.hpp fbcode/caffe2/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp fbcode/caffe2/torch/csrc/distributed/c10d/ProcessGroupNCCL.hpp fbcode/caffe2/torch/csrc/distributed/c10d/init.cpp fbcode/caffe2/torch/csrc/distributed/c10d/symm_mem/nccl_dev_cap.hpp fbcode/caffe2/torch/csrc/cuda/nccl.h
Compilation against the full range of supported NCCL versions (2.20 through current) is exercised by CI; build against any NCCL >= 2.20, e.g.:
uv pip install -e . --no-build-isolation -v
This PR was authored with the assistance of Claude, an AI coding assistant.
Differential Revision: D107591575
Pulled By: d4l3k
SOCIAL SHARE CARD GENERATOR