Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/opencl/opencl_util.cpp
| Show First 20 Lines • Show All 741 Lines • ▼ Show 20 Lines | bool OpenCLInfo::device_supported(const string &platform_name, const cl_device_id device_id) | ||||
| int driver_major = 0; | int driver_major = 0; | ||||
| int driver_minor = 0; | int driver_minor = 0; | ||||
| if (!get_driver_version(device_id, &driver_major, &driver_minor)) { | if (!get_driver_version(device_id, &driver_major, &driver_minor)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| VLOG(3) << "OpenCL driver version " << driver_major << "." << driver_minor; | VLOG(3) << "OpenCL driver version " << driver_major << "." << driver_minor; | ||||
| if (getenv("CYCLES_OPENCL_TEST")) { | |||||
| return true; | |||||
| } | |||||
| /* It is possible to have Iris GPU on AMD/Apple OpenCL framework | /* It is possible to have Iris GPU on AMD/Apple OpenCL framework | ||||
| * (aka, it will not be on Intel framework). This isn't supported | * (aka, it will not be on Intel framework). This isn't supported | ||||
| * and needs an explicit blacklist. | * and needs an explicit blacklist. | ||||
| */ | */ | ||||
| if (strstr(device_name.c_str(), "Iris")) { | if (strstr(device_name.c_str(), "Iris")) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (platform_name == "AMD Accelerated Parallel Processing" && | if (platform_name == "AMD Accelerated Parallel Processing" && | ||||
| ▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | if (clGetDeviceInfo(device_id, 0x4008, sizeof(cl_int), &bus_id, NULL) == CL_SUCCESS && | ||||
| (unsigned int)(slot_id >> 3), | (unsigned int)(slot_id >> 3), | ||||
| (unsigned int)(slot_id & 0x7)); | (unsigned int)(slot_id & 0x7)); | ||||
| } | } | ||||
| } | } | ||||
| /* No general way to get a hardware ID from OpenCL => give up. */ | /* No general way to get a hardware ID from OpenCL => give up. */ | ||||
| return ""; | return ""; | ||||
| } | } | ||||
| void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices, bool force_all) | void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices) | ||||
| { | { | ||||
| const cl_device_type device_type = OpenCLInfo::device_type(); | const cl_device_type device_type = OpenCLInfo::device_type(); | ||||
| static bool first_time = true; | static bool first_time = true; | ||||
| # define FIRST_VLOG(severity) \ | # define FIRST_VLOG(severity) \ | ||||
| if (first_time) \ | if (first_time) \ | ||||
| VLOG(severity) | VLOG(severity) | ||||
| usable_devices->clear(); | usable_devices->clear(); | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | for (int num = 0; num < device_ids.size(); num++) { | ||||
| FIRST_VLOG(2) << "Failed to fetch device name: " << string(clewErrorString(error)) | FIRST_VLOG(2) << "Failed to fetch device name: " << string(clewErrorString(error)) | ||||
| << ", ignoring."; | << ", ignoring."; | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!device_version_check(device_id)) { | if (!device_version_check(device_id)) { | ||||
| FIRST_VLOG(2) << "Ignoring device " << device_name << " due to old compiler version."; | FIRST_VLOG(2) << "Ignoring device " << device_name << " due to old compiler version."; | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (force_all || device_supported(platform_name, device_id)) { | if (device_supported(platform_name, device_id)) { | ||||
| cl_device_type device_type; | cl_device_type device_type; | ||||
| if (!get_device_type(device_id, &device_type, &error)) { | if (!get_device_type(device_id, &device_type, &error)) { | ||||
| FIRST_VLOG(2) << "Ignoring device " << device_name | FIRST_VLOG(2) << "Ignoring device " << device_name | ||||
| << ", failed to fetch device type:" << string(clewErrorString(error)); | << ", failed to fetch device type:" << string(clewErrorString(error)); | ||||
| continue; | continue; | ||||
| } | } | ||||
| string readable_device_name = get_readable_device_name(device_id); | string readable_device_name = get_readable_device_name(device_id); | ||||
| if (readable_device_name != device_name) { | if (readable_device_name != device_name) { | ||||
| ▲ Show 20 Lines • Show All 323 Lines • Show Last 20 Lines | |||||