[Bf-blender-cvs] [94caae98173] cycles-x: Cleanup: fix various warnings when building CUDA/OptiX kernels

Brecht Van Lommel noreply at git.blender.org
Thu Jun 3 18:25:00 CEST 2021


Commit: 94caae981738a913cfae1470569e53bf53a9e073
Author: Brecht Van Lommel
Date:   Thu Jun 3 18:12:32 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB94caae981738a913cfae1470569e53bf53a9e073

Cleanup: fix various warnings when building CUDA/OptiX kernels

===================================================================

M	intern/cycles/device/cuda/device_impl.cpp
M	intern/cycles/kernel/CMakeLists.txt
M	intern/cycles/kernel/device/optix/globals.h
M	intern/cycles/kernel/kernel_random.h

===================================================================

diff --git a/intern/cycles/device/cuda/device_impl.cpp b/intern/cycles/device/cuda/device_impl.cpp
index 951220395b6..c57ad2abade 100644
--- a/intern/cycles/device/cuda/device_impl.cpp
+++ b/intern/cycles/device/cuda/device_impl.cpp
@@ -351,7 +351,8 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
         nvcc_cuda_version % 10);
     return string();
   }
-  else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102)) {
+  else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102 || nvcc_cuda_version == 111 ||
+             nvcc_cuda_version == 112 || nvcc_cuda_version == 113)) {
     printf(
         "CUDA version %d.%d detected, build may succeed but only "
         "CUDA 10.1 and 10.2 are officially supported.\n",
@@ -455,7 +456,7 @@ bool CUDADevice::load_kernels(const DeviceRequestedFeatures &requested_features)
   return (result == CUDA_SUCCESS);
 }
 
-void CUDADevice::reserve_local_memory(const DeviceRequestedFeatures &requested_features)
+void CUDADevice::reserve_local_memory(const DeviceRequestedFeatures & /* requested_features */)
 {
   /* Together with CU_CTX_LMEM_RESIZE_TO_MAX, this reserves local memory
    * needed for kernel launches, so that we can reliably figure out when
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 756f943eed0..dbb8817e174 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -317,11 +317,15 @@ if(WITH_CYCLES_CUDA_BINARIES)
   set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
 
   # warn for other versions
-  if((CUDA_VERSION MATCHES "101") OR (CUDA_VERSION MATCHES "102") OR (CUDA_VERSION MATCHES "111"))
+  if((CUDA_VERSION MATCHES "101") OR
+     (CUDA_VERSION MATCHES "102") OR
+     (CUDA_VERSION MATCHES "111") OR
+     (CUDA_VERSION MATCHES "112") OR
+     (CUDA_VERSION MATCHES "113"))
   else()
     message(WARNING
       "CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
-      "build may succeed but only CUDA 10.1, 10.2 and 11.1 are officially supported")
+      "build may succeed but only CUDA 10.1 to 11.3 are officially supported")
   endif()
 
   # build for each arch
@@ -477,6 +481,7 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
       -I "${CMAKE_CURRENT_SOURCE_DIR}/.."
       -I "${CMAKE_CURRENT_SOURCE_DIR}/device/cuda"
       --use_fast_math
+      -Wno-deprecated-gpu-targets
       -o ${output})
 
     if(WITH_NANOVDB)
diff --git a/intern/cycles/kernel/device/optix/globals.h b/intern/cycles/kernel/device/optix/globals.h
index 5290441038b..7d898ed5d91 100644
--- a/intern/cycles/kernel/device/optix/globals.h
+++ b/intern/cycles/kernel/device/optix/globals.h
@@ -47,7 +47,7 @@ struct KernelParamsOptiX {
 };
 
 #ifdef __NVCC__
-extern "C" __constant__ KernelParamsOptiX __params;
+extern "C" static __constant__ KernelParamsOptiX __params;
 #endif
 
 /* Abstraction macros */
diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h
index 372344bc46a..4609aad395c 100644
--- a/intern/cycles/kernel/kernel_random.h
+++ b/intern/cycles/kernel/kernel_random.h
@@ -121,6 +121,8 @@ ccl_device_inline uint path_rng_hash_init(const KernelGlobals *ccl_restrict kg,
 
 #ifdef __DEBUG_CORRELATION__
   srand48(rng_hash + sample);
+#else
+  (void)sample;
 #endif
 
   return rng_hash;



More information about the Bf-blender-cvs mailing list