Build: add ccache support for CUDA kernels on Linux

This commit is contained in:
Brecht Van Lommel
2021-10-05 14:53:27 +02:00
parent 18c6314e26
commit 03f8c1abd0

View File

@@ -404,16 +404,27 @@ if(WITH_CYCLES_CUDA_BINARIES)
-cuda-toolkit-dir "${cuda_toolkit_root_dir}" -cuda-toolkit-dir "${cuda_toolkit_root_dir}"
DEPENDS ${kernel_sources} cycles_cubin_cc) DEPENDS ${kernel_sources} cycles_cubin_cc)
else() else()
add_custom_command( set(_cuda_nvcc_args
OUTPUT ${cuda_file}
COMMAND ${cuda_nvcc_executable}
-arch=${arch} -arch=${arch}
${CUDA_NVCC_FLAGS} ${CUDA_NVCC_FLAGS}
--${format} --${format}
${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src} ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
--ptxas-options="-v" --ptxas-options="-v"
${cuda_flags} ${cuda_flags})
DEPENDS ${kernel_sources})
if(WITH_COMPILER_CCACHE AND CCACHE_PROGRAM)
add_custom_command(
OUTPUT ${cuda_file}
COMMAND ${CCACHE_PROGRAM} ${cuda_nvcc_executable} ${_cuda_nvcc_args}
DEPENDS ${kernel_sources})
else()
add_custom_command(
OUTPUT ${cuda_file}
COMMAND ${cuda_nvcc_executable} ${_cuda_nvcc_args}
DEPENDS ${kernel_sources})
endif()
unset(_cuda_nvcc_args)
endif() endif()
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_file}" ${CYCLES_INSTALL_PATH}/lib) delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_file}" ${CYCLES_INSTALL_PATH}/lib)
list(APPEND cuda_cubins ${cuda_file}) list(APPEND cuda_cubins ${cuda_file})