[Openmp-commits] [openmp] [OpenMP] Enable automatic unified shared memory on MI300A. (PR #77512)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 16 14:23:42 PST 2024


================
@@ -183,6 +183,29 @@ Error asyncMemCopy(bool UseMultipleSdmaEngines, void *Dst, hsa_agent_t DstAgent,
 #endif
 }
 
+Expected<std::string> getTargetTripleAndFeatures(hsa_agent_t Agent) {
+  std::string Target;
+  auto Err = utils::iterateAgentISAs(Agent, [&](hsa_isa_t ISA) {
+    uint32_t Length;
+    hsa_status_t Status;
+    Status = hsa_isa_get_info_alt(ISA, HSA_ISA_INFO_NAME_LENGTH, &Length);
+    if (Status != HSA_STATUS_SUCCESS)
+      return Status;
+
+    llvm::SmallVector<char> ISAName(Length);
+    Status = hsa_isa_get_info_alt(ISA, HSA_ISA_INFO_NAME, ISAName.begin());
+    if (Status != HSA_STATUS_SUCCESS)
+      return Status;
+
+    llvm::StringRef TripleTarget(ISAName.begin(), Length);
+    if (TripleTarget.consume_front("amdgcn-amd-amdhsa"))
+      Target = TripleTarget.ltrim('-').rtrim('\0').str();
+    return HSA_STATUS_SUCCESS;
----------------
jhuber6 wrote:

I never looked at this much, what's the expected result here if there are multiple ISAs? Isn't there `HSA_STATUS_INFO_BREAK` to make the iterator stop?

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


More information about the Openmp-commits mailing list