[llvm] [Offload] Add `MAX_WORK_GROUP_SIZE` device info query (PR #143718)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 07:04:52 PDT 2025


================
@@ -247,11 +244,50 @@ Error olGetDeviceInfoImplDetail(ol_device_handle_t Device,
                                DevInfo.getQueue().end(), InfoKeyMatches);
 
       if (Item != std::end(DevInfo.getQueue())) {
-        return Item->Value;
+        return Item;
       }
     }
 
-    return std::string("");
+    return std::nullopt;
+  };
+  auto GetInfoString = [&](llvm::SmallVector<StringRef> Names) {
+    InfoQueueTy DevInfo;
+
+    if (auto Item = FindInfo(DevInfo, Names)) {
+      return (*Item)->Value.c_str();
+    } else {
+      return "";
+    }
+  };
+  auto GetInfoXyz = [&](llvm::SmallVector<StringRef> Names) {
----------------
RossBrunton wrote:

We want to use this function like `return ReturnValue(GetInfoString({"Vendor Name"}));` where the argument is passed as an initialiser list. Therefore it can't be an lvalue.

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


More information about the llvm-commits mailing list