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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 10:30:46 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)
+        Targets.push_back(Target);
+      else
+        Targets[0] = Target;
----------------
shiltian wrote:

I believe each runtime should manage its own responsibilities. At the OpenMP level, a generic ISA is no different from a specific ISA. OpenMP should query HSA for a list of ISAs and check if there is an ISA matching the device image. If a match is found, the job is done, whether the ISA is generic or specific doesn't matter. If no match is found, then the agent cannot run the image.

OpenMP should not be responsible for determining whether an agent supports a particular ISA or for considering how many ISAs an agent can support. These responsibilities fall under HSA.

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


More information about the llvm-commits mailing list