[Openmp-commits] [openmp] [Libomptarget] Only initialize a plugin if a device image needs it (PR #76174)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 21 15:36:16 PST 2023


================
@@ -20,14 +20,27 @@
 #include "Shared/APITypes.h"
 
 extern "C" {
-
 // First method called on the plugin
 int32_t __tgt_rtl_init_plugin();
 
+// Returns non-zero if the plugin has been initialized.
+int32_t __tgt_rtl_is_plugin_active();
+
 // Return the number of available devices of the type supported by the
 // target RTL.
 int32_t __tgt_rtl_number_of_devices(void);
 
+// Returns a non-zero integer if the given Image is capable of being run by the
+// plugin. This is intended to be called without initializing the plugin.
+int32_t __tgt_rtl_is_binary_compatible(__tgt_device_image *Image);
+
+// Return an integer different from zero if the provided device image can be
+// supported by the runtime. The functionality is similar to comparing the
+// result of __tgt__rtl__load__binary to NULL. However, this is meant to be a
+// lightweight query to determine if the RTL is suitable for an image without
+// having to load the library, which can be expensive.
+int32_t __tgt_rtl_is_valid_binary(__tgt_device_image *Image);
+
----------------
jdoerfert wrote:

Duplicated from below?

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


More information about the Openmp-commits mailing list