[Openmp-commits] [openmp] 716bae0 - [Libomptarget] Include "hsa/hsa.h" instead

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 23 06:56:23 PST 2023


Author: Joseph Huber
Date: 2023-01-23T08:56:03-06:00
New Revision: 716bae0b48375ce59ff107df0997f279a41dfec9

URL: https://github.com/llvm/llvm-project/commit/716bae0b48375ce59ff107df0997f279a41dfec9
DIFF: https://github.com/llvm/llvm-project/commit/716bae0b48375ce59ff107df0997f279a41dfec9.diff

LOG: [Libomptarget] Include "hsa/hsa.h" instead

Summary:
Recently AMD moved the "hsa.h" include to "hsa/hsa.h". This causes
several warning. This patch checks to see if we can include that one
instead. This should hopefully keep things backwards compatible while
silencing the warnings.

Added: 
    

Modified: 
    openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
    openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 457c1e57f3e0c..2bbe3f7cbbf08 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -14,8 +14,6 @@
 #include <cassert>
 #include <cstddef>
 #include <deque>
-#include <hsa.h>
-#include <hsa_ext_amd.h>
 #include <mutex>
 #include <string>
 #include <system_error>
@@ -42,6 +40,17 @@
 #include "llvm/Support/Program.h"
 #include "llvm/Support/raw_ostream.h"
 
+#if defined(__has_include)
+#if __has_include("hsa/hsa.h")
+#include "hsa/hsa.h"
+#include "hsa/hsa_ext_amd.h"
+#elif __has_include("hsa.h")
+#include "hsa.h"
+#include "hsa_ext_amd.h"
+#endif
+#include "hsa/hsa.h"
+#endif
+
 namespace llvm {
 namespace omp {
 namespace target {

diff  --git a/openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h b/openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h
index a293bdc83d14b..241d589533d08 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h
+++ b/openmp/libomptarget/plugins/amdgpu/impl/hsa_api.h
@@ -8,7 +8,19 @@
 #ifndef AMDGPU_HSA_API_H_INCLUDED
 #define AMDGPU_HSA_API_H_INCLUDED
 
+#if defined(__has_include)
+#if __has_include("hsa/hsa.h")
+#include "hsa/hsa.h"
+#include "hsa/hsa_ext_amd.h"
+#elif __has_include("hsa.h")
 #include "hsa.h"
 #include "hsa_ext_amd.h"
+#endif
+#else
+#include "hsa/hsa.h"
+#include "hsa_ext_amd.h"
+#endif
+
+
 
 #endif


        


More information about the Openmp-commits mailing list