@@ -323,6 +323,14 @@ static cl_int mapURDeviceInfoToCL(ur_device_info_t URPropName) {
323
323
return CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL;
324
324
case UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT:
325
325
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;
326
334
case UR_DEVICE_INFO_IP_VERSION:
327
335
return CL_DEVICE_IP_VERSION_INTEL;
328
336
default :
@@ -369,18 +377,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
369
377
case UR_DEVICE_INFO_DEVICE_ID: {
370
378
bool Supported = false ;
371
379
UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
372
- cl_adapter::cast<cl_device_id >(hDevice), {" cl_khr_pci_bus_info " },
380
+ cl_adapter::cast<cl_device_id >(hDevice), {" cl_intel_device_attribute_query " },
373
381
Supported));
374
382
375
383
if (!Supported) {
376
384
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
377
385
}
378
386
379
- cl_device_pci_bus_info_khr PciInfo = {};
387
+ cl_uint DeviceId = {};
380
388
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 );
389
+ cl_adapter::cast<cl_device_id >(hDevice), CL_DEVICE_ID_INTEL ,
390
+ sizeof (DeviceId ), &DeviceId , nullptr ));
391
+ return ReturnValue (DeviceId );
384
392
}
385
393
386
394
case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: {
@@ -993,6 +1001,60 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
993
1001
994
1002
return UR_RESULT_SUCCESS;
995
1003
}
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 ,
1023
+ PciInfo.pci_bus ,
1024
+ PciInfo.pci_device ,
1025
+ PciInfo.pci_function );
1026
+ return ReturnValue (AddressBuffer);
1027
+ }
1028
+ case UR_DEVICE_INFO_GPU_EU_COUNT: {
1029
+ /* The EU count can be queried using CL_DEVICE_MAX_COMPUTE_UNITS for Intel
1030
+ * GPUs. */
1031
+
1032
+ bool Supported;
1033
+ UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
1034
+ cl_adapter::cast<cl_device_id >(hDevice),
1035
+ {" cl_intel_device_attribute_query" }, Supported));
1036
+ if (!Supported) {
1037
+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
1038
+ }
1039
+
1040
+ cl_device_type CLType;
1041
+ CL_RETURN_ON_FAILURE (
1042
+ clGetDeviceInfo (cl_adapter::cast<cl_device_id >(hDevice), CL_DEVICE_TYPE,
1043
+ sizeof (cl_device_type), &CLType, nullptr ));
1044
+ if (!(CLType & CL_DEVICE_TYPE_GPU)) {
1045
+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
1046
+ }
1047
+
1048
+ CL_RETURN_ON_FAILURE (clGetDeviceInfo (
1049
+ cl_adapter::cast<cl_device_id >(hDevice), CL_DEVICE_MAX_COMPUTE_UNITS,
1050
+ propSize, pPropValue, pPropSizeRet));
1051
+
1052
+ return UR_RESULT_SUCCESS;
1053
+ }
1054
+ case UR_DEVICE_INFO_GPU_EU_SLICES:
1055
+ case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE:
1056
+ case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE:
1057
+ case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
996
1058
case UR_DEVICE_INFO_IP_VERSION: {
997
1059
bool Supported;
998
1060
UR_RETURN_ON_FAILURE (cl_adapter::checkDeviceExtensions (
@@ -1080,13 +1142,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
1080
1142
* the Registry. */
1081
1143
case UR_DEVICE_INFO_COMPONENT_DEVICES:
1082
1144
case UR_DEVICE_INFO_COMPOSITE_DEVICE:
1083
- case UR_DEVICE_INFO_PCI_ADDRESS:
1084
- case UR_DEVICE_INFO_GPU_EU_COUNT:
1085
1145
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:
1090
1146
case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH:
1091
1147
/* This enums have no equivalent in OpenCL */
1092
1148
case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP:
0 commit comments