[Openmp-commits] [llvm] [openmp] [OFFLOAD][OPENMP] 6.0 compatible interop interface (PR #143491)

Kevin Sala Penades via Openmp-commits openmp-commits at lists.llvm.org
Wed Jul 16 11:16:35 PDT 2025


================
@@ -1342,6 +1358,45 @@ struct GenericPluginTy {
   int32_t get_function(__tgt_device_binary Binary, const char *Name,
                        void **KernelPtr);
 
+  /// Return the interop specification that the plugin supports
+  /// It might not be one of the user specified ones.
+  interop_spec_t select_interop_preference(int32_t ID, int32_t InteropType,
+                                           int32_t NumPrefers,
+                                           interop_spec_t *Prefers) {
+    auto &Device = getDevice(ID);
+    return Device.selectInteropPreference(InteropType, NumPrefers, Prefers);
+  }
+
+  /// Create OpenMP interop with the given interop context
+  omp_interop_val_t *create_interop(int32_t ID, int32_t InteropContext,
+                                    interop_spec_t *InteropSpec) {
+    auto &Device = getDevice(ID);
+    return Device.createInterop(InteropContext, *InteropSpec);
+  }
+
+  /// Release OpenMP interop object
+  int32_t release_interop(int32_t ID, omp_interop_val_t *Interop) {
+    auto &Device = getDevice(ID);
+    return Device.releaseInterop(Interop);
+  }
+
+  /// Flush the queue associated with the interop object if necessary
+  virtual int32_t flush_queue(omp_interop_val_t *Interop) {
+    return OFFLOAD_SUCCESS;
+  }
+
+  /// Queue a synchronous barrier in the queue associated with the interop
+  /// object and wait for it to complete.
+  virtual int32_t sync_barrier(omp_interop_val_t *Interop) {
+    return OFFLOAD_FAIL;
+  }
+
+  /// Queue an asynchronous barrier in the queue associated with the interop
+  /// object and return immediately.
+  virtual int32_t async_barrier(omp_interop_val_t *Interop) {
+    return OFFLOAD_FAIL;
+  }
----------------
kevinsala wrote:

Please implement these functions in `PluginInterface.cpp`.

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


More information about the Openmp-commits mailing list