[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 08:13:43 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) {
+ InfoQueueTy DevInfo;
+
+ if (auto Item = FindInfo(DevInfo, Names)) {
+ auto Iter = *Item;
+ ol_dimensions_t Out{0, 0, 0};
+ auto Level = Iter->Level + 1;
+
+ while ((++Iter)->Level == Level) {
+ switch (Iter->Key[0]) {
+ case 'x':
+ Out.x = std::stoi(Iter->Value);
+ break;
+ case 'y':
+ Out.y = std::stoi(Iter->Value);
+ break;
+ case 'z':
+ Out.z = std::stoi(Iter->Value);
+ break;
+ default:
+ // Ignore any extra values
+ (void)0;
----------------
RossBrunton wrote:
C++ (before 23, apparently) requires labels to be attached to statements, hence the no-op statement.
But I'll just move the comment out of the switch entirely, since it's kinda confusing.
https://github.com/llvm/llvm-project/pull/143718
More information about the llvm-commits
mailing list