[Openmp-commits] [openmp] [OpenMP][AMDGPU] Add interop support for OpenMP AMD GPU plugin (PR #88000)

Michael Halkenhäuser via Openmp-commits openmp-commits at lists.llvm.org
Mon Apr 15 02:25:11 PDT 2024


================
@@ -11,33 +11,130 @@
 #ifndef OMPTARGET_OPENMP_INTEROP_API_H
 #define OMPTARGET_OPENMP_INTEROP_API_H
 
-#include "omp.h"
+#define omp_interop_none 0
 
+#include "omp.h"
 #include "omptarget.h"
 
 extern "C" {
 
+/// TODO: Include the `omp.h` of the current build
+/* OpenMP 5.1 interop */
+typedef intptr_t omp_intptr_t;
+
+/* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined
+ * properties */
+typedef enum omp_interop_property {
+  omp_ipr_fr_id = -1,
+  omp_ipr_fr_name = -2,
+  omp_ipr_vendor = -3,
+  omp_ipr_vendor_name = -4,
+  omp_ipr_device_num = -5,
+  omp_ipr_platform = -6,
+  omp_ipr_device = -7,
+  omp_ipr_device_context = -8,
+  omp_ipr_targetsync = -9,
+  omp_ipr_first = -9
+} omp_interop_property_t;
+
+typedef enum omp_interop_rc {
+  omp_irc_no_value = 1,
+  omp_irc_success = 0,
+  omp_irc_empty = -1,
+  omp_irc_out_of_range = -2,
+  omp_irc_type_int = -3,
+  omp_irc_type_ptr = -4,
+  omp_irc_type_str = -5,
+  omp_irc_other = -6
+} omp_interop_rc_t;
+
+typedef enum omp_interop_fr {
+  omp_ifr_cuda = 1,
+  omp_ifr_cuda_driver = 2,
+  omp_ifr_opencl = 3,
+  omp_ifr_sycl = 4,
+  omp_ifr_hip = 5,
+  omp_ifr_level_zero = 6,
+  omp_ifr_amdhsa = 7,
----------------
mhalk wrote:

Sorry for the high latency!
Basically, I rebased the former phabricator review, which was accepted back then.

>From what I could gather: there are plans to add amdhsa/ROCr interoperability with OpenMP.
So, this PR may be seen as a precursor -- albeit I have no ETA on the actual amdhsa interoperability.

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


More information about the Openmp-commits mailing list