Cycles: Only whitelist AMD GPU devices in the OpenCL section

Only those ones are priority for now, all the rest are still testable
if CYCLES_OPENCL_TEST or CYCLES_OPENCL_SPLIT_KERNEL_TEST environment
variables are set.
This commit is contained in:
Sergey Sharybin 2015-05-09 23:40:26 +05:00
parent 8647c7d501
commit 136d7a4f62
1 changed files with 15 additions and 0 deletions

View File

@ -3346,6 +3346,10 @@ void device_opencl_info(vector<DeviceInfo>& devices)
/* devices are numbered consecutively across platforms */
int num_base = 0;
const bool force_all_platforms =
(getenv("CYCLES_OPENCL_TEST") != NULL) ||
(getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST")) != NULL;
for(int platform = 0; platform < num_platforms; platform++, num_base += num_devices) {
num_devices = 0;
if(clGetDeviceIDs(platform_ids[platform], opencl_device_type(), 0, NULL, &num_devices) != CL_SUCCESS || num_devices == 0)
@ -3360,6 +3364,17 @@ void device_opencl_info(vector<DeviceInfo>& devices)
clGetPlatformInfo(platform_ids[platform], CL_PLATFORM_NAME, sizeof(pname), &pname, NULL);
string platform_name = pname;
cl_device_type device_type;
clGetDeviceInfo(device_ids[platform], CL_DEVICE_TYPE, sizeof(cl_device_type), &device_type, NULL);
/* TODO(sergey): Make it an utility function to check whitelisted devices. */
if(!(force_all_platforms ||
(platform_name == "AMD Accelerated Parallel Processing" &&
device_type == CL_DEVICE_TYPE_GPU)))
{
continue;
}
/* add devices */
for(int num = 0; num < num_devices; num++) {
cl_device_id device_id = device_ids[num];