[llvm] [Offload][AMDGPU] accept generic target (PR #118919)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 20:24:48 PST 2024


================
@@ -1988,12 +1991,11 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
       return Err;
 
     // Detect if XNACK is enabled
-    auto TargeTripleAndFeaturesOrError =
-        hsa_utils::getTargetTripleAndFeatures(Agent);
-    if (!TargeTripleAndFeaturesOrError)
-      return TargeTripleAndFeaturesOrError.takeError();
-    if (static_cast<StringRef>(*TargeTripleAndFeaturesOrError)
-            .contains("xnack+"))
+    SmallVector<std::string> Targets;
+    Targets.push_back("");
+    if (auto Err = hsa_utils::getTargetTripleAndFeatures(Agent, Targets))
+      return Err;
+    if (Targets[0].find("xnack+") != std::string::npos)
----------------
jhuber6 wrote:

Using std::string instead of `StringRef` or `SmallString` is annoying because of these awful `npos` checks.

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


More information about the llvm-commits mailing list