@@ -938,17 +938,28 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
938
938
return UR_RESULT_SUCCESS;
939
939
}
940
940
case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: {
941
- // Have to convert size_t to uint32_t
942
- size_t SubGroupSizesSize = 0 ;
943
- CL_RETURN_ON_FAILURE (
944
- clGetDeviceInfo (cl_adapter::cast<cl_device_id >(hDevice), CLPropName, 0 ,
945
- nullptr , &SubGroupSizesSize));
946
- std::vector<size_t > SubGroupSizes (SubGroupSizesSize / sizeof (size_t ));
947
- CL_RETURN_ON_FAILURE (
948
- clGetDeviceInfo (cl_adapter::cast<cl_device_id >(hDevice), CLPropName,
949
- SubGroupSizesSize, SubGroupSizes.data (), nullptr ));
950
- return ReturnValue.template operator ()<uint32_t >(SubGroupSizes.data (),
951
- SubGroupSizes.size ());
941
+ /* CL_DEVICE_SUB_GROUP_SIZES_INTEL is only supported if the device has the
942
+ * cl_intel_required_subgroup_size extension.
943
+ * */
944
+ bool Supported = false ;
945
+ CL_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
946
+ cl_adapter::cast<cl_device_id >(hDevice),
947
+ {" cl_intel_required_subgroup_size" }, Supported));
948
+ if (Supported) {
949
+ // Have to convert size_t to uint32_t
950
+ size_t SubGroupSizesSize = 0 ;
951
+ CL_RETURN_ON_FAILURE (
952
+ clGetDeviceInfo (cl_adapter::cast<cl_device_id >(hDevice), CLPropName,
953
+ 0 , nullptr , &SubGroupSizesSize));
954
+ std::vector<size_t > SubGroupSizes (SubGroupSizesSize / sizeof (size_t ));
955
+ CL_RETURN_ON_FAILURE (
956
+ clGetDeviceInfo (cl_adapter::cast<cl_device_id >(hDevice), CLPropName,
957
+ SubGroupSizesSize, SubGroupSizes.data (), nullptr ));
958
+ return ReturnValue.template operator ()<uint32_t >(SubGroupSizes.data (),
959
+ SubGroupSizes.size ());
960
+ } else {
961
+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
962
+ }
952
963
}
953
964
case UR_DEVICE_INFO_EXTENSIONS: {
954
965
cl_device_id Dev = cl_adapter::cast<cl_device_id >(hDevice);
0 commit comments