[Bf-blender-cvs] [88031d2daf1] cycles-x: Cycles X: Better handling of missing CUDA kernel functions

Sergey Sharybin noreply at git.blender.org
Thu Jun 3 14:42:24 CEST 2021


Commit: 88031d2daf15a03f47a667b54e72f8aadd623035
Author: Sergey Sharybin
Date:   Thu Jun 3 10:53:12 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB88031d2daf15a03f47a667b54e72f8aadd623035

Cycles X: Better handling of missing CUDA kernel functions

Log missing function and avoid crash.

Differential Revision: https://developer.blender.org/D11472

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

M	intern/cycles/device/cuda/kernel.cpp

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

diff --git a/intern/cycles/device/cuda/kernel.cpp b/intern/cycles/device/cuda/kernel.cpp
index d31b903f969..8026715d7b3 100644
--- a/intern/cycles/device/cuda/kernel.cpp
+++ b/intern/cycles/device/cuda/kernel.cpp
@@ -37,12 +37,18 @@ void CUDADeviceKernels::load(CUDADevice *device)
                                       device_kernel_as_string((DeviceKernel)i);
     cuda_device_assert(device,
                        cuModuleGetFunction(&kernel.function, cuModule, function_name.c_str()));
-    cuda_device_assert(device, cuFuncSetCacheConfig(kernel.function, CU_FUNC_CACHE_PREFER_L1));
 
-    cuda_device_assert(
-        device,
-        cuOccupancyMaxPotentialBlockSize(
-            &kernel.min_blocks, &kernel.num_threads_per_block, kernel.function, NULL, 0, 0));
+    if (kernel.function) {
+      cuda_device_assert(device, cuFuncSetCacheConfig(kernel.function, CU_FUNC_CACHE_PREFER_L1));
+
+      cuda_device_assert(
+          device,
+          cuOccupancyMaxPotentialBlockSize(
+              &kernel.min_blocks, &kernel.num_threads_per_block, kernel.function, NULL, 0, 0));
+    }
+    else {
+      LOG(ERROR) << "Unable to load kernel " << function_name;
+    }
   }
 
   loaded = true;



More information about the Bf-blender-cvs mailing list