Commit: a8b8da55672c2177c55709321df3514355b513f4
Author: Brecht Van Lommel
Date: Thu Nov 29 23:30:17 2018 +0100
Branches: master
https://developer.blender.org/rBa8b8da55672c2177c55709321df3514355b513f4
Fix T58183: crash with CPU + GPU rendering after profiling changes.
Multi-device was not passing along profiler to the CPU.
===================================================================
M intern/cycles/device/device.cpp
M intern/cycles/device/device.h
M intern/cycles/device/device_cpu.cpp
M intern/cycles/device/device_cuda.cpp
M intern/cycles/device/device_intern.h
M intern/cycles/device/device_multi.cpp
M intern/cycles/device/device_network.cpp
M intern/cycles/device/device_opencl.cpp
M intern/cycles/device/opencl/opencl.h
M intern/cycles/device/opencl/opencl_base.cpp
M intern/cycles/device/opencl/opencl_mega.cpp
M intern/cycles/device/opencl/opencl_split.cpp
M intern/cycles/render/session.cpp
M intern/cycles/render/session.h
M intern/cycles/render/stats.cpp
M intern/cycles/render/stats.h
M intern/cycles/test/render_graph_finalize_test.cpp
M intern/cycles/util/util_stats.h
===================================================================
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 54ffd4bc4df..c2d1512492c 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -206,36 +206,36 @@ void Device::draw_pixels(device_memory& rgba, int y, int
w, int h, int dx, int d
glDisable(GL_BLEND);
}
-Device *Device::create(DeviceInfo& info, Stats &stats, bool background)
+Device *Device::create(DeviceInfo& info, Stats &stats, Profiler &profiler,
bool background)
{
Device *device;
switch(info.type) {
case DEVICE_CPU:
- device = device_cpu_create(info, stats, background);
+ device = device_cpu_create(info, stats, profiler,
background);
break;
#ifdef WITH_CUDA
case DEVICE_CUDA:
if(device_cuda_init())
- device = device_cuda_create(info, stats,
background);
+ device = device_cuda_create(info, stats,
profiler, background);
else
device = NULL;
break;
#endif
#ifdef WITH_MULTI
case DEVICE_MULTI:
- device = device_multi_create(info, stats, background);
+ device = device_multi_create(info, stats, profiler,
background);
break;
#endif
#ifdef WITH_NETWORK
case DEVICE_NETWORK:
- device = device_network_create(info, stats,
"127.0.0.1");
+ device = device_network_create(info, stats, profiler,
"127.0.0.1");
break;
#endif
#ifdef WITH_OPENCL
case DEVICE_OPENCL:
if(device_opencl_init())
- device = device_opencl_create(info, stats,
background);
+ device = device_opencl_create(info, stats,
profiler, background);
else
device = NULL;
break;
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 071f61a7566..55c39188210 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -249,7 +249,7 @@ struct DeviceDrawParams {
class Device {
friend class device_sub_ptr;
protected:
- Device(DeviceInfo& info_, Stats &stats_, bool background) :
background(background), vertex_buffer(0), info(info_), stats(stats_) {}
+ Device(DeviceInfo& info_, Stats &stats_, Profiler &profiler_, bool
background) : background(background), vertex_buffer(0), info(info_),
stats(stats_), profiler(profiler_) {}
bool background;
string error_msg;
@@ -285,6 +285,7 @@ public:
/* statistics */
Stats &stats;
+ Profiler &profiler;
/* memory alignment */
virtual int mem_sub_ptr_alignment() { return
MIN_ALIGNMENT_CPU_DATA_TYPES; }
@@ -323,7 +324,7 @@ public:
virtual void unmap_neighbor_tiles(Device * /*sub_device*/, RenderTile *
/*tiles*/) {}
/* static */
- static Device *create(DeviceInfo& info, Stats &stats, bool background =
true);
+ static Device *create(DeviceInfo& info, Stats &stats, Profiler&
profiler, bool background = true);
static DeviceType type_from_string(const char *name);
static string string_from_type(DeviceType type);
diff --git a/intern/cycles/device/device_cpu.cpp
b/intern/cycles/device/device_cpu.cpp
index f0a6fd6e3f4..16908b0244a 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -208,8 +208,8 @@ public:
KERNEL_NAME_EVAL(cpu_avx, name), \
KERNEL_NAME_EVAL(cpu_avx2, name)
- CPUDevice(DeviceInfo& info_, Stats &stats_, bool background_)
- : Device(info_, stats_, background_),
+ CPUDevice(DeviceInfo& info_, Stats &stats_, Profiler &profiler_, bool
background_)
+ : Device(info_, stats_, profiler_, background_),
texture_info(this, "__texture_info", MEM_TEXTURE),
#define REGISTER_KERNEL(name) name ## _kernel(KERNEL_FUNCTIONS(name))
REGISTER_KERNEL(path_trace),
@@ -781,7 +781,7 @@ public:
KernelGlobals *kg = new ((void*) kgbuffer.device_pointer)
KernelGlobals(thread_kernel_globals_init());
- stats.profiler.add_state(&kg->profiler);
+ profiler.add_state(&kg->profiler);
CPUSplitKernel *split_kernel = NULL;
if(use_split_kernel) {
@@ -821,7 +821,7 @@ public:
}
}
- stats.profiler.remove_state(&kg->profiler);
+ profiler.remove_state(&kg->profiler);
thread_kernel_globals_free((KernelGlobals*)kgbuffer.device_pointer);
kg->~KernelGlobals();
@@ -1065,9 +1065,9 @@ uint64_t CPUSplitKernel::state_buffer_size(device_memory&
kernel_globals, device
return split_data_buffer_size(kg, num_threads);
}
-Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background)
+Device *device_cpu_create(DeviceInfo& info, Stats &stats, Profiler &profiler,
bool background)
{
- return new CPUDevice(info, stats, background);
+ return new CPUDevice(info, stats, profiler, background);
}
void device_cpu_info(vector<DeviceInfo>& devices)
diff --git a/intern/cycles/device/device_cuda.cpp
b/intern/cycles/device/device_cuda.cpp
index 46e7b043603..7b3c25a86d5 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -236,8 +236,8 @@ public:
cuda_error_documentation();
}
- CUDADevice(DeviceInfo& info, Stats &stats, bool background_)
- : Device(info, stats, background_),
+ CUDADevice(DeviceInfo& info, Stats &stats, Profiler &profiler, bool
background_)
+ : Device(info, stats, profiler, background_),
texture_info(this, "__texture_info", MEM_TEXTURE)
{
first_error = true;
@@ -2396,9 +2396,9 @@ bool device_cuda_init()
#endif /* WITH_CUDA_DYNLOAD */
}
-Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background)
+Device *device_cuda_create(DeviceInfo& info, Stats &stats, Profiler &profiler,
bool background)
{
- return new CUDADevice(info, stats, background);
+ return new CUDADevice(info, stats, profiler, background);
}
static CUresult device_cuda_safe_init()
diff --git a/intern/cycles/device/device_intern.h
b/intern/cycles/device/device_intern.h
index e6495c2bff3..0b26057c3ba 100644
--- a/intern/cycles/device/device_intern.h
+++ b/intern/cycles/device/device_intern.h
@@ -21,13 +21,13 @@ CCL_NAMESPACE_BEGIN
class Device;
-Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background);
+Device *device_cpu_create(DeviceInfo& info, Stats &stats, Profiler &profiler,
bool background);
bool device_opencl_init();
-Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background);
+Device *device_opencl_create(DeviceInfo& info, Stats &stats, Profiler
&profiler, bool background);
bool device_cuda_init();
-Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background);
-Device *device_network_create(DeviceInfo& info, Stats &stats, const char
*address);
-Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background);
+Device *device_cuda_create(DeviceInfo& info, Stats &stats, Profiler &profiler,
bool background);
+Device *device_network_create(DeviceInfo& info, Stats &stats, Profiler
&profiler, const char *address);
+Device *device_multi_create(DeviceInfo& info, Stats &stats, Profiler
&profiler, bool background);
void device_cpu_info(vector<DeviceInfo>& devices);
void device_opencl_info(vector<DeviceInfo>& devices);
diff --git a/intern/cycles/device/device_multi.cpp
b/intern/cycles/device/device_multi.cpp
index 490ee3951c9..2fac4fa071b 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -45,11 +45,11 @@ public:
list<SubDevice> devices;
device_ptr unique_key;
- MultiDevice(DeviceInfo& info, Stats &stats, bool background_)
- : Device(info, stats, background_), unique_key(1)
+ MultiDevice(DeviceInfo& info, Stats &stats, Profiler &profiler, bool
background_)
+ : Device(info, stats, profiler, background_), unique_key(1)
{
foreach(DeviceInfo& subinfo, info.multi_devices) {
- Device *device = Device::create(subinfo, sub_stats_,
background);
+ Device *device = Device::create(subinfo, sub_stats_,
profiler, background);
/* Always add CPU devices at the back since GPU devices
can change
* host memory pointers, which CPU uses as device
pointer. */
@@ -69,7 +69,7 @@ public:
vector<string> servers = discovery.get_server_list();
foreach(string& server, servers) {
- Device *device = device_network_create(info, stats,
server.c_str());
+ Device *device = device_network_create(info, stats,
profiler, server.c_str());
if(device)
devices.push_back(SubDevice(device));
}
@@ -378,9 +378,9 @@ protected:
Stats sub_stats_;
};
-Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background)
+Device *device_multi_create(DeviceInfo& info, Stats &stats, Profiler&
profiler, bool background)
{
- return new MultiDevice(info, stats, background);
+ return new MultiDevice(info, stats, profiler, background);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/device_network.cpp
b/intern/cycles/device/device_network.cpp
index b6e18621f12..91628490b51 100644
--- a/intern/cycles/device/device_network.cpp
+++ b/intern/cycles/device/device_network.cpp
@@ -56,8 +56,8 @@ public:
return false;
}
- NetworkDevice(DeviceInfo& info, Stats &stats, const char *address)
- : Device(info, stats, true), socket(io_service)
+ NetworkDevice(DeviceInfo& info, Stats &stats, Profiler &profiler, const
char *address)
+ : Device(info, stats, profiler, true), socket(io_service)
{
error_func = NetworkError();
stringstream portstr;
@@ -293,9 +293,9 @@ private:
NetworkError error_func;
};
-Device *device_network_create(DeviceInfo& info, Stats &stats, const char
*address)
+Device *device_network_create(DeviceInfo& info, Stats &stats, Profiler
&profiler, const char *address)
{
- return new NetworkDevice(info, stats, address);
+ return new NetworkDevice(info, stats, profiler, address);
}
void device_network_info(vector<DeviceInfo>& devices)
diff --git a/intern/cycles/device/device_opencl.cpp
b/intern/cycles/device/device_opencl.cpp
index 71410f80d57..1e8c6b2dd0e 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -27,7 +27,7 @@
CCL_NAMESPACE_BEGIN
-Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
+Device *device_opencl_create(DeviceInfo& info, Stats &stats, Profiler
&profiler, bool background)
{
vector<OpenCLPlatformDevice> usable_devices;
OpenCLInfo::get_usable_devices(&usable_devices);
@@ -37,10 +37,10 @@ Device *device_opencl_create(DeviceInfo& info, Stats
&stats, bool background)
const cl_device_type device_type = platform_device.d
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs