forked from bartvdbraak/blender
Cycles / CUDA: Don't use bundled kernel if Adaptive is enforced by the user.
This commit is contained in:
parent
c5893db5cc
commit
dedc995018
@ -251,23 +251,26 @@ public:
|
|||||||
|
|
||||||
string compile_kernel(const DeviceRequestedFeatures& requested_features)
|
string compile_kernel(const DeviceRequestedFeatures& requested_features)
|
||||||
{
|
{
|
||||||
/* compute cubin name */
|
/* Compute cubin name. */
|
||||||
int major, minor;
|
int major, minor;
|
||||||
cuDeviceComputeCapability(&major, &minor, cuDevId);
|
cuDeviceComputeCapability(&major, &minor, cuDevId);
|
||||||
string cubin;
|
string cubin;
|
||||||
|
|
||||||
/* adaptive compile */
|
/* Adaptive Compile.
|
||||||
|
* If enabled, always use that */
|
||||||
bool use_adaptive_compile = use_adaptive_compilation();
|
bool use_adaptive_compile = use_adaptive_compilation();
|
||||||
|
|
||||||
/* attempt to use kernel provided with blender */
|
/* Attempt to use kernel provided with Blender. */
|
||||||
cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor));
|
if(!use_adaptive_compile) {
|
||||||
VLOG(1) << "Testing for pre-compiled kernel " << cubin;
|
cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor));
|
||||||
if(path_exists(cubin)) {
|
VLOG(1) << "Testing for pre-compiled kernel " << cubin;
|
||||||
VLOG(1) << "Using precompiled kernel";
|
if(path_exists(cubin)) {
|
||||||
return 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 kernel_path = path_get("kernel");
|
||||||
string md5 = path_files_md5_hash(kernel_path);
|
string md5 = path_files_md5_hash(kernel_path);
|
||||||
|
|
||||||
@ -286,7 +289,7 @@ public:
|
|||||||
|
|
||||||
cubin = path_user_get(path_join("cache", cubin));
|
cubin = path_user_get(path_join("cache", cubin));
|
||||||
VLOG(1) << "Testing for locally compiled kernel " << cubin;
|
VLOG(1) << "Testing for locally compiled kernel " << cubin;
|
||||||
/* if exists already, use it */
|
/* If exists already, use it. */
|
||||||
if(path_exists(cubin)) {
|
if(path_exists(cubin)) {
|
||||||
VLOG(1) << "Using locally compiled kernel";
|
VLOG(1) << "Using locally compiled kernel";
|
||||||
return cubin;
|
return cubin;
|
||||||
@ -302,7 +305,7 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if not, find CUDA compiler */
|
/* If not, find CUDA compiler. */
|
||||||
const char *nvcc = cuewCompilerPath();
|
const char *nvcc = cuewCompilerPath();
|
||||||
|
|
||||||
if(nvcc == NULL) {
|
if(nvcc == NULL) {
|
||||||
@ -324,7 +327,7 @@ public:
|
|||||||
else if(cuda_version != 75)
|
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);
|
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 kernel = path_join(kernel_path, path_join("kernels", path_join("cuda", "kernel.cu")));
|
||||||
string include = kernel_path;
|
string include = kernel_path;
|
||||||
const int machine = system_cpu_bits();
|
const int machine = system_cpu_bits();
|
||||||
@ -358,7 +361,7 @@ public:
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* verify if compilation succeeded */
|
/* Verify if compilation succeeded */
|
||||||
if(!path_exists(cubin)) {
|
if(!path_exists(cubin)) {
|
||||||
cuda_error_message("CUDA kernel compilation failed, see console for details.");
|
cuda_error_message("CUDA kernel compilation failed, see console for details.");
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
Reference in New Issue
Block a user