[llvm] [Offload][omp] Get Plugin active count and Device UID through liboffload (PR #230109)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 02:36:02 PDT 2026


================
@@ -86,6 +86,23 @@ DeviceTy::~DeviceTy() {
 }
 
 llvm::Error DeviceTy::init() {
+  size_t UidSize = 0;
+  if (!olGetDeviceInfoSize(DeviceHandle, OL_DEVICE_INFO_UID, &UidSize) &&
+      UidSize > 0) {
+    Uid.resize(UidSize);
+    if (olGetDeviceInfo(DeviceHandle, OL_DEVICE_INFO_UID, UidSize, Uid.data()))
+      Uid.clear();
+    else
+      // Drop the null terminator from the size but keep it in the buffer, so
+      // that getUid() can be handed out as a C string.
+      Uid.pop_back();
+  }
+  if (Uid.empty()) {
+    ODBG(ODT_Init) << "Failed to get UID for device " << DeviceID;
+    // An empty SmallString is not guaranteed to be null-terminated.
+    Uid.c_str();
----------------
ro-i wrote:

uh sure, nvm, got confused for a second 🙈 

https://github.com/llvm/llvm-project/pull/230109


More information about the llvm-commits mailing list