[Bf-blender-cvs] [02a7e875d74] blender2.7: Cycles OpenCL: Remove single program

Jeroen Bakker noreply at git.blender.org
Fri Mar 8 16:32:17 CET 2019


Commit: 02a7e875d74bbcdba569ac6021cf5da4ff231949
Author: Jeroen Bakker
Date:   Fri Mar 8 16:31:05 2019 +0100
Branches: blender2.7
https://developer.blender.org/rB02a7e875d74bbcdba569ac6021cf5da4ff231949

Cycles OpenCL: Remove single program

Part of the cleanup of the OpenCL codebase.
Single program is not effective when using OpenCL, it is slower
to compile and slower during rendering (when used in for example
`barbershop` or `victor`).

Reviewers: brecht, #cycles

Maniphest Tasks: T62267

Differential Revision: https://developer.blender.org/D4481

===================================================================

M	intern/cycles/blender/addon/properties.py
M	intern/cycles/blender/addon/ui.py
M	intern/cycles/blender/blender_python.cpp
M	intern/cycles/device/opencl/opencl.h
M	intern/cycles/device/opencl/opencl_split.cpp
M	intern/cycles/device/opencl/opencl_util.cpp
M	intern/cycles/kernel/CMakeLists.txt
D	intern/cycles/kernel/kernels/opencl/kernel_split.cl
M	intern/cycles/util/util_debug.cpp
M	intern/cycles/util/util_debug.h

===================================================================

diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index f66d6970490..04b0cf75e82 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -724,12 +724,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
             update=devices_update_callback
         )
 
-        cls.debug_opencl_kernel_single_program = BoolProperty(
-            name="Single Program",
-            default=False,
-            update=devices_update_callback,
-        )
-
         cls.debug_use_opencl_debug = BoolProperty(name="Debug OpenCL", default=False)
 
         cls.debug_opencl_mem_limit = IntProperty(name="Memory limit", default=0,
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 5d1d9e764d0..d225c471177 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1635,7 +1635,6 @@ class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
         col = layout.column()
         col.label('OpenCL Flags:')
         col.prop(cscene, "debug_opencl_device_type", text="Device")
-        col.prop(cscene, "debug_opencl_kernel_single_program", text="Single Program")
         col.prop(cscene, "debug_use_opencl_debug", text="Debug")
         col.prop(cscene, "debug_opencl_mem_limit")
 
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index da369d0454a..647e7c6374b 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -104,7 +104,6 @@ bool debug_flags_sync_from_scene(BL::Scene b_scene)
 	/* Synchronize other OpenCL flags. */
 	flags.opencl.debug = get_boolean(cscene, "debug_use_opencl_debug");
 	flags.opencl.mem_limit = ((size_t)get_int(cscene, "debug_opencl_mem_limit"))*1024*1024;
-	flags.opencl.single_program = get_boolean(cscene, "debug_opencl_kernel_single_program");
 	return flags.opencl.device_type != opencl_device_type;
 }
 
diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index 6e5eab1a265..4ecf71e116e 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -95,7 +95,6 @@ public:
 	                              cl_device_id device_id);
 	static void get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices,
 	                               bool force_all = false);
-	static bool use_single_program();
 
 	/* ** Some handy shortcuts to low level cl*GetInfo() functions. ** */
 
@@ -371,9 +370,9 @@ public:
 	bool load_kernels(const DeviceRequestedFeatures& requested_features);
 
 	/* Get the name of the opencl program for the given kernel */
-	const string get_opencl_program_name(bool single_program, const string& kernel_name);
+	const string get_opencl_program_name(const string& kernel_name);
 	/* Get the program file name to compile (*.cl) for the given kernel */
-	const string get_opencl_program_filename(bool single_program, const string& kernel_name);
+	const string get_opencl_program_filename(const string& kernel_name);
 	string get_build_options(const DeviceRequestedFeatures& requested_features, const string& opencl_program_name);
 
 	void mem_alloc(device_memory& mem);
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp
index 7012bf744ea..b575b008fe0 100644
--- a/intern/cycles/device/opencl/opencl_split.cpp
+++ b/intern/cycles/device/opencl/opencl_split.cpp
@@ -53,33 +53,23 @@ static const string fast_compiled_kernels =
 	"indirect_subsurface "
 	"buffer_update";
 
-const string OpenCLDevice::get_opencl_program_name(bool single_program, const string& kernel_name)
+const string OpenCLDevice::get_opencl_program_name(const string& kernel_name)
 {
-	if (single_program) {
-		return "split";
+	if (fast_compiled_kernels.find(kernel_name) != std::string::npos) {
+		return "split_bundle";
 	}
 	else {
-		if (fast_compiled_kernels.find(kernel_name) != std::string::npos) {
-			return "split_bundle";
-		}
-		else {
-			return "split_" + kernel_name;
-		}
+		return "split_" + kernel_name;
 	}
 }
 
-const string OpenCLDevice::get_opencl_program_filename(bool single_program, const string& kernel_name)
+const string OpenCLDevice::get_opencl_program_filename(const string& kernel_name)
 {
-	if (single_program) {
-		return "kernel_split.cl";
+	if (fast_compiled_kernels.find(kernel_name) != std::string::npos) {
+		return "kernel_split_bundle.cl";
 	}
 	else {
-		if (fast_compiled_kernels.find(kernel_name) != std::string::npos) {
-			return "kernel_split_bundle.cl";
-		}
-		else {
-			return "kernel_" + kernel_name + ".cl";
-		}
+		return "kernel_" + kernel_name + ".cl";
 	}
 }
 
@@ -280,12 +270,11 @@ public:
 	{
 		OpenCLSplitKernelFunction* kernel = new OpenCLSplitKernelFunction(device, cached_memory);
 
-		bool single_program = OpenCLInfo::use_single_program();
-		const string program_name = device->get_opencl_program_name(single_program, kernel_name);
+		const string program_name = device->get_opencl_program_name(kernel_name);
 		kernel->program =
 			OpenCLDevice::OpenCLProgram(device,
 			                            program_name,
-			                            device->get_opencl_program_filename(single_program, kernel_name),
+			                            device->get_opencl_program_filename(kernel_name),
 			                            device->get_build_options(requested_features, program_name));
 
 		kernel->program.add_kernel(ustring("path_trace_" + kernel_name));
@@ -663,10 +652,8 @@ bool OpenCLDevice::load_kernels(const DeviceRequestedFeatures& requested_feature
 		programs.push_back(&background_program);
 	}
 
-	bool single_program = OpenCLInfo::use_single_program();
-
-#define ADD_SPLIT_KERNEL_SINGLE_PROGRAM(kernel_name) program_split.add_kernel(ustring("path_trace_"#kernel_name));
-#define ADD_SPLIT_KERNEL_SPLIT_PROGRAM(kernel_name) \
+#define ADD_SPLIT_KERNEL_BUNDLE_PROGRAM(kernel_name) program_split.add_kernel(ustring("path_trace_"#kernel_name));
+#define ADD_SPLIT_KERNEL_PROGRAM(kernel_name) \
 		const string program_name_##kernel_name = "split_"#kernel_name; \
 		program_##kernel_name = \
 			OpenCLDevice::OpenCLProgram(this, \
@@ -676,71 +663,41 @@ bool OpenCLDevice::load_kernels(const DeviceRequestedFeatures& requested_feature
 		program_##kernel_name.add_kernel(ustring("path_trace_"#kernel_name)); \
 		programs.push_back(&program_##kernel_name);
 
-	if (single_program) {
-		program_split = OpenCLDevice::OpenCLProgram(this,
-		                                            "split" ,
-		                                            "kernel_split.cl",
-		                                            get_build_options(requested_features, "split"));
-
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(state_buffer_size);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(data_init);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(path_init);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(scene_intersect);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(lamp_emission);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(do_volume);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(queue_enqueue);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(indirect_background);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shader_setup);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shader_sort);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shader_eval);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(holdout_emission_blurring_pathtermination_ao);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(subsurface_scatter);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(direct_lighting);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shadow_blocked_ao);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shadow_blocked_dl);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(enqueue_inactive);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(next_iteration_setup);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(indirect_subsurface);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(buffer_update);
-
-		programs.push_back(&program_split);
-	}
-	else {
-		/* Ordered with most complex kernels first, to reduce overall compile time. */
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(subsurface_scatter);
-		if (requested_features.use_volume) {
-			ADD_SPLIT_KERNEL_SPLIT_PROGRAM(do_volume);
-		}
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(shadow_blocked_dl);
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(shadow_blocked_ao);
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(holdout_emission_blurring_pathtermination_ao);
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(lamp_emission);
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(direct_lighting);
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(indirect_background);
-		ADD_SPLIT_KERNEL_SPLIT_PROGRAM(shader_eval);
-
-		/* Quick kernels bundled in a single program to reduce overhead of starting
-		 * Blender processes. */
-		program_split = OpenCLDevice::OpenCLProgram(this,
-		                                            "split_bundle" ,
-		                                            "kernel_split_bundle.cl",
-		                                            get_build_options(requested_features, "split_bundle"));
-
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(data_init);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(state_buffer_size);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(path_init);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(scene_intersect);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(queue_enqueue);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shader_setup);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(shader_sort);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(enqueue_inactive);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(next_iteration_setup);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(indirect_subsurface);
-		ADD_SPLIT_KERNEL_SINGLE_PROGRAM(buffer_update);
-		programs.push_back(&program_split);
-	}
-#undef ADD_SPLIT_KERNEL_SPLIT_PROGRAM
-#undef ADD_SPLIT_KERNEL_SINGLE_PROGRAM
+	/* Ordered with most complex kernels first, to reduce overall compile time. */
+	ADD_SPLIT_KERNEL_PROGRAM(subsurface_scatter);
+	if (requested_features.use_volume) {
+		ADD_SPLIT_KERNEL_PROGRAM(do_volume);
+	}
+	ADD_SPLIT_KERNEL_PROGRAM(shadow_blocked_dl);
+	ADD_SPLIT_KERNEL_PROGRAM(shadow_blocked_ao);
+	ADD_SPLIT_KERNEL_PROGRAM(holdout_emission_blurring_pathtermination_ao);
+	ADD_SPLIT_KERNEL_PROGRAM(lamp_emission);
+	ADD_SPLIT_KERNEL_PROGRAM(direct_lighting);
+	ADD_SPLIT_KERNEL_PROGRAM(indirect_background);
+	ADD_SPLIT_KERNEL_PROGRAM(shader_eval);
+
+	/* Quick kernels bundled in a single program to reduce overhead of starting
+		

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list