Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2016-05-06 23:34:15 +0300
committerThomas Dinges <blender@dingto.org>2016-05-07 00:13:33 +0300
commit734d1aec3f93b8757533284330afc2ac651442bd (patch)
tree98bbf8ea18392b09355c8b041b7727f9af88b2c4 /intern/cycles/device/device_cuda.cpp
parentbd335f13fe3d25e8e6bb472acb9c727d1629e582 (diff)
Cycles: Make CUDA adaptive feature compile a Debug flag.
If the CUDA Toolkit is installed and the user is on Linux, adaptive, feature based CUDA runtime compile is now possible to enable via: * Environment flag CYCLES_CUDA_ADAPTIVE_COMPILE or * Debug menu (Debug value 256) in the Cycles UI.
Diffstat (limited to 'intern/cycles/device/device_cuda.cpp')
-rw-r--r--intern/cycles/device/device_cuda.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index f7c985e787d..5362623247f 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -41,11 +41,6 @@
#include "util_types.h"
#include "util_time.h"
-/* use feature-adaptive kernel compilation.
- * Requires CUDA toolkit to be installed and currently only works on Linux.
- */
-/* #define KERNEL_USE_ADAPTIVE */
-
CCL_NAMESPACE_BEGIN
#ifndef WITH_CUDA_DYNLOAD
@@ -245,6 +240,11 @@ public:
return true;
}
+ bool use_adaptive_compilation()
+ {
+ return DebugFlags().cuda.adaptive_compile;
+ }
+
string compile_kernel(const DeviceRequestedFeatures& requested_features)
{
/* compute cubin name */
@@ -252,6 +252,9 @@ public:
cuDeviceComputeCapability(&major, &minor, cuDevId);
string cubin;
+ /* adaptive compile */
+ 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;
@@ -264,17 +267,19 @@ public:
string kernel_path = path_get("kernel");
string md5 = path_files_md5_hash(kernel_path);
-#ifdef KERNEL_USE_ADAPTIVE
- string feature_build_options = requested_features.get_build_options();
- string device_md5 = util_md5_string(feature_build_options);
- cubin = string_printf("cycles_kernel_%s_sm%d%d_%s.cubin",
- device_md5.c_str(),
- major, minor,
- md5.c_str());
-#else
- (void)requested_features;
- cubin = string_printf("cycles_kernel_sm%d%d_%s.cubin", major, minor, md5.c_str());
-#endif
+ string feature_build_options;
+ if(use_adaptive_compile) {
+ feature_build_options = requested_features.get_build_options();
+ string device_md5 = util_md5_string(feature_build_options);
+ cubin = string_printf("cycles_kernel_%s_sm%d%d_%s.cubin",
+ device_md5.c_str(),
+ major, minor,
+ md5.c_str());
+ }
+ else {
+ (void)requested_features;
+ cubin = string_printf("cycles_kernel_sm%d%d_%s.cubin", major, minor, md5.c_str());
+ }
cubin = path_user_get(path_join("cache", cubin));
VLOG(1) << "Testing for locally compiled kernel " << cubin;
@@ -331,9 +336,8 @@ public:
"-DNVCC -D__KERNEL_CUDA_VERSION__=%d",
nvcc, major, minor, machine, kernel.c_str(), cubin.c_str(), include.c_str(), cuda_version);
-#ifdef KERNEL_USE_ADAPTIVE
- command += " " + feature_build_options;
-#endif
+ if(use_adaptive_compile)
+ command += " " + feature_build_options;
const char* extra_cflags = getenv("CYCLES_CUDA_EXTRA_CFLAGS");
if(extra_cflags) {