Skip to content

Commit 7f51394

Browse files
ayylolaarongreig
authored andcommitted
Add opencl version check
when querying for independent forward progress
1 parent 1487f4b commit 7f51394

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

source/adapters/opencl/device.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -892,13 +892,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
892892
/* CL type: cl_bool
893893
* UR type: ur_bool_t */
894894

895-
cl_bool CLValue;
896-
CL_RETURN_ON_FAILURE(
897-
clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice), CLPropName,
898-
sizeof(cl_bool), &CLValue, nullptr));
895+
oclv::OpenCLVersion DevVer;
896+
CL_RETURN_ON_FAILURE(cl_adapter::getDeviceVersion(
897+
cl_adapter::cast<cl_device_id>(hDevice), DevVer));
898+
if (DevVer >= oclv::V2_1) {
899+
cl_bool CLValue;
900+
CL_RETURN_ON_FAILURE(
901+
clGetDeviceInfo(cl_adapter::cast<cl_device_id>(hDevice), CLPropName,
902+
sizeof(cl_bool), &CLValue, nullptr));
899903

900-
/* cl_bool is uint32_t and ur_bool_t is bool */
901-
return ReturnValue(static_cast<ur_bool_t>(CLValue));
904+
/* cl_bool is uint32_t and ur_bool_t is bool */
905+
return ReturnValue(static_cast<ur_bool_t>(CLValue));
906+
} else {
907+
return ReturnValue(false);
908+
}
902909
}
903910
case UR_DEVICE_INFO_VENDOR_ID:
904911
case UR_DEVICE_INFO_MAX_COMPUTE_UNITS:

0 commit comments

Comments
 (0)