@@ -1065,6 +1065,25 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10651065 CL_DEVICE_UUID_KHR, UUID.size (), UUID.data (), nullptr ));
10661066 return ReturnValue (UUID);
10671067 }
1068+ case UR_DEVICE_INFO_PCI_ADDRESS: {
1069+ bool isKhrPciBusInfoSupported = false ;
1070+ if (cl_adapter::checkDeviceExtensions (
1071+ cl_adapter::cast<cl_device_id>(hDevice), {" cl_khr_pci_bus_info" },
1072+ isKhrPciBusInfoSupported) != UR_RESULT_SUCCESS ||
1073+ !isKhrPciBusInfoSupported) {
1074+ return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
1075+ }
1076+ cl_device_pci_bus_info_khr PciBusInfo{};
1077+ CL_RETURN_ON_FAILURE (clGetDeviceInfo (
1078+ cl_adapter::cast<cl_device_id>(hDevice), CL_DEVICE_PCI_BUS_INFO_KHR,
1079+ sizeof (PciBusInfo), &PciBusInfo, nullptr ));
1080+ // PCI address in BDF format requires 13 bytes DOMA:BU:DE.F + null bytes
1081+ std::array<char , 13 > PciAddr;
1082+ std::snprintf (PciAddr.data (), PciAddr.size (), " %.4x:%.2x:%.2x.%x" ,
1083+ PciBusInfo.pci_domain , PciBusInfo.pci_bus ,
1084+ PciBusInfo.pci_device , PciBusInfo.pci_function );
1085+ return ReturnValue (PciAddr);
1086+ }
10681087
10691088 case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS: {
10701089 return ReturnValue (false );
@@ -1080,7 +1099,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
10801099 * the Registry. */
10811100 case UR_DEVICE_INFO_COMPONENT_DEVICES:
10821101 case UR_DEVICE_INFO_COMPOSITE_DEVICE:
1083- case UR_DEVICE_INFO_PCI_ADDRESS:
10841102 case UR_DEVICE_INFO_GPU_EU_COUNT:
10851103 case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH:
10861104 case UR_DEVICE_INFO_GPU_EU_SLICES:
0 commit comments