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

Thorsten Blaß via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 02:56:08 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"))
----------------
ThorBl wrote:

I'm not aware there is a way to get a more precise error description than what is encoded in the hsa_status_t enum. I will have another look to see if I can find anything, though. 

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


More information about the llvm-commits mailing list