Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ if(WITH_OMPI OR WITH_MPICH)
endif()

if(WITH_NCCL)
if (NOT WITH_NVIDIA AND NOT WITH_ILUVATAR)
message(FATAL_ERROR "NCCL backend requires NVIDIA or Iluvatar GPU support. Please enable `WITH_NVIDIA` or `WITH_ILUVATAR`.")
if (NOT WITH_NVIDIA AND NOT WITH_ILUVATAR AND NOT WITH_HYGON)
message(FATAL_ERROR "NCCL-compatible backend requires NVIDIA, Iluvatar, or Hygon GPU support.")
endif()

find_library(NCCL_LIB NAMES nccl HINTS ${_NCCL_HINTS} PATH_SUFFIXES lib lib64 REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export LD_LIBRARY_PATH=${INFINI_INSTALL}/lib:$LD_LIBRARY_PATH
|---------|---------------|----------------------|---------------|
| **OpenMPI** | Full | `WITH_OMPI=ON` | The default backend. Requires the OpenMPI development package.|
| **MPICH** | Full | `WITH_MPICH=ON` | Requires the MPICH development package.|
| **NCCL** | Partial | `WITH_NCCL=ON` | Requires NVIDIA or Iluvatar NCCL. Currently available when `WITH_NVIDIA=ON` or `WITH_ILUVATAR=ON`.|
| **NCCL-compatible** | Partial | `WITH_NCCL=ON` | Uses NCCL on NVIDIA/Iluvatar and the NCCL-compatible RCCL interface on Hygon. |
| **MCCL** | Partial | `WITH_MCCL=ON` | Requires MetaX or Moore MCCL. Currently available when `WITH_METAX=ON` or `WITH_MOORE=ON`.|

</details>
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ if(WITH_NCCL)
target_sources(infiniccl PRIVATE ${NCCL_SRCS})
target_include_directories(infiniccl PRIVATE ${NCCL_INC})
target_link_libraries(infiniccl PRIVATE ${NCCL_LIB})
if(WITH_HYGON)
target_compile_definitions(infiniccl PUBLIC INFINI_CCL_USE_RCCL=1)
endif()
endif()

# MCCL
Expand Down
4 changes: 4 additions & 0 deletions src/backend_device_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ template <>
struct IsSupportedCombination<BackendType::kNccl, Device::Type::kIluvatar>
: std::true_type {};

template <>
struct IsSupportedCombination<BackendType::kNccl, Device::Type::kHygon>
: std::true_type {};

template <>
struct IsSupportedCombination<BackendType::kMccl, Device::Type::kMetax>
: std::true_type {};
Expand Down
3 changes: 1 addition & 2 deletions src/backends/ccl/nccl/api.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#ifndef INFINI_CCL_BACKENDS_CCL_NCCL_API_H_
#define INFINI_CCL_BACKENDS_CCL_NCCL_API_H_

#include <nccl.h>

#include <cstddef>

#include "backends/ccl/common/api.h"
#include "backends/ccl/nccl/vendor.h"
#include "logging.h"
#include "return_status_impl.h"
#include "runtime.h"
Expand Down
3 changes: 1 addition & 2 deletions src/backends/ccl/nccl/checks.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef INFINI_CCL_BACKENDS_CCL_NCCL_CHECKS_H_
#define INFINI_CCL_BACKENDS_CCL_NCCL_CHECKS_H_

#include <nccl.h>

#include <iostream>

#include "backends/ccl/nccl/vendor.h"
#include "return_status_impl.h"

#define INFINI_CHECK_NCCL(result) \
Expand Down
15 changes: 15 additions & 0 deletions src/backends/ccl/nccl/hygon/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef INFINI_CCL_BACKENDS_CCL_NCCL_HYGON_API_H_
#define INFINI_CCL_BACKENDS_CCL_NCCL_HYGON_API_H_

#include "backends/ccl/nccl/api.h"
#include "devices/hygon/runtime_.h"

namespace infini::ccl {

template <>
struct CclApi<BackendType::kNccl, Device::Type::kHygon>
: NcclApi<Device::Type::kHygon> {};

} // namespace infini::ccl

#endif // INFINI_CCL_BACKENDS_CCL_NCCL_HYGON_API_H_
5 changes: 2 additions & 3 deletions src/backends/ccl/nccl/type_map.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#ifndef INFINI_CCL_BACKENDS_CCL_NCCL_TYPE_MAP_H_
#define INFINI_CCL_BACKENDS_CCL_NCCL_TYPE_MAP_H_

#include <nccl.h>

#include "backends/ccl/common/api.h"
#include "backends/ccl/nccl/vendor.h"
#include "comm_impl.h"
#include "data_type_impl.h"
#include "logging.h"

namespace infini::ccl {

#if defined(__CUDA_BF16_TYPES_EXIST__)
#if defined(__CUDA_BF16_TYPES_EXIST__) || defined(RCCL_BFLOAT16)
constexpr ncclDataType_t kNcclBFloat16Val = ncclBfloat16;
#else
constexpr ncclDataType_t kNcclBFloat16Val = ncclNumTypes;
Expand Down
10 changes: 10 additions & 0 deletions src/backends/ccl/nccl/vendor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef INFINI_CCL_BACKENDS_CCL_NCCL_VENDOR_H_
#define INFINI_CCL_BACKENDS_CCL_NCCL_VENDOR_H_

#if defined(INFINI_CCL_USE_RCCL)
#include <rccl/rccl.h>
#else
#include <nccl.h>
#endif

#endif // INFINI_CCL_BACKENDS_CCL_NCCL_VENDOR_H_
Loading