Update NCCL to current master and remove patch step (#85367)
The patch from #84245 has been upstreamed into NCCL, so the patch step is no longer required.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85367
Approved by: https://github.com/ezyang
diff --git a/.lintrunner.toml b/.lintrunner.toml
index 33980c3..b2fa676 100644
--- a/.lintrunner.toml
+++ b/.lintrunner.toml
@@ -318,7 +318,6 @@
'aten/src/ATen/native/vulkan/api/vk_mem_alloc.h',
'test/cpp/jit/upgrader_models/*.ptl',
'test/cpp/jit/upgrader_models/*.ptl.ff',
- 'cmake/External/nccl.patch',
]
command = [
'python3',
@@ -348,7 +347,6 @@
'test/cpp/jit/upgrader_models/*.ptl',
'test/cpp/jit/upgrader_models/*.ptl.ff',
'.lintrunner.toml',
- 'cmake/External/nccl.patch',
]
command = [
'python3',
diff --git a/cmake/External/apply_nccl_patch.sh b/cmake/External/apply_nccl_patch.sh
deleted file mode 100755
index 7920c1b..0000000
--- a/cmake/External/apply_nccl_patch.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-# This patch is required to fix intermittent link errors when building
-# NCCL. See https://github.com/pytorch/pytorch/issues/83790
-
-TORCH_DIR=$1
-
-# Only apply patch if "git status" is empty to avoid failing when the
-# patch has already been applied
-if [[ `git status --porcelain` == "" ]]; then
- git apply "${TORCH_DIR}/cmake/External/nccl.patch"
-fi
diff --git a/cmake/External/nccl.cmake b/cmake/External/nccl.cmake
index 1e7d7e2..cb928ba 100644
--- a/cmake/External/nccl.cmake
+++ b/cmake/External/nccl.cmake
@@ -50,7 +50,6 @@
"BUILDDIR=${__NCCL_BUILD_DIR}"
"VERBOSE=0"
BUILD_BYPRODUCTS "${__NCCL_BUILD_DIR}/lib/libnccl_static.a"
- PATCH_COMMAND "${CMAKE_CURRENT_LIST_DIR}/apply_nccl_patch.sh" "${PROJECT_SOURCE_DIR}"
INSTALL_COMMAND ""
)
diff --git a/cmake/External/nccl.patch b/cmake/External/nccl.patch
deleted file mode 100644
index 48bb9d9..0000000
--- a/cmake/External/nccl.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff --git a/src/collectives/device/Makefile b/src/collectives/device/Makefile
-index 04bce8e..a2498a0 100644
---- a/src/collectives/device/Makefile
-+++ b/src/collectives/device/Makefile
-@@ -29,7 +29,7 @@ all: $(STATICLIB)
- all_deps: $(DEPENDFILES)
-
- # Auto-generating the rules per op/reduction/datatype/algorithm
--$(RULESFILE) :
-+$(RULESFILE) : gen_rules.sh
- @printf "Generating %-35s > %s\n" rules $@
- @mkdir -p $(OBJDIR)
- @CUDA_MAJOR=${CUDA_MAJOR} CUDA_MINOR=${CUDA_MINOR} ./gen_rules.sh $(OBJDIR) > $@
-diff --git a/src/collectives/device/gen_rules.sh b/src/collectives/device/gen_rules.sh
-index aaf3685..73359af 100755
---- a/src/collectives/device/gen_rules.sh
-+++ b/src/collectives/device/gen_rules.sh
-@@ -13,6 +13,9 @@ then
- datatypes+=" bf16"
- fi
-
-+echo "CURDIR := \$(dir \$(realpath \$(word \$(words \$(math\$(MAKEFILE_LIST))-1), \$(MAKEFILE_LIST))))"
-+echo ""
-+
- targets="GENOBJS := \\\\\n"
-
- for base in sendrecv all_reduce all_gather broadcast reduce reduce_scatter; do
-@@ -21,10 +24,16 @@ for base in sendrecv all_reduce all_gather broadcast reduce reduce_scatter; do
- dtn=0
- # Order must match that of the ncclDataType_t enum
- for dt in ${datatypes}; do
-- echo "${dir}/${base}_${op}_${dt}.o : ${base}.cu ${dir}/${base}.dep"
-+ # Generate a unique filename for each compilation unit,
-+ # otherwise the __nv_module_id may conflict at link time
-+ echo "${dir}/${base}_${opn}_${dtn}.cu :"
-+ echo " echo \"#include \\\"\$(CURDIR)${base}.cu\\\"\" > \$@"
-+ echo ""
-+ # Compile the file
-+ echo "${dir}/${base}_${op}_${dt}.o : ${dir}/${base}_${opn}_${dtn}.cu ${base}.cu ${dir}/${base}.dep"
- echo " @printf \"Compiling %-35s > %s\\\\n\" ${base}.cu ${dir}/${base}_${op}_${dt}.o"
- echo " mkdir -p ${dir}"
-- echo " \${NVCC} -DNCCL_OP=${opn} -DNCCL_TYPE=${dtn} \${NVCUFLAGS} -dc ${base}.cu -o ${dir}/${base}_${op}_${dt}.o"
-+ echo " \${NVCC} -DNCCL_OP=${opn} -DNCCL_TYPE=${dtn} \${NVCUFLAGS} -dc \$< -o \$@"
- echo ""
- targets="$targets\t${dir}/${base}_${op}_${dt}.o \\\\\n"
- dtn=$(($dtn + 1))
diff --git a/third_party/nccl/nccl b/third_party/nccl/nccl
index 19ab67d..f89fd47 160000
--- a/third_party/nccl/nccl
+++ b/third_party/nccl/nccl
@@ -1 +1 @@
-Subproject commit 19ab67d1727d337d10d0a48cbaf5cd119b8d88f1
+Subproject commit f89fd4777d2ef9229c039ff750ae21da01626f52