This is an automated email from the ASF dual-hosted git repository. ruihangl pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push: new fe5270956d [CMAKE] Misc improvment of Util (#16900) fe5270956d is described below commit fe5270956de7198bea6bdc53a1bd4202e836b829 Author: Tianqi Chen <tqc...@users.noreply.github.com> AuthorDate: Thu Apr 18 11:51:31 2024 -0400 [CMAKE] Misc improvment of Util (#16900) This PR updates the utils so tvm_option can take in list argument. Also introduces a flag for MSCCLPP. --- CMakeLists.txt | 5 +++-- cmake/config.cmake | 5 +++++ cmake/modules/LibInfo.cmake | 1 + cmake/modules/contrib/MSCCLPP.cmake | 4 ++-- cmake/utils/Utils.cmake | 7 ++----- src/support/libinfo.cc | 5 +++++ 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 435fe3b35b..94b1e4f86f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ endif() # Alernatively, use cmake -DOPTION=VALUE through command-line. tvm_option(USE_CUDA "Build with CUDA" OFF) tvm_option(USE_NCCL "Build with NCCL" OFF) +tvm_option(USE_MSCCL "Build with MSCCL" OFF) tvm_option(USE_OPENCL "Build with OpenCL" OFF) tvm_option(USE_OPENCL_ENABLE_HOST_PTR "Enable OpenCL memory object access to host" OFF) tvm_option(USE_OPENCL_GTEST "Path to OpenCL specific gtest version for runtime cpp tests." /path/to/opencl/gtest) @@ -940,8 +941,8 @@ endif() if(USE_CUDA AND USE_NCCL) find_library(LIBRT rt) - target_link_libraries(tvm PRIVATE nccl msccl ${LIBRT}) - target_link_libraries(tvm_runtime PRIVATE nccl msccl ${LIBRT}) + target_link_libraries(tvm PRIVATE nccl ${LIBRT}) + target_link_libraries(tvm_runtime PRIVATE nccl ${LIBRT}) endif() if(USE_ROCM AND USE_RCCL) diff --git a/cmake/config.cmake b/cmake/config.cmake index 9207204997..ccb449fe2b 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -54,6 +54,11 @@ set(USE_CUDA OFF) # - /path/to/nccl: use specific path to nccl set(USE_NCCL OFF) +# Whether to enable MSCCL support: +# - ON: enable MSCCL +# - OFF: disable MSCCL +set(USE_MSCCL OFF) + # Whether to enable NVTX support (must have USE_CUDA enabled): # - ON: enable NCCL with cmake's auto search # - OFF: disable NCCL diff --git a/cmake/modules/LibInfo.cmake b/cmake/modules/LibInfo.cmake index 6d6b0b0c6e..6c13a42777 100644 --- a/cmake/modules/LibInfo.cmake +++ b/cmake/modules/LibInfo.cmake @@ -72,6 +72,7 @@ function(add_lib_info src_file) TVM_INFO_USE_CUDA="${USE_CUDA}" TVM_INFO_USE_NVTX="${USE_NVTX}" TVM_INFO_USE_NCCL="${USE_NCCL}" + TVM_INFO_USE_MSCCL="${USE_MSCCL}" TVM_INFO_USE_CUDNN="${USE_CUDNN}" TVM_INFO_USE_CUSTOM_LOGGING="${USE_CUSTOM_LOGGING}" TVM_INFO_USE_CUTLASS="${USE_CUTLASS}" diff --git a/cmake/modules/contrib/MSCCLPP.cmake b/cmake/modules/contrib/MSCCLPP.cmake index 5f7dd19890..b12a5c748b 100644 --- a/cmake/modules/contrib/MSCCLPP.cmake +++ b/cmake/modules/contrib/MSCCLPP.cmake @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -if(USE_CUDA AND USE_NCCL) +if(USE_CUDA AND USE_NCCL AND USE_MSCCL) include(FetchContent) FetchContent_Declare( mscclpp @@ -46,5 +46,5 @@ if(USE_CUDA AND USE_NCCL) FILE_SET HEADERS DESTINATION ${INSTALL_PREFIX}/include) install(TARGETS mscclpp EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX}) install(TARGETS msccl EXPORT ${PROJECT_NAME}Targets DESTINATION lib${LIB_SUFFIX}) - + list(APPEND TVM_RUNTIME_LINKER_LIBS msccl) endif() diff --git a/cmake/utils/Utils.cmake b/cmake/utils/Utils.cmake index 3267d6189b..fdd70228f8 100644 --- a/cmake/utils/Utils.cmake +++ b/cmake/utils/Utils.cmake @@ -46,11 +46,8 @@ macro(tvm_option variable description value) if(${__condition}) if("${__value}" MATCHES ";") - if(${__value}) - __tvm_option(${variable} "${description}" ON) - else() - __tvm_option(${variable} "${description}" OFF) - endif() + # list values directly pass through + __tvm_option(${variable} "${description}" "${__value}") elseif(DEFINED ${__value}) if(${__value}) __tvm_option(${variable} "${description}" ON) diff --git a/src/support/libinfo.cc b/src/support/libinfo.cc index 4c863d7dec..de21a76beb 100644 --- a/src/support/libinfo.cc +++ b/src/support/libinfo.cc @@ -47,6 +47,10 @@ #define TVM_INFO_USE_NCCL "NOT-FOUND" #endif +#ifndef TVM_INFO_USE_MSCCLPP +#define TVM_INFO_USE_MSCCLPP "NOT-FOUND" +#endif + #ifndef TVM_INFO_CUDA_VERSION #define TVM_INFO_CUDA_VERSION "NOT-FOUND" #endif @@ -308,6 +312,7 @@ TVM_DLL Map<String, String> GetLibInfo() { {"USE_CUDA", TVM_INFO_USE_CUDA}, {"USE_NVTX", TVM_INFO_USE_NVTX}, {"USE_NCCL", TVM_INFO_USE_NCCL}, + {"USE_MSCCL", TVM_INFO_USE_MSCCL}, {"USE_CUDNN", TVM_INFO_USE_CUDNN}, {"USE_CUSTOM_LOGGING", TVM_INFO_USE_CUSTOM_LOGGING}, {"USE_CUTLASS", TVM_INFO_USE_CUTLASS},