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

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


================
@@ -205,13 +205,16 @@ Expected<std::string> getTargetTripleAndFeatures(hsa_agent_t Agent) {
       return Status;
 
     llvm::StringRef TripleTarget(ISAName.begin(), Length);
-    if (TripleTarget.consume_front("amdgcn-amd-amdhsa"))
-      Target = TripleTarget.ltrim('-').rtrim('\0').str();
-    return HSA_STATUS_INFO_BREAK;
+    if (TripleTarget.consume_front("amdgcn-amd-amdhsa")) {
+      auto Target = TripleTarget.ltrim('-').rtrim('\0').str();
+      if (Target.find("generic") != std::string::npos)
----------------
jhuber6 wrote:

`Target.ends_with("generic")` would be better.

That being said I don't think this is a good way to handle this. We should just get every isa here and then sort it later. This logic just confused me because we either assume 1. that the non-generic ISA is already first, in which case this is unnecessary, or 2 it's in any order in where we will then write the generic target, then overwrite it with the non-generic one later.

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


More information about the llvm-commits mailing list