[Bf-blender-cvs] [30a0459f2cf] blender-v2.79a-release: Fix T53692: OpenCL multi GPU rendering not using all GPUs.

Brecht Van Lommel noreply at git.blender.org
Sat Jan 13 02:52:31 CET 2018


Commit: 30a0459f2cfeeefcc27a1234e392f6dda51d8031
Author: Brecht Van Lommel
Date:   Thu Jan 4 23:29:06 2018 +0100
Branches: blender-v2.79a-release
https://developer.blender.org/rB30a0459f2cfeeefcc27a1234e392f6dda51d8031

Fix T53692: OpenCL multi GPU rendering not using all GPUs.

Ensure each OpenCL device has a unique ID even if the hardware ID is not
unique for some reason.

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

M	intern/cycles/device/device_opencl.cpp

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

diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 681b8214b03..721198e1598 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -22,6 +22,7 @@
 
 #include "util/util_foreach.h"
 #include "util/util_logging.h"
+#include "util/util_set.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -79,7 +80,9 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 	OpenCLInfo::get_usable_devices(&usable_devices);
 	/* Devices are numbered consecutively across platforms. */
 	int num_devices = 0;
+	set<string> unique_ids;
 	foreach(OpenCLPlatformDevice& platform_device, usable_devices) {
+		/* Compute unique ID for persistent user preferences. */
 		const string& platform_name = platform_device.platform_name;
 		const cl_device_type device_type = platform_device.device_type;
 		const string& device_name = platform_device.device_name;
@@ -87,7 +90,15 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 		if(hardware_id == "") {
 			hardware_id = string_printf("ID_%d", num_devices);
 		}
+		string id = string("OPENCL_") + platform_name + "_" + device_name + "_" + hardware_id;
 
+		/* Hardware ID might not be unique, add device number in that case. */
+		if(unique_ids.find(id) != unique_ids.end()) {
+			id += string_printf("_ID_%d", num_devices);
+		}
+		unique_ids.insert(id);
+
+		/* Create DeviceInfo. */
 		DeviceInfo info;
 		info.type = DEVICE_OPENCL;
 		info.description = string_remove_trademark(string(device_name));
@@ -98,7 +109,7 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 		info.pack_images = true;
 		info.use_split_kernel = OpenCLInfo::kernel_use_split(platform_name,
 		                                                     device_type);
-		info.id = string("OPENCL_") + platform_name + "_" + device_name + "_" + hardware_id;
+		info.id = id;
 		devices.push_back(info);
 		num_devices++;
 	}



More information about the Bf-blender-cvs mailing list