[Openmp-commits] [openmp] [OpenMP][libomptarget] Enable automatic unified shared memory executi… (PR #75999)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 19 19:47:24 PST 2023


================
@@ -3109,6 +3126,47 @@ struct AMDGPUPluginTy final : public GenericPluginTy {
     return HSA_STATUS_ERROR;
   }
 
+  /// Detect if current architecture is an APU.
+  void isAPU() {
+    char GfxName[64];
+
+    if (!KernelAgents.size())
+      return;
+
+    // Do not allow for mixed APU+discrete GPU combinations: an APU can only be
+    // that, so only check the first GPU agent.
+    hsa_agent_t GPUAgent = KernelAgents[0];
+    std::memset((void *)&GfxName, 0, sizeof(char) * 64);
+
+    hsa_status_t Status = hsa_agent_get_info(
+        GPUAgent, (hsa_agent_info_t)HSA_AGENT_INFO_NAME, GfxName);
+    if (Status != HSA_STATUS_SUCCESS)
+      return;
+
+    std::string StrGfxName(GfxName);
+    std::transform(std::begin(StrGfxName), std::end(StrGfxName),
+                   std::begin(StrGfxName),
+                   [](char c) { return std::tolower(c); });
----------------
jdoerfert wrote:

If we assume the case might not be uniform, let's do the transform when we initialize ComputeUnitKind.

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


More information about the Openmp-commits mailing list