This is an automated email from the ASF dual-hosted git repository.

lunderberg pushed a commit to branch unity
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/unity by this push:
     new 163c7ac436 [Unity] Cutlass kernel compatibility with cmake 3.18+ 
(#16302)
163c7ac436 is described below

commit 163c7ac43610c958b481e6f39ed97bcc309f8af9
Author: Eric Lunderberg <[email protected]>
AuthorDate: Tue Jan 2 15:26:47 2024 -0600

    [Unity] Cutlass kernel compatibility with cmake 3.18+ (#16302)
    
    The updates to the cutlass kernels made in TVM PR #16244 require
    symbols provided in cuda 7.5+.  While the cuda architecture is
    specified by setting `NVCC_FLAGS` in the `CMakeLists.txt` for each
    kernel, cmake 3.18+ also sets it based on the
    `CMAKE_CUDA_ARCHITECTURES` value.  If not set, cmake will explicitly
    pass the compute capability as nvidia's default of 5.2, *EVEN IF* it
    has already been specified in `NVCC_FLAGS`.  Because the kernels
    cannot compile with compute capability of 5.2, this causes
    compilation errors.
    
    By setting `CMAKE_CUDA_ARCHITECTURES` to `OFF`, cmake does not add
    5.2 as a target architecture.
    
    See https://cmake.org/cmake/help/latest/policy/CMP0104.html for
    details on CMake's policy for CUDA architecture flags.
    
    See https://cmake.org/cmake/help/latest/policy/CMP0104.html for the
    default CUDA architecture for each version of CUDA.
---
 cmake/modules/CUDA.cmake | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/cmake/modules/CUDA.cmake b/cmake/modules/CUDA.cmake
index ce561c66a6..03a79326c8 100644
--- a/cmake/modules/CUDA.cmake
+++ b/cmake/modules/CUDA.cmake
@@ -38,6 +38,28 @@ if(USE_CUDA)
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_CUDA_LIBRARY})
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${CUDA_NVRTC_LIBRARY})
 
+  # Compatibility with cmake 3.18+
+  #
+  # The updates to the cutlass kernels made in TVM PR#16244 require
+  # symbols provided in cuda 7.5+.  While the cuda architecture is
+  # specified by setting `NVCC_FLAGS` in the `CMakeLists.txt` for each
+  # kernel, cmake 3.18+ also sets it based on the
+  # `CMAKE_CUDA_ARCHITECTURES` value.  If not set, cmake will explicitly
+  # pass the compute capability as nvidia's default of 5.2, *EVEN IF* it
+  # has already been specified in `NVCC_FLAGS`.  Because the kernels
+  # cannot compile with compute capability of 5.2, this causes
+  # compilation errors.
+  #
+  # By setting `CMAKE_CUDA_ARCHITECTURES` to `OFF`, cmake does not add
+  # 5.2 as a target architecture.
+  #
+  # See https://cmake.org/cmake/help/latest/policy/CMP0104.html for
+  # details on CMake's policy for CUDA architecture flags.
+  #
+  # See https://cmake.org/cmake/help/latest/policy/CMP0104.html for the
+  # default CUDA architecture for each version of CUDA.
+  set(CMAKE_CUDA_ARCHITECTURES OFF)
+
   if(USE_CUDNN)
     message(STATUS "Build with cuDNN support")
     include_directories(SYSTEM ${CUDA_CUDNN_INCLUDE_DIRS})

Reply via email to