Cycles / CUDA: Better fix for missing sm_52 kernel, in case user compiles himself.
authorThomas Dinges <blender@dingto.org>
Thu, 30 Oct 2014 10:42:59 +0000 (11:42 +0100)
committerThomas Dinges <blender@dingto.org>
Thu, 30 Oct 2014 10:42:59 +0000 (11:42 +0100)
intern/cycles/device/device_cuda.cpp

index 844fb3b8d50cb9c4c424a7dd8fe19fb4b2a3375b..b3d4215e51bee1d63c0d206b3119b2c6ddc4e285 100644 (file)
@@ -203,12 +203,24 @@ public:
                int major, minor;
                cuDeviceComputeCapability(&major, &minor, cuDevId);
                
-               /* workaround to make sm_52 cards work, until we bundle kernel */
-               if(major == 5 && minor == 2)
-                       minor = 0;
+               string cubin;
+
+               /* ToDo: We don't bundle sm_52 kernel yet */
+               if(major == 5 && minor == 2) {
+                       if(experimental)
+                               cubin = path_get(string_printf("lib/kernel_experimental_sm_%d%d.cubin", major, minor));
+                       else
+                               cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor));
+
+                       if(path_exists(cubin))
+                               /* self build sm_52 kernel? Use it. */
+                               return cubin;
+                       else
+                               /* use 5.0 kernel as workaround */
+                               minor = 0;
+               }
 
                /* attempt to use kernel provided with blender */
-               string cubin;
                if(experimental)
                        cubin = path_get(string_printf("lib/kernel_experimental_sm_%d%d.cubin", major, minor));
                else