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
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-30 01:30:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-30 01:43:27 +0300
commita8b8da55672c2177c55709321df3514355b513f4 (patch)
tree97c730a1b39e60ecd15ad5c73b63892329daae1e /intern
parent8ac2d85d2fd3f8b997e9c9bddadada0dc7bdaf37 (diff)
Fix T58183: crash with CPU + GPU rendering after profiling changes.
Multi-device was not passing along profiler to the CPU.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/device.cpp12
-rw-r--r--intern/cycles/device/device.h5
-rw-r--r--intern/cycles/device/device_cpu.cpp12
-rw-r--r--intern/cycles/device/device_cuda.cpp8
-rw-r--r--intern/cycles/device/device_intern.h10
-rw-r--r--intern/cycles/device/device_multi.cpp12
-rw-r--r--intern/cycles/device/device_network.cpp8
-rw-r--r--intern/cycles/device/device_opencl.cpp6
-rw-r--r--intern/cycles/device/opencl/opencl.h6
-rw-r--r--intern/cycles/device/opencl/opencl_base.cpp4
-rw-r--r--intern/cycles/device/opencl/opencl_mega.cpp8
-rw-r--r--intern/cycles/device/opencl/opencl_split.cpp10
-rw-r--r--intern/cycles/render/session.cpp15
-rw-r--r--intern/cycles/render/session.h1
-rw-r--r--intern/cycles/render/stats.cpp4
-rw-r--r--intern/cycles/render/stats.h2
-rw-r--r--intern/cycles/test/render_graph_finalize_test.cpp3
-rw-r--r--intern/cycles/util/util_stats.h2
18 files changed, 64 insertions, 64 deletions
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.device_type;
if(OpenCLInfo::kernel_use_split(platform_name, device_type)) {
VLOG(1) << "Using split kernel.";
- return opencl_create_split_device(info, stats, background);
+ return opencl_create_split_device(info, stats, profiler, background);
} else {
VLOG(1) << "Using mega kernel.";
- return opencl_create_mega_device(info, stats, background);
+ return opencl_create_mega_device(info, stats, profiler, background);
}
}
diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index 8cb7f6d0b82..ea7ed4f1909 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -333,7 +333,7 @@ public:
void opencl_error(const string& message);
void opencl_assert_err(cl_int err, const char* where);
- OpenCLDeviceBase(DeviceInfo& info, Stats &stats, bool background_);
+ OpenCLDeviceBase(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_);
~OpenCLDeviceBase();
static void CL_CALLBACK context_notify_callback(const char *err_info,
@@ -568,8 +568,8 @@ protected:
void flush_texture_buffers();
};
-Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, bool background);
-Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, bool background);
+Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background);
+Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background);
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp
index 1e73d37d7a4..d4d7c0f74bc 100644
--- a/intern/cycles/device/opencl/opencl_base.cpp
+++ b/intern/cycles/device/opencl/opencl_base.cpp
@@ -72,8 +72,8 @@ void OpenCLDeviceBase::opencl_assert_err(cl_int err, const char* where)
}
}
-OpenCLDeviceBase::OpenCLDeviceBase(DeviceInfo& info, Stats &stats, bool background_)
-: Device(info, stats, background_),
+OpenCLDeviceBase::OpenCLDeviceBase(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
+: Device(info, stats, profiler, background_),
memory_manager(this),
texture_info(this, "__texture_info", MEM_TEXTURE)
{
diff --git a/intern/cycles/device/opencl/opencl_mega.cpp b/intern/cycles/device/opencl/opencl_mega.cpp
index 89001366d9d..0a7bf96fed7 100644
--- a/intern/cycles/device/opencl/opencl_mega.cpp
+++ b/intern/cycles/device/opencl/opencl_mega.cpp
@@ -33,8 +33,8 @@ class OpenCLDeviceMegaKernel : public OpenCLDeviceBase
public:
OpenCLProgram path_trace_program;
- OpenCLDeviceMegaKernel(DeviceInfo& info, Stats &stats, bool background_)
- : OpenCLDeviceBase(info, stats, background_),
+ OpenCLDeviceMegaKernel(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
+ : OpenCLDeviceBase(info, stats, profiler, background_),
path_trace_program(this, "megakernel", "kernel.cl", "-D__COMPILE_ONLY_MEGAKERNEL__ ")
{
}
@@ -160,9 +160,9 @@ public:
}
};
-Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, bool background)
+Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background)
{
- return new OpenCLDeviceMegaKernel(info, stats, background);
+ return new OpenCLDeviceMegaKernel(info, stats, profiler, background);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index adb73bc6e2c..5a2555f9f80 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -79,7 +79,7 @@ public:
OpenCLProgram program_data_init;
OpenCLProgram program_state_buffer_size;
- OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, bool background_);
+ OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_);
~OpenCLDeviceSplitKernel()
{
@@ -448,17 +448,17 @@ public:
}
};
-OpenCLDeviceSplitKernel::OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, bool background_)
-: OpenCLDeviceBase(info, stats, background_)
+OpenCLDeviceSplitKernel::OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
+: OpenCLDeviceBase(info, stats, profiler, background_)
{
split_kernel = new OpenCLSplitKernel(this);
background = background_;
}
-Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, bool background)
+Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background)
{
- return new OpenCLDeviceSplitKernel(info, stats, background);
+ return new OpenCLDeviceSplitKernel(info, stats, profiler, background);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index a8374b662d0..d6d0ffb4a6b 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -47,13 +47,14 @@ Session::Session(const SessionParams& params_)
tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution,
params.background == false || params.progressive_refine, params.background, params.tile_order,
max(params.device.multi_devices.size(), 1), params.pixel_size),
- stats()
+ stats(),
+ profiler()
{
device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
TaskScheduler::init(params.threads);
- device = Device::create(params.device, stats, params.background);
+ device = Device::create(params.device, stats, profiler, params.background);
if(params.background && !params.write_render_cb) {
buffers = NULL;
@@ -251,7 +252,7 @@ void Session::run_gpu()
/* update scene */
scoped_timer update_timer;
if(update_scene()) {
- stats.profiler.reset(scene->shaders.size(), scene->objects.size());
+ profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
@@ -588,7 +589,7 @@ void Session::run_cpu()
/* update scene */
scoped_timer update_timer;
if(update_scene()) {
- stats.profiler.reset(scene->shaders.size(), scene->objects.size());
+ profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
@@ -734,7 +735,7 @@ void Session::run()
load_kernels();
if(params.use_profiling && (params.device.type == DEVICE_CPU)) {
- stats.profiler.start();
+ profiler.start();
}
/* session thread loop */
@@ -751,7 +752,7 @@ void Session::run()
run_cpu();
}
- stats.profiler.stop();
+ profiler.stop();
/* progress update */
if(progress.get_cancel())
@@ -1069,7 +1070,7 @@ void Session::collect_statistics(RenderStats *render_stats)
{
scene->collect_statistics(render_stats);
if(params.use_profiling && (params.device.type == DEVICE_CPU)) {
- render_stats->collect_profiling(scene, &stats);
+ render_stats->collect_profiling(scene, profiler);
}
}
diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h
index db07c758427..c7f590915e7 100644
--- a/intern/cycles/render/session.h
+++ b/intern/cycles/render/session.h
@@ -149,6 +149,7 @@ public:
SessionParams params;
TileManager tile_manager;
Stats stats;
+ Profiler profiler;
function<void(RenderTile&)> write_render_tile_cb;
function<void(RenderTile&, bool)> update_render_tile_cb;
diff --git a/intern/cycles/render/stats.cpp b/intern/cycles/render/stats.cpp
index 9a7c5a6c1ad..4245745944d 100644
--- a/intern/cycles/render/stats.cpp
+++ b/intern/cycles/render/stats.cpp
@@ -227,12 +227,10 @@ RenderStats::RenderStats() {
has_profiling = false;
}
-void RenderStats::collect_profiling(Scene *scene, Stats *stats)
+void RenderStats::collect_profiling(Scene *scene, Profiler& prof)
{
has_profiling = true;
- Profiler &prof = stats->profiler;
-
kernel = NamedNestedSampleStats("Total render time", prof.get_event(PROFILING_UNKNOWN));
kernel.add_entry("Ray setup", prof.get_event(PROFILING_RAY_SETUP));
diff --git a/intern/cycles/render/stats.h b/intern/cycles/render/stats.h
index ce0529bb8bd..33fe1f4b185 100644
--- a/intern/cycles/render/stats.h
+++ b/intern/cycles/render/stats.h
@@ -144,7 +144,7 @@ public:
string full_report();
/* Collect kernel sampling information from Stats. */
- void collect_profiling(Scene *scene, Stats *stats);
+ void collect_profiling(Scene *scene, Profiler& prof);
bool has_profiling;
diff --git a/intern/cycles/test/render_graph_finalize_test.cpp b/intern/cycles/test/render_graph_finalize_test.cpp
index cfdab7a6433..5f60411758d 100644
--- a/intern/cycles/test/render_graph_finalize_test.cpp
+++ b/intern/cycles/test/render_graph_finalize_test.cpp
@@ -161,6 +161,7 @@ class RenderGraph : public testing::Test
protected:
ScopedMockLog log;
Stats stats;
+ Profiler profiler;
DeviceInfo device_info;
Device *device_cpu;
SceneParams scene_params;
@@ -179,7 +180,7 @@ protected:
util_logging_start();
util_logging_verbosity_set(1);
- device_cpu = Device::create(device_info, stats, true);
+ device_cpu = Device::create(device_info, stats, profiler, true);
scene = new Scene(scene_params, device_cpu);
}
diff --git a/intern/cycles/util/util_stats.h b/intern/cycles/util/util_stats.h
index 1128bc3ced1..f1f2df94e33 100644
--- a/intern/cycles/util/util_stats.h
+++ b/intern/cycles/util/util_stats.h
@@ -41,8 +41,6 @@ public:
size_t mem_used;
size_t mem_peak;
-
- Profiler profiler;
};
CCL_NAMESPACE_END