From dc94f2cbadfd192fe3d43bd00fd5a1d0ead5ab8d Mon Sep 17 00:00:00 2001 From: Robert Imschweiler Date: Tue, 4 Nov 2025 20:15:47 +0100 Subject: [Offload] Add device UID (#164391) Introduced in OpenMP 6.0, the device UID shall be a unique identifier of a device on a given system. (Not necessarily a UUID.) Since it is not guaranteed that the (U)UIDs defined by the device vendor libraries, such as HSA, do not overlap with those of other vendors, the device UIDs in offload are always combined with the offload plugin name. In case the vendor library does not specify any device UID for a given device, we fall back to the offload-internal device ID. The device UID can be retrieved using the `llvm-offload-device-info` tool. --- offload/liboffload/src/OffloadImpl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'offload/liboffload/src/OffloadImpl.cpp') diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp index 6d22faeb0e57..84bc41439681 100644 --- a/offload/liboffload/src/OffloadImpl.cpp +++ b/offload/liboffload/src/OffloadImpl.cpp @@ -147,8 +147,8 @@ llvm::Error ol_platform_impl_t::init() { if (llvm::Error Err = Plugin->initDevice(Id)) return Err; - auto Device = &Plugin->getDevice(Id); - auto Info = Device->obtainInfoImpl(); + GenericDeviceTy *Device = &Plugin->getDevice(Id); + llvm::Expected Info = Device->obtainInfo(); if (llvm::Error Err = Info.takeError()) return Err; Devices.emplace_back(std::make_unique(Id, Device, *this, @@ -467,6 +467,7 @@ Error olGetDeviceInfoImplDetail(ol_device_handle_t Device, switch (PropName) { case OL_DEVICE_INFO_NAME: case OL_DEVICE_INFO_PRODUCT_NAME: + case OL_DEVICE_INFO_UID: case OL_DEVICE_INFO_VENDOR: case OL_DEVICE_INFO_DRIVER_VERSION: { // String values @@ -544,6 +545,8 @@ Error olGetDeviceInfoImplDetailHost(ol_device_handle_t Device, return Info.writeString("Virtual Host Device"); case OL_DEVICE_INFO_PRODUCT_NAME: return Info.writeString("Virtual Host Device"); + case OL_DEVICE_INFO_UID: + return Info.writeString(GenericPluginTy::getHostDeviceUid()); case OL_DEVICE_INFO_VENDOR: return Info.writeString("Liboffload"); case OL_DEVICE_INFO_DRIVER_VERSION: -- cgit v1.2.3