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:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-01-12 14:00:48 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-01-12 14:21:30 +0300
commitac7aefd7c2bc0e87b2787e374d414f18b7887baa (patch)
tree9dddc76953051052793639d4d59a934d1e97f250 /intern/cycles/device
parentc6c223ade6470e7a9b61ea4a4a3ab6ed62abe79d (diff)
Cycles: Use special debug panel to fine-tune debug flags
This panel is only visible when debug_value is set to 256 and has no affect in other cases. However, if debug value is not set to this value, environment variables will be used to control which features are enabled, so there's no visible changes to anyone in fact. There are some changes needed to prevent devices re-enumeration on every Cycles session create. Reviewers: juicyfruit, lukasstockner97, dingto, brecht Reviewed By: lukasstockner97, dingto Differential Revision: https://developer.blender.org/D1720
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/device.cpp21
-rw-r--r--intern/cycles/device/device.h7
-rw-r--r--intern/cycles/device/device_cpu.cpp62
-rw-r--r--intern/cycles/device/device_opencl.cpp33
4 files changed, 72 insertions, 51 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 929f810eaa1..fd52b11c06d 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -32,6 +32,9 @@
CCL_NAMESPACE_BEGIN
+bool Device::need_types_update = true;
+bool Device::need_devices_update = true;
+
/* Device Requested Features */
std::ostream& operator <<(std::ostream &os,
@@ -278,9 +281,9 @@ string Device::string_from_type(DeviceType type)
vector<DeviceType>& Device::available_types()
{
static vector<DeviceType> types;
- static bool types_init = false;
- if(!types_init) {
+ if(need_types_update) {
+ types.clear();
types.push_back(DEVICE_CPU);
#ifdef WITH_CUDA
@@ -300,7 +303,7 @@ vector<DeviceType>& Device::available_types()
types.push_back(DEVICE_MULTI);
#endif
- types_init = true;
+ need_types_update = false;
}
return types;
@@ -309,9 +312,9 @@ vector<DeviceType>& Device::available_types()
vector<DeviceInfo>& Device::available_devices()
{
static vector<DeviceInfo> devices;
- static bool devices_init = false;
- if(!devices_init) {
+ if(need_types_update) {
+ devices.clear();
#ifdef WITH_CUDA
if(device_cuda_init())
device_cuda_info(devices);
@@ -332,7 +335,7 @@ vector<DeviceInfo>& Device::available_devices()
device_network_info(devices);
#endif
- devices_init = true;
+ need_types_update = false;
}
return devices;
@@ -359,4 +362,10 @@ string Device::device_capabilities()
return capabilities;
}
+void Device::tag_update()
+{
+ need_types_update = true;
+ need_devices_update = true;
+}
+
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 9324f5c7069..c53cd888775 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -265,6 +265,13 @@ public:
static vector<DeviceType>& available_types();
static vector<DeviceInfo>& available_devices();
static string device_capabilities();
+
+ /* Tag devices lists for update. */
+ static void tag_update();
+
+private:
+ /* Indicted whether device types and devices lists were initialized. */
+ static bool need_types_update, need_devices_update;
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 1d570893d36..3241f32e006 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -78,6 +78,40 @@ public:
system_cpu_support_sse41();
system_cpu_support_avx();
system_cpu_support_avx2();
+
+#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
+ if(system_cpu_support_avx2()) {
+ VLOG(1) << "Will be using AVX2 kernels.";
+ }
+ else
+#endif
+#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
+ if(system_cpu_support_avx()) {
+ VLOG(1) << "Will be using AVX kernels.";
+ }
+ else
+#endif
+#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
+ if(system_cpu_support_sse41()) {
+ VLOG(1) << "Will be using SSE4.1 kernels.";
+ }
+ else
+#endif
+#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
+ if(system_cpu_support_sse3()) {
+ VLOG(1) << "Will be using SSE3kernels.";
+ }
+ else
+#endif
+#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
+ if(system_cpu_support_sse2()) {
+ VLOG(1) << "Will be using SSE2 kernels.";
+ }
+ else
+#endif
+ {
+ VLOG(1) << "Will be using regular kernels.";
+ }
}
~CPUDevice()
@@ -181,8 +215,6 @@ public:
void thread_path_trace(DeviceTask& task)
{
- static bool cpu_type_logged = false;
-
if(task_pool.canceled()) {
if(task.need_finish_queue == false)
return;
@@ -201,41 +233,35 @@ public:
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
if(system_cpu_support_avx2()) {
path_trace_kernel = kernel_cpu_avx2_path_trace;
- VLOG_ONCE(1, cpu_type_logged) << "Path tracing using AVX2 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
if(system_cpu_support_avx()) {
path_trace_kernel = kernel_cpu_avx_path_trace;
- VLOG_ONCE(1, cpu_type_logged) << "Path tracing using AVX kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
if(system_cpu_support_sse41()) {
path_trace_kernel = kernel_cpu_sse41_path_trace;
- VLOG_ONCE(1, cpu_type_logged) << "Path tracing using SSE4.1 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
if(system_cpu_support_sse3()) {
path_trace_kernel = kernel_cpu_sse3_path_trace;
- VLOG_ONCE(1, cpu_type_logged) << "Path tracing using SSE3 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
if(system_cpu_support_sse2()) {
path_trace_kernel = kernel_cpu_sse2_path_trace;
- VLOG_ONCE(1, cpu_type_logged) << "Path tracing using SSE2 kernel.";
}
else
#endif
{
path_trace_kernel = kernel_cpu_path_trace;
- VLOG_ONCE(1, cpu_type_logged) << "Path tracing using regular kernel.";
}
while(task.acquire_tile(this, tile)) {
@@ -277,7 +303,6 @@ public:
void thread_film_convert(DeviceTask& task)
{
- static bool cpu_type_logged = false;
float sample_scale = 1.0f/(task.sample + 1);
if(task.rgba_half) {
@@ -285,41 +310,35 @@ public:
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
if(system_cpu_support_avx2()) {
convert_to_half_float_kernel = kernel_cpu_avx2_convert_to_half_float;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to half float using AVX2 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
if(system_cpu_support_avx()) {
convert_to_half_float_kernel = kernel_cpu_avx_convert_to_half_float;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to half float using AVX kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
if(system_cpu_support_sse41()) {
convert_to_half_float_kernel = kernel_cpu_sse41_convert_to_half_float;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to half float using SSE4.1 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
if(system_cpu_support_sse3()) {
convert_to_half_float_kernel = kernel_cpu_sse3_convert_to_half_float;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to half float using SSE3 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
if(system_cpu_support_sse2()) {
convert_to_half_float_kernel = kernel_cpu_sse2_convert_to_half_float;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to half float using SSE2 kernel.";
}
else
#endif
{
convert_to_half_float_kernel = kernel_cpu_convert_to_half_float;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to half float using regular kernel.";
}
for(int y = task.y; y < task.y + task.h; y++)
@@ -332,41 +351,35 @@ public:
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
if(system_cpu_support_avx2()) {
convert_to_byte_kernel = kernel_cpu_avx2_convert_to_byte;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to byte using AVX2 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
if(system_cpu_support_avx()) {
convert_to_byte_kernel = kernel_cpu_avx_convert_to_byte;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to byte using AVX kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
if(system_cpu_support_sse41()) {
convert_to_byte_kernel = kernel_cpu_sse41_convert_to_byte;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to byte using SSE4.1 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
if(system_cpu_support_sse3()) {
convert_to_byte_kernel = kernel_cpu_sse3_convert_to_byte;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to byte using SSE3 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
if(system_cpu_support_sse2()) {
convert_to_byte_kernel = kernel_cpu_sse2_convert_to_byte;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to byte using SSE2 kernel.";
}
else
#endif
{
convert_to_byte_kernel = kernel_cpu_convert_to_byte;
- VLOG_ONCE(1, cpu_type_logged) << "Converting to byte using regular kernel.";
}
for(int y = task.y; y < task.y + task.h; y++)
@@ -380,7 +393,6 @@ public:
void thread_shader(DeviceTask& task)
{
KernelGlobals kg = kernel_globals;
- static bool cpu_type_logged = false;
#ifdef WITH_OSL
OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
@@ -390,41 +402,35 @@ public:
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
if(system_cpu_support_avx2()) {
shader_kernel = kernel_cpu_avx2_shader;
- VLOG_ONCE(1, cpu_type_logged) << "Shading using AVX2 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
if(system_cpu_support_avx()) {
shader_kernel = kernel_cpu_avx_shader;
- VLOG_ONCE(1, cpu_type_logged) << "Shading using AVX kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
if(system_cpu_support_sse41()) {
shader_kernel = kernel_cpu_sse41_shader;
- VLOG_ONCE(1, cpu_type_logged) << "Shading using SSE4.1 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
if(system_cpu_support_sse3()) {
shader_kernel = kernel_cpu_sse3_shader;
- VLOG_ONCE(1, cpu_type_logged) << "Shading using SSE3 kernel.";
}
else
#endif
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
if(system_cpu_support_sse2()) {
shader_kernel = kernel_cpu_sse2_shader;
- VLOG_ONCE(1, cpu_type_logged) << "Shading using SSE2 kernel.";
}
else
#endif
{
shader_kernel = kernel_cpu_shader;
- VLOG_ONCE(1, cpu_type_logged) << "Shading using regular kernel.";
}
for(int sample = 0; sample < task.num_samples; sample++) {
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 991d0077b10..ce854ca3031 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -27,6 +27,7 @@
#include "buffers.h"
+#include "util_debug.h"
#include "util_foreach.h"
#include "util_logging.h"
#include "util_map.h"
@@ -84,29 +85,28 @@ namespace {
cl_device_type opencl_device_type()
{
- char *device = getenv("CYCLES_OPENCL_TEST");
-
- if(device) {
- if(strcmp(device, "NONE") == 0)
+ switch(DebugFlags().opencl.device_type)
+ {
+ case DebugFlags::OpenCL::DEVICE_NONE:
return 0;
- if(strcmp(device, "ALL") == 0)
+ case DebugFlags::OpenCL::DEVICE_ALL:
return CL_DEVICE_TYPE_ALL;
- else if(strcmp(device, "DEFAULT") == 0)
+ case DebugFlags::OpenCL::DEVICE_DEFAULT:
return CL_DEVICE_TYPE_DEFAULT;
- else if(strcmp(device, "CPU") == 0)
+ case DebugFlags::OpenCL::DEVICE_CPU:
return CL_DEVICE_TYPE_CPU;
- else if(strcmp(device, "GPU") == 0)
+ case DebugFlags::OpenCL::DEVICE_GPU:
return CL_DEVICE_TYPE_GPU;
- else if(strcmp(device, "ACCELERATOR") == 0)
+ case DebugFlags::OpenCL::DEVICE_ACCELERATOR:
return CL_DEVICE_TYPE_ACCELERATOR;
+ default:
+ return CL_DEVICE_TYPE_ALL;
}
-
- return CL_DEVICE_TYPE_ALL;
}
-bool opencl_kernel_use_debug()
+inline bool opencl_kernel_use_debug()
{
- return (getenv("CYCLES_OPENCL_DEBUG") != NULL);
+ return DebugFlags().opencl.debug;
}
bool opencl_kernel_use_advanced_shading(const string& platform)
@@ -129,11 +129,11 @@ bool opencl_kernel_use_advanced_shading(const string& platform)
bool opencl_kernel_use_split(const string& platform_name,
const cl_device_type device_type)
{
- if(getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST") != NULL) {
+ if(DebugFlags().opencl.kernel_type == DebugFlags::OpenCL::KERNEL_SPLIT) {
VLOG(1) << "Forcing split kernel to use.";
return true;
}
- if(getenv("CYCLES_OPENCL_MEGA_KERNEL_TEST") != NULL) {
+ if(DebugFlags().opencl.kernel_type == DebugFlags::OpenCL::KERNEL_MEGA) {
VLOG(1) << "Forcing mega kernel to use.";
return false;
}
@@ -229,8 +229,7 @@ bool opencl_device_version_check(cl_device_id device,
void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
{
const bool force_all_platforms =
- (getenv("CYCLES_OPENCL_MEGA_KERNEL_TEST") != NULL) ||
- (getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST") != NULL);
+ (DebugFlags().opencl.kernel_type != DebugFlags::OpenCL::KERNEL_DEFAULT);
const cl_device_type device_type = opencl_device_type();
static bool first_time = true;
#define FIRST_VLOG(severity) if(first_time) VLOG(severity)