diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-04 18:35:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-04 18:35:16 +0300 |
commit | b9b88d59ddde50bd1de1f7f96b1c91cbdaf7497b (patch) | |
tree | 763faa6c9a34be6d3e7539e2a02ee38240ec7be5 /intern/cycles/kernel | |
parent | cf2e35fcfe31aa2c1836f51d1206901b4be6aeba (diff) | |
parent | f63da3dcf59f87b34aa916b2c65ce5a40a48fd92 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 28 | ||||
-rw-r--r-- | intern/cycles/kernel/kernels/cuda/kernel_config.h | 18 |
2 files changed, 36 insertions, 10 deletions
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index d4145225b77..73ff7aeda15 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -343,11 +343,11 @@ if(WITH_CYCLES_CUDA_BINARIES) set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}") # warn for other versions - if(CUDA_VERSION MATCHES "90" OR CUDA_VERSION MATCHES "91") + if(CUDA_VERSION MATCHES "90" OR CUDA_VERSION MATCHES "91" OR CUDA_VERSION MATCHES "100") else() message(WARNING "CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, " - "build may succeed but only CUDA 9.0 and 9.1 are officially supported") + "build may succeed but only CUDA 9.0, 9.1 and 10.0 are officially supported") endif() # build for each arch @@ -397,17 +397,29 @@ if(WITH_CYCLES_CUDA_BINARIES) set(cuda_flags ${cuda_flags} -D __KERNEL_DEBUG__) endif() - if(WITH_CYCLES_CUBIN_COMPILER) + # Workaround to build only sm_7x kernels with CUDA 10, until + # older kernels work well with this version. + if(DEFINED CUDA10_NVCC_EXECUTABLE AND (${arch} MATCHES "sm_7.")) + set(with_cubin_compiler OFF) + set(cuda_nvcc_executable "${CUDA10_NVCC_EXECUTABLE}") + set(cuda_toolkit_root_dir "${CUDA10_TOOLKIT_ROOT_DIR}") + else() + set(with_cubin_compiler ${WITH_CYCLES_CUBIN_COMPILER}) + set(cuda_nvcc_executable "${CUDA_NVCC_EXECUTABLE}") + set(cuda_toolkit_root_dir "${CUDA_TOOLKIT_ROOT_DIR}") + endif() + + if(with_cubin_compiler) string(SUBSTRING ${arch} 3 -1 CUDA_ARCH) # Needed to find libnvrtc-builtins.so. Can't do it from inside # cycles_cubin_cc since the env variable is read before main() if(APPLE) set(CUBIN_CC_ENV ${CMAKE_COMMAND} - -E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib") + -E env DYLD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib") elseif(UNIX) set(CUBIN_CC_ENV ${CMAKE_COMMAND} - -E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64") + -E env LD_LIBRARY_PATH="${cuda_toolkit_root_dir}/lib64") endif() add_custom_command( @@ -418,12 +430,12 @@ if(WITH_CYCLES_CUDA_BINARIES) -i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src} ${cuda_flags} -v - -cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}" + -cuda-toolkit-dir "${cuda_toolkit_root_dir}" DEPENDS ${kernel_sources} cycles_cubin_cc) else() add_custom_command( OUTPUT ${cuda_cubin} - COMMAND ${CUDA_NVCC_EXECUTABLE} + COMMAND ${cuda_nvcc_executable} -arch=${arch} ${CUDA_NVCC_FLAGS} --cubin @@ -442,6 +454,8 @@ if(WITH_CYCLES_CUDA_BINARIES) foreach(arch ${CYCLES_CUDA_BINARIES_ARCH}) if(${arch} MATCHES "sm_2.") message(STATUS "CUDA binaries for ${arch} are no longer supported, skipped.") + elseif(${arch} MATCHES "sm_7." AND NOT (${CUDA_VERSION} VERSION_GREATER_EQUAL 10.0)) + message(STATUS "CUDA binaries for ${arch} require CUDA 10.0+, skipped.") else() # Compile regular kernel CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} filter "" "${cuda_filter_sources}" FALSE) diff --git a/intern/cycles/kernel/kernels/cuda/kernel_config.h b/intern/cycles/kernel/kernels/cuda/kernel_config.h index 3808898c5ca..6d41dc15785 100644 --- a/intern/cycles/kernel/kernels/cuda/kernel_config.h +++ b/intern/cycles/kernel/kernels/cuda/kernel_config.h @@ -52,8 +52,8 @@ # define CUDA_KERNEL_MAX_REGISTERS 63 # define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 63 -/* 5.0, 5.2, 5.3, 6.0, 6.1 */ -#elif __CUDA_ARCH__ >= 500 +/* 5.x, 6.x */ +#elif __CUDA_ARCH__ <= 699 # define CUDA_MULTIPRESSOR_MAX_REGISTERS 65536 # define CUDA_MULTIPROCESSOR_MAX_BLOCKS 32 # define CUDA_BLOCK_MAX_THREADS 1024 @@ -62,13 +62,25 @@ /* tunable parameters */ # define CUDA_THREADS_BLOCK_WIDTH 16 /* CUDA 9.0 seems to cause slowdowns on high-end Pascal cards unless we increase the number of registers */ -# if __CUDACC_VER_MAJOR__ == 9 && __CUDA_ARCH__ >= 600 +# if __CUDACC_VER_MAJOR__ >= 9 && __CUDA_ARCH__ >= 600 # define CUDA_KERNEL_MAX_REGISTERS 64 # else # define CUDA_KERNEL_MAX_REGISTERS 48 # endif # define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 63 +/* 7.x */ +#elif __CUDA_ARCH__ <= 799 +# define CUDA_MULTIPRESSOR_MAX_REGISTERS 65536 +# define CUDA_MULTIPROCESSOR_MAX_BLOCKS 32 +# define CUDA_BLOCK_MAX_THREADS 1024 +# define CUDA_THREAD_MAX_REGISTERS 255 + +/* tunable parameters */ +# define CUDA_THREADS_BLOCK_WIDTH 16 +# define CUDA_KERNEL_MAX_REGISTERS 64 +# define CUDA_KERNEL_BRANCHED_MAX_REGISTERS 72 + /* unknown architecture */ #else |