diff --git a/torch/csrc/distributed/c10d/init.cpp b/torch/csrc/distributed/c10d/init.cpp index c39957c2e8386..3f4874ee87763 100644 --- a/torch/csrc/distributed/c10d/init.cpp +++ b/torch/csrc/distributed/c10d/init.cpp @@ -882,7 +882,7 @@ This class does not support ``__members__`` property.)"); } TORCH_CHECK(r.supplement_.defined(), "Invalid PREMUL_SUM ReduceOp"); const auto* preMulSupplement = - reinterpret_cast<::c10d::NCCLPreMulSumSupplement*>( + reinterpret_cast<::c10d::XCCLPreMulSumSupplement*>( r.supplement_.get()); if (!preMulSupplement->tensor_factor.defined()) { return py::make_tuple(r.op_, preMulSupplement->double_factor); @@ -900,9 +900,9 @@ This class does not support ``__members__`` property.)"); } const auto preMulSupplement_factor = t[1]; if (py::isinstance(preMulSupplement_factor)) { - return ::c10d::makeNCCLPreMulSum(t[1].cast()); + return ::c10d::makeXCCLPreMulSum(t[1].cast()); } else { - return ::c10d::makeNCCLPreMulSum(t[1].cast()); + return ::c10d::makeXCCLPreMulSum(t[1].cast()); } })); @@ -938,6 +938,19 @@ This class does not support ``__members__`` property.)"); py::arg("factor").noconvert(), py::return_value_policy::copy, // seems safest py::call_guard()); + module + .def( + "_make_xccl_premul_sum", + &::c10d::makeXCCLPreMulSum, + py::arg("factor").noconvert(), + py::return_value_policy::copy, // seems safest + py::call_guard()) + .def( + "_make_xccl_premul_sum", + &::c10d::makeXCCLPreMulSum, + py::arg("factor").noconvert(), + py::return_value_policy::copy, // seems safest + py::call_guard()); module.def( "_set_thread_isolation_mode", diff --git a/torch/distributed/__init__.py b/torch/distributed/__init__.py index 38e2fdbee803a..f40f0eb7b4d3a 100644 --- a/torch/distributed/__init__.py +++ b/torch/distributed/__init__.py @@ -43,6 +43,7 @@ def is_available() -> bool: _ControlCollectives, _DEFAULT_FIRST_BUCKET_BYTES, _make_nccl_premul_sum, + _make_xccl_premul_sum, _register_builtin_comm_hook, _register_comm_hook, _StoreCollectives,