@@ -323,6 +323,14 @@ static cl_int mapURDeviceInfoToCL(ur_device_info_t URPropName) {
323323 return CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL;
324324 case UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT:
325325 return CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL;
326+ case UR_DEVICE_INFO_GPU_EU_SLICES:
327+ return CL_DEVICE_NUM_SLICES_INTEL;
328+ case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
329+ return CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL;
330+ case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
331+ return CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL;
332+ case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
333+ return CL_DEVICE_NUM_THREADS_PER_EU_INTEL;
326334 case UR_DEVICE_INFO_IP_VERSION:
327335 return CL_DEVICE_IP_VERSION_INTEL;
328336 default :
@@ -369,18 +377,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
369377 case UR_DEVICE_INFO_DEVICE_ID: {
370378 bool Supported = false ;
371379 UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
372- cl_adapter::cast<cl_device_id>(hDevice), { " cl_khr_pci_bus_info " },
373- Supported));
380+ cl_adapter::cast<cl_device_id>(hDevice),
381+ { " cl_intel_device_attribute_query " }, Supported));
374382
375383 if (!Supported) {
376384 return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
377385 }
378386
379- cl_device_pci_bus_info_khr PciInfo = {};
380387 CL_RETURN_ON_FAILURE (clGetDeviceInfo (
381- cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_PCI_BUS_INFO_KHR,
382- sizeof (PciInfo), &PciInfo, nullptr ));
383- return ReturnValue (PciInfo.pci_device );
388+ cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_ID_INTEL, propSize,
389+ pPropValue, pPropSizeRet));
390+
391+ return UR_RESULT_SUCCESS;
384392 }
385393
386394 case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: {
@@ -993,6 +1001,58 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
9931001
9941002 return UR_RESULT_SUCCESS;
9951003 }
1004+ case UR_DEVICE_INFO_PCI_ADDRESS: {
1005+ bool Supported = false ;
1006+ UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
1007+ cl_adapter::cast<cl_device_id>(hDevice), {" cl_khr_pci_bus_info" },
1008+ Supported));
1009+
1010+ if (!Supported) {
1011+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
1012+ }
1013+
1014+ cl_device_pci_bus_info_khr PciInfo = {};
1015+ CL_RETURN_ON_FAILURE (clGetDeviceInfo (
1016+ cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_PCI_BUS_INFO_KHR,
1017+ sizeof (PciInfo), &PciInfo, nullptr ));
1018+
1019+ constexpr size_t AddressBufferSize = 13 ;
1020+ char AddressBuffer[AddressBufferSize];
1021+ std::snprintf (AddressBuffer, AddressBufferSize, " %04x:%02x:%02x.%01x" ,
1022+ PciInfo.pci_domain , PciInfo.pci_bus , PciInfo.pci_device ,
1023+ PciInfo.pci_function );
1024+ return ReturnValue (AddressBuffer);
1025+ }
1026+ case UR_DEVICE_INFO_GPU_EU_COUNT: {
1027+ /* The EU count can be queried using CL_DEVICE_MAX_COMPUTE_UNITS for Intel
1028+ * GPUs. */
1029+
1030+ bool Supported;
1031+ UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
1032+ cl_adapter::cast<cl_device_id>(hDevice),
1033+ {" cl_intel_device_attribute_query" }, Supported));
1034+ if (!Supported) {
1035+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
1036+ }
1037+
1038+ cl_device_type CLType;
1039+ CL_RETURN_ON_FAILURE (
1040+ clGetDeviceInfo (cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_TYPE,
1041+ sizeof (cl_device_type), &CLType, nullptr ));
1042+ if (!(CLType & CL_DEVICE_TYPE_GPU)) {
1043+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
1044+ }
1045+
1046+ CL_RETURN_ON_FAILURE (clGetDeviceInfo (
1047+ cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_MAX_COMPUTE_UNITS,
1048+ propSize, pPropValue, pPropSizeRet));
1049+
1050+ return UR_RESULT_SUCCESS;
1051+ }
1052+ case UR_DEVICE_INFO_GPU_EU_SLICES:
1053+ case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
1054+ case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
1055+ case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
9961056 case UR_DEVICE_INFO_IP_VERSION: {
9971057 bool Supported;
9981058 UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
@@ -1080,13 +1140,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10801140 * the Registry. */
10811141 case UR_DEVICE_INFO_COMPONENT_DEVICES:
10821142 case UR_DEVICE_INFO_COMPOSITE_DEVICE:
1083- case UR_DEVICE_INFO_PCI_ADDRESS:
1084- case UR_DEVICE_INFO_GPU_EU_COUNT:
10851143 case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
1086- case UR_DEVICE_INFO_GPU_EU_SLICES:
1087- case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
1088- case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
1089- case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
10901144 case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH:
10911145 /* This enums have no equivalent in OpenCL */
10921146 case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP:
0 commit comments