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

lunderberg 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 56bdcee750 [CMake] Use ccache as CMAKE_CUDA_COMPILER_LAUNCHER (#16341)
56bdcee750 is described below

commit 56bdcee7507603eda2b0ae8034d56478001f9adf
Author: Eric Lunderberg <[email protected]>
AuthorDate: Thu Jan 4 11:00:13 2024 -0600

    [CMake] Use ccache as CMAKE_CUDA_COMPILER_LAUNCHER (#16341)
    
    For older versions of `ccache` that do not support `nvcc`, this has no
    effect.  For newer versions of `ccache`, this enables caching the
    compiled `nvcc` outputs.  This was tested using `ccache` versions
    3.7.7 (does not cache `nvcc` output) and 4.8.3 (caches `nvcc` output).
    
    This is primarily intended to reduce compilation time of cutlass
    kernels, which can take several minutes after switching branches.
---
 cmake/utils/CCache.cmake | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/cmake/utils/CCache.cmake b/cmake/utils/CCache.cmake
index 446542b4b0..55fa069af4 100644
--- a/cmake/utils/CCache.cmake
+++ b/cmake/utils/CCache.cmake
@@ -16,12 +16,28 @@
 # under the License.
 
 if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
-  if(DEFINED CMAKE_CXX_COMPILER_LAUNCHER OR DEFINED CMAKE_C_COMPILER_LAUNCHER)
+
+  if(DEFINED CMAKE_C_COMPILER_LAUNCHER)
+    if("${USE_CCACHE}" STREQUAL "AUTO")
+      message(STATUS "CMAKE_C_COMPILER_LAUNCHER already defined.  Not using 
ccache.")
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      message(FATAL_ERROR "CMAKE_C_COMPILER_LAUNCHER already defined.  
Refusing to override with ccache. Either unset or disable ccache.")
+    endif()
+
+  elseif(DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
     if("${USE_CCACHE}" STREQUAL "AUTO")
-      message(STATUS "CMAKE_CXX_COMPILER_LAUNCHER or CMAKE_C_COMPILER_LAUNCHER 
already defined, not using ccache")
+      message(STATUS "CMAKE_CXX_COMPILER_LAUNCHER already defined.  Not using 
ccache.")
     elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
-      message(FATAL_ERROR "CMAKE_CXX_COMPILER_LAUNCHER or 
CMAKE_C_COMPILER_LAUNCHER is already defined, refusing to override with ccache. 
Either unset or disable ccache.")
+      message(FATAL_ERROR "CMAKE_CXX_COMPILER_LAUNCHER already defined.  
Refusing to override with ccache. Either unset or disable ccache.")
     endif()
+
+  elseif(DEFINED CMAKE_CUDA_COMPILER_LAUNCHER)
+    if("${USE_CCACHE}" STREQUAL "AUTO")
+      message(STATUS "CMAKE_CUDA_COMPILER_LAUNCHER already defined.  Not using 
ccache.")
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      message(FATAL_ERROR "CMAKE_CUDA_COMPILER_LAUNCHER already defined.  
Refusing to override with ccache. Either unset or disable ccache.")
+    endif()
+
   else()
     if("${USE_CCACHE}" STREQUAL "AUTO") # Auto mode
       find_program(CCACHE_FOUND "ccache")
@@ -47,6 +63,7 @@ if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
     if(DEFINED PATH_TO_CCACHE)
       set(CMAKE_CXX_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")
       set(CMAKE_C_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")
+      set(CMAKE_CUDA_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")
     endif()
   endif()
 endif(USE_CCACHE)

Reply via email to