1010#include " common.hpp"
1111#include " platform.hpp"
1212
13+ #include < array>
1314#include < cassert>
1415
1516ur_result_t cl_adapter::getDeviceVersion (cl_device_id Dev,
@@ -941,6 +942,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
941942 }
942943 return ReturnValue (SupportedExtensions.c_str ());
943944 }
945+
946+ case UR_DEVICE_INFO_UUID: {
947+ // Use the cl_khr_device_uuid extension, if available.
948+ bool isKhrDeviceUuidSupported = false ;
949+ if (cl_adapter::checkDeviceExtensions (
950+ cl_adapter::cast<cl_device_id>(hDevice), {" cl_khr_device_uuid" },
951+ isKhrDeviceUuidSupported) != UR_RESULT_SUCCESS ||
952+ !isKhrDeviceUuidSupported) {
953+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
954+ }
955+ static_assert (CL_UUID_SIZE_KHR == 16 );
956+ std::array<uint8_t , CL_UUID_SIZE_KHR> UUID{};
957+ CL_RETURN_ON_FAILURE (
958+ clGetDeviceInfo (cl_adapter::cast<cl_device_id>(hDevice),
959+ CL_DEVICE_UUID_KHR, UUID.size (), UUID.data (), nullptr ));
960+ return ReturnValue (UUID);
961+ }
962+
944963 case UR_DEVICE_INFO_COMPONENT_DEVICES:
945964 case UR_DEVICE_INFO_COMPOSITE_DEVICE:
946965 // These two are exclusive of L0.
@@ -957,10 +976,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
957976 case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
958977 case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
959978 case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH:
960- /* TODO: Check if device UUID extension is enabled in OpenCL. For details
961- * about Intel UUID extension, see
962- * sycl/doc/extensions/supported/sycl_ext_intel_device_info.md */
963- case UR_DEVICE_INFO_UUID:
964979 /* This enums have no equivalent in OpenCL */
965980 case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP:
966981 case UR_DEVICE_INFO_GLOBAL_MEM_FREE:
0 commit comments