-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[BUILD] Re-enable ccache by default #12839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
fbe81d2
33114f9
841b6b6
9644b40
151346c
d7ba516
a509fb9
dd2bf9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,7 @@ tvm_option(USE_PAPI "Use Performance Application Programming Interface (PAPI) to | |
| tvm_option(USE_GTEST "Use GoogleTest for C++ sanity tests" AUTO) | ||
| tvm_option(USE_CUSTOM_LOGGING "Use user-defined custom logging, tvm::runtime::detail::LogFatalImpl and tvm::runtime::detail::LogMessageImpl must be implemented" OFF) | ||
| tvm_option(USE_ALTERNATIVE_LINKER "Use 'mold' or 'lld' if found when invoking compiler to link artifact" AUTO) | ||
| tvm_option(USE_CCACHE "Use ccache if found when invoking compiler" AUTO) | ||
|
|
||
| # 3rdparty libraries | ||
| tvm_option(DLPACK_PATH "Path to DLPACK" "3rdparty/dlpack/include") | ||
|
|
@@ -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 | ||
driazati marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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) | ||
driazati marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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}") | ||
driazati marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| endif() | ||
| endif() | ||
| endif(USE_CCACHE) | ||
|
|
||
| # Module rules | ||
| include(cmake/modules/VTA.cmake) | ||
| include(cmake/modules/StandaloneCrt.cmake) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spaces after comment
#There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done