[llvm] [AMDGPU][OpenMP] Using HSA API calls for APU detection. (PR #90186)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 03:14:27 PDT 2024


================
@@ -2809,7 +2815,21 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
 
   /// Detect if current architecture is an APU.
   Error checkIfAPU() {
-    // TODO: replace with ROCr API once it becomes available.
+#if (HIP_VERSION_MAJOR >= 6 && HIP_VERSION_MINOR >= 1)
+
+    uint8_t MemoryProperties[8];
+
+    hsa_status_t Stat = hsa_agent_get_info(
+        getAgent(), (hsa_agent_info_t)HSA_AMD_AGENT_INFO_MEMORY_PROPERTIES,
+        MemoryProperties);
+
+    if (auto Err = Plugin::check(Stat, "Error: Unable to fetch the memory "
+                                       "properties of the GPU. (%s)\n"))
----------------
arsenm wrote:

Can we get a better / not generic error from Stat? 

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


More information about the llvm-commits mailing list