You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/09/19 18:23:25 UTC

[GitHub] [tvm] tkonolige opened a new pull request, #12839: [BUILD] Re-enable ccache by default

tkonolige opened a new pull request, #12839:
URL: https://github.com/apache/tvm/pull/12839

   Previously ccache was disabled because of possible issues with hexagon. Re-enabling it to provide a best effort attempt at using it.
   
   @driazati @cconvey 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974749561


##########
cmake/utils/CCache.cmake:
##########
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)

Review Comment:
   https://cmake.org/cmake/help/latest/prop_tgt/LANG_COMPILER_LAUNCHER.html. It appears to be CXX_COMPILER_LAUNCHER



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] driazati commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
driazati commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974555026


##########
CMakeLists.txt:
##########
@@ -460,6 +460,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache

Review Comment:
   this should be a `tvm_option` that defaults to `auto`



##########
CMakeLists.txt:
##########
@@ -460,6 +460,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+  else()
+    if("${USE_CCACHE}" STREQUAL "AUTO") # Auto mode
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(FATAL_ERROR "Cannot find ccache. Set USE_CCACHE mode to AUTO or OFF to build without ccache. USE_CCACHE=" "${USE_CCACHE}")
+      endif(CCACHE_FOUND)
+    else() # /path/to/ccache
+      set(PATH_TO_CCACHE USE_CCACHE)
+      message(STATUS "Setting ccache path to " "${PATH_TO_CCACHE}")
+    endif()
+    # Set the flag for ccache
+    if(DEFINED PATH_TO_CCACHE)
+      set(CXX_COMPILER_LAUNCHER PATH_TO_CCACHE)
+      set(C_COMPILER_LAUNCHER PATH_TO_CCACHE)

Review Comment:
   I think these set `C_COMPILER_LAUNCHER` to the text `PATH_TO_CCACHE`, not the contents of the variable



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] driazati commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
driazati commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974747296


##########
cmake/utils/Summary.cmake:
##########
@@ -42,6 +42,7 @@ macro(print_summary)
     message(STATUS "  C++ compiler ID       : ${CMAKE_CXX_COMPILER_ID}")
     message(STATUS "  C++ compiler version  : ${CMAKE_CXX_COMPILER_VERSION}")
     message(STATUS "  CXX flags             : ${CMAKE_CXX_FLAGS}")
+    message(STATUS "  CXX launcher          : ${CMAKE_CXX_LAUNCHER}")

Review Comment:
   ```suggestion
       message(STATUS "  CXX launcher          : ${CMAKE_CXX_COMPILER_LAUNCHER}")
   ```



##########
cmake/utils/CCache.cmake:
##########
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)

Review Comment:
   also have no idea how cmake works but aren't these vars supposed to have the `CMAKE_` prefix everywhere?
   ```suggestion
     if(DEFINED CMAKE_CXX_COMPILER_LAUNCHER OR DEFINED CMAKE_C_COMPILER_LAUNCHER)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974697678


##########
CMakeLists.txt:
##########
@@ -460,6 +461,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] driazati commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
driazati commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974701082


##########
CMakeLists.txt:
##########
@@ -460,6 +461,46 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+# Caches the build.

Review Comment:
   organizational nit: can we move this into something like `cmake/ccache.cmake` and `include` it here instead?



##########
CMakeLists.txt:
##########
@@ -460,6 +461,46 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+# Caches the build.
+# Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+# need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    if("${USE_CCACHE}" STREQUAL "AUTO")
+      message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      message(FATAL_ERROR "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER is 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)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(FATAL_ERROR "Cannot find ccache. Set USE_CCACHE mode to AUTO or OFF to build without ccache. USE_CCACHE=" "${USE_CCACHE}")
+      endif(CCACHE_FOUND)
+    else() # /path/to/ccache
+      set(PATH_TO_CCACHE USE_CCACHE)
+      message(STATUS "Setting ccache path to " "${PATH_TO_CCACHE}")
+    endif()
+    # Set the flag for ccache
+    if(DEFINED PATH_TO_CCACHE)
+      set(CXX_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")
+      set(C_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")

Review Comment:
   can you add both of these vars to the header in `Summary.cmake` too?



##########
CMakeLists.txt:
##########
@@ -460,6 +461,46 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+# Caches the build.
+# Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+# need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    if("${USE_CCACHE}" STREQUAL "AUTO")
+      message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      message(FATAL_ERROR "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER is 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)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(FATAL_ERROR "Cannot find ccache. Set USE_CCACHE mode to AUTO or OFF to build without ccache. USE_CCACHE=" "${USE_CCACHE}")
+      endif(CCACHE_FOUND)
+    else() # /path/to/ccache
+      set(PATH_TO_CCACHE USE_CCACHE)

Review Comment:
   same error with text substitution 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] areusch merged pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
areusch merged PR #12839:
URL: https://github.com/apache/tvm/pull/12839


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] areusch commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
areusch commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974685597


##########
CMakeLists.txt:
##########
@@ -460,6 +461,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.

Review Comment:
   nit: spaces after comment `#`



##########
CMakeLists.txt:
##########
@@ -460,6 +461,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")

Review Comment:
   should this be ERROR if USE_CCACHE is on?



##########
CMakeLists.txt:
##########
@@ -460,6 +461,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+  else()
+    if("${USE_CCACHE}" STREQUAL "AUTO") # Auto mode
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})

Review Comment:
   possible to collapse this with the previous if case?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974692999


##########
CMakeLists.txt:
##########
@@ -460,6 +461,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+  else()
+    if("${USE_CCACHE}" STREQUAL "AUTO") # Auto mode
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})

Review Comment:
   I think the logic is clearer this way.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on PR #12839:
URL: https://github.com/apache/tvm/pull/12839#issuecomment-1251640870

   @KOLANICH we don't want to add any unnecessary dependencies.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974745551


##########
CMakeLists.txt:
##########
@@ -460,6 +461,46 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+# Caches the build.
+# Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+# need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    if("${USE_CCACHE}" STREQUAL "AUTO")
+      message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      message(FATAL_ERROR "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER is 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)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(FATAL_ERROR "Cannot find ccache. Set USE_CCACHE mode to AUTO or OFF to build without ccache. USE_CCACHE=" "${USE_CCACHE}")
+      endif(CCACHE_FOUND)
+    else() # /path/to/ccache
+      set(PATH_TO_CCACHE USE_CCACHE)

Review Comment:
   done, though it seems to work anyways? I have no clue how cmake works...



##########
CMakeLists.txt:
##########
@@ -460,6 +461,46 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+# Caches the build.
+# Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+# need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    if("${USE_CCACHE}" STREQUAL "AUTO")
+      message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      message(FATAL_ERROR "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER is 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)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(FATAL_ERROR "Cannot find ccache. Set USE_CCACHE mode to AUTO or OFF to build without ccache. USE_CCACHE=" "${USE_CCACHE}")
+      endif(CCACHE_FOUND)
+    else() # /path/to/ccache
+      set(PATH_TO_CCACHE USE_CCACHE)
+      message(STATUS "Setting ccache path to " "${PATH_TO_CCACHE}")
+    endif()
+    # Set the flag for ccache
+    if(DEFINED PATH_TO_CCACHE)
+      set(CXX_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")
+      set(C_COMPILER_LAUNCHER "${PATH_TO_CCACHE}")

Review Comment:
   added



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974682638


##########
CMakeLists.txt:
##########
@@ -460,6 +460,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache

Review Comment:
   done



##########
CMakeLists.txt:
##########
@@ -460,6 +460,42 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+#Caches the build.
+#Note that ccache-3.x doesn't support nvcc well, so CUDA kernels may never hit the cache and still
+#need to be re-compiled every time. Using ccache 4.0+ can resolve this issue.
+
+if(USE_CCACHE) # True for AUTO, ON, /path/to/ccache
+  if(DEFINED CXX_COMPILER_LAUNCHER OR DEFINED C_COMPILER_LAUNCHER)
+    message(STATUS "CXX_COMPILER_LAUNCHER or C_COMPILER_LAUNCHER already defined, not using ccache")
+  else()
+    if("${USE_CCACHE}" STREQUAL "AUTO") # Auto mode
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(STATUS "Didn't find the path to CCACHE, disabling ccache")
+      endif(CCACHE_FOUND)
+    elseif("${USE_CCACHE}" MATCHES ${IS_TRUE_PATTERN})
+      find_program(CCACHE_FOUND ccache)
+      if(CCACHE_FOUND)
+        message(STATUS "Found the path to ccache, enabling ccache")
+        set(PATH_TO_CCACHE ccache)
+      else()
+        message(FATAL_ERROR "Cannot find ccache. Set USE_CCACHE mode to AUTO or OFF to build without ccache. USE_CCACHE=" "${USE_CCACHE}")
+      endif(CCACHE_FOUND)
+    else() # /path/to/ccache
+      set(PATH_TO_CCACHE USE_CCACHE)
+      message(STATUS "Setting ccache path to " "${PATH_TO_CCACHE}")
+    endif()
+    # Set the flag for ccache
+    if(DEFINED PATH_TO_CCACHE)
+      set(CXX_COMPILER_LAUNCHER PATH_TO_CCACHE)
+      set(C_COMPILER_LAUNCHER PATH_TO_CCACHE)

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] KOLANICH commented on pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
KOLANICH commented on PR #12839:
URL: https://github.com/apache/tvm/pull/12839#issuecomment-1251597134

   BTW, why not to use an external module?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tkonolige commented on a diff in pull request #12839: [BUILD] Re-enable ccache by default

Posted by GitBox <gi...@apache.org>.
tkonolige commented on code in PR #12839:
URL: https://github.com/apache/tvm/pull/12839#discussion_r974745429


##########
CMakeLists.txt:
##########
@@ -460,6 +461,46 @@ if(USE_PIPELINE_EXECUTOR)
   list(APPEND RUNTIME_SRCS ${RUNTIME_PIPELINE_SRCS})
 endif(USE_PIPELINE_EXECUTOR)
 
+# Caches the build.

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org