Commit: d70b9cf275d9d988c93ba4fbc587a2fdba8c666b
Author: Thomas Dinges
Date:   Thu May 19 16:32:57 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rBd70b9cf275d9d988c93ba4fbc587a2fdba8c666b

Cycles / CUDA: Don't use bundled kernel if Adaptive is enforced by the user.

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

M       intern/cycles/device/device_cuda.cpp

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

diff --git a/intern/cycles/device/device_cuda.cpp 
b/intern/cycles/device/device_cuda.cpp
index 39bb442..7fc6213 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -251,23 +251,26 @@ public:
 
        string compile_kernel(const DeviceRequestedFeatures& requested_features)
        {
-               /* compute cubin name */
+               /* Compute cubin name. */
                int major, minor;
                cuDeviceComputeCapability(&major, &minor, cuDevId);
                string cubin;
 
-               /* adaptive compile */
+               /* Adaptive Compile.
+                * If enabled, always use that */
                bool use_adaptive_compile = use_adaptive_compilation();
 
-               /* attempt to use kernel provided with blender */
-               cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", 
major, minor));
-               VLOG(1) << "Testing for pre-compiled kernel " << cubin;
-               if(path_exists(cubin)) {
-                       VLOG(1) << "Using precompiled kernel";
-                       return cubin;
+               /* Attempt to use kernel provided with Blender. */
+               if(!use_adaptive_compile) {
+                       cubin = 
path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor));
+                       VLOG(1) << "Testing for pre-compiled kernel " << cubin;
+                       if(path_exists(cubin)) {
+                               VLOG(1) << "Using precompiled kernel";
+                               return cubin;
+                       }
                }
 
-               /* not found, try to use locally compiled kernel */
+               /* Try to use locally compiled kernel. */
                string kernel_path = path_get("kernel");
                string md5 = path_files_md5_hash(kernel_path);
 
@@ -286,7 +289,7 @@ public:
 
                cubin = path_user_get(path_join("cache", cubin));
                VLOG(1) << "Testing for locally compiled kernel " << cubin;
-               /* if exists already, use it */
+               /* If exists already, use it. */
                if(path_exists(cubin)) {
                        VLOG(1) << "Using locally compiled kernel";
                        return cubin;
@@ -302,7 +305,7 @@ public:
                }
 #endif
 
-               /* if not, find CUDA compiler */
+               /* If not, find CUDA compiler. */
                const char *nvcc = cuewCompilerPath();
 
                if(nvcc == NULL) {
@@ -324,7 +327,7 @@ public:
                else if(cuda_version != 75)
                        printf("CUDA version %d.%d detected, build may succeed 
but only CUDA 7.5 is officially supported.\n", cuda_version/10, 
cuda_version%10);
 
-               /* compile */
+               /* Compile. */
                string kernel = path_join(kernel_path, path_join("kernels", 
path_join("cuda", "kernel.cu")));
                string include = kernel_path;
                const int machine = system_cpu_bits();
@@ -358,7 +361,7 @@ public:
                        return "";
                }
 
-               /* verify if compilation succeeded */
+               /* Verify if compilation succeeded */
                if(!path_exists(cubin)) {
                        cuda_error_message("CUDA kernel compilation failed, see 
console for details.");
                        return "";

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to