[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
Thu Jul 24 16:49:43 PDT 2025


================
@@ -1342,6 +1405,80 @@ 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) {
+    assert(InteropSpec && "Interop spec is null");
+    auto &Device = getDevice(ID);
+    auto InteropOrErr = Device.createInterop(InteropContext, *InteropSpec);
+    if (!InteropOrErr) {
+      REPORT("Failure to create interop object for device " DPxMOD ": %s\n",
+             DPxPTR(InteropSpec), toString(InteropOrErr.takeError()).c_str());
+      return nullptr;
+    }
+    return *InteropOrErr;
+  }
----------------
kevinsala wrote:

I'd still move these to the cpp files with the rest of bridge functions. They are not much different than those.

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


More information about the Openmp-commits mailing list