[Bf-blender-cvs] [38fde8b] cycles_kernel_split: Cycles kernel split: Make it possible to force usage of split kernel

Sergey Sharybin noreply at git.blender.org
Mon May 4 19:23:31 CEST 2015


Commit: 38fde8bb1ad067c402a40523abfcffc830e044ff
Author: Sergey Sharybin
Date:   Mon May 4 22:21:01 2015 +0500
Branches: cycles_kernel_split
https://developer.blender.org/rB38fde8bb1ad067c402a40523abfcffc830e044ff

Cycles kernel split: Make it possible to force usage of split kernel

Controlled via CYCLES_OPENCL_SPLIT_KERNEL_TEST environment variable.

Also added a bit of logging to OpenCL device creation.

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

M	intern/cycles/device/device_opencl.cpp

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

diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index cb3b06f..a994fa1 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -3721,17 +3721,27 @@ Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
 	string platform_name;
 	cl_device_type device_type;
 	if(get_platform_and_devicetype(info, platform_name, device_type)) {
-		if(platform_name == "AMD Accelerated Parallel Processing" && device_type == CL_DEVICE_TYPE_GPU) {
-			/* if the device is an AMD GPU, take split kernel path */
+		const bool force_split_kernel = getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST") != NULL;
+		/* TODO(sergey): Replace string lookups with more enum-like API,
+		 * similar to device/venfdor checks blender's gpu.
+		 */
+		if(force_split_kernel ||
+		   (platform_name == "AMD Accelerated Parallel Processing" &&
+		    device_type == CL_DEVICE_TYPE_GPU))
+		{
+			/* If the device is an AMD GPU, take split kernel path. */
+			VLOG(1) << "Using split kernel";
 			return new OpenCLDeviceSplitKernel(info, stats, background);
 		} else {
-			/* For any other device, take megakernel path */
+			/* For any other device, take megakernel path. */
+			VLOG(1) << "Using megekernel";
 			return new OpenCLDeviceMegaKernel(info, stats, background);
 		}
 	} else {
 		/* If we can't retrieve platform and device type information for some reason,
-		 * we default to megakernel path
+		 * we default to megakernel path.
 		 */
+		VLOG(1) << "Failed to rertieve platform or device, using megakernel";
 		return new OpenCLDeviceMegaKernel(info, stats, background);
 	}
 }




More information about the Bf-blender-cvs mailing list