[Openmp-commits] [openmp] [Libomptarget] Remove unused 'SupportsEmptyImages' API function (PR #80316)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 1 10:15:04 PST 2024


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/80316

Summary:
This function is always false in the current implementation and is not
even considered required. Just remove it and if someone needs it in the
future they can add it back in. This is done to simplify the interface
prior to other changes


>From 62aff020de24e39cfae7fd16a4a55e49f25543d4 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Thu, 1 Feb 2024 12:13:52 -0600
Subject: [PATCH] [Libomptarget] Remove unused 'SupportsEmptyImages' API
 function

Summary:
This function is always false in the current implementation and is not
even considered required. Just remove it and if someone needs it in the
future they can add it back in. This is done to simplify the interface
prior to other changes
---
 openmp/libomptarget/include/Shared/PluginAPI.h               | 5 -----
 openmp/libomptarget/include/Shared/PluginAPI.inc             | 1 -
 .../plugins-nextgen/common/include/PluginInterface.h         | 3 ---
 .../plugins-nextgen/common/src/PluginInterface.cpp           | 4 ----
 openmp/libomptarget/src/omptarget.cpp                        | 5 +----
 5 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/openmp/libomptarget/include/Shared/PluginAPI.h b/openmp/libomptarget/include/Shared/PluginAPI.h
index 5de5f106045b5..ecf669c774f14 100644
--- a/openmp/libomptarget/include/Shared/PluginAPI.h
+++ b/openmp/libomptarget/include/Shared/PluginAPI.h
@@ -40,11 +40,6 @@ int32_t __tgt_rtl_is_valid_binary(__tgt_device_image *Image);
 // function to move data from source device to destination device directly.
 int32_t __tgt_rtl_is_data_exchangable(int32_t SrcDevId, int32_t DstDevId);
 
-// Return an integer other than zero if the plugin can handle images which do
-// not contain target regions and global variables (but can contain other
-// functions)
-int32_t __tgt_rtl_supports_empty_images();
-
 // Initialize the requires flags for the device.
 int64_t __tgt_rtl_init_requires(int64_t RequiresFlags);
 
diff --git a/openmp/libomptarget/include/Shared/PluginAPI.inc b/openmp/libomptarget/include/Shared/PluginAPI.inc
index 5f8a9dd11fdce..3b982e30307ac 100644
--- a/openmp/libomptarget/include/Shared/PluginAPI.inc
+++ b/openmp/libomptarget/include/Shared/PluginAPI.inc
@@ -33,7 +33,6 @@ PLUGIN_API_HANDLE(launch_kernel, true);
 PLUGIN_API_HANDLE(init_requires, false);
 PLUGIN_API_HANDLE(synchronize, false);
 PLUGIN_API_HANDLE(query_async, false);
-PLUGIN_API_HANDLE(supports_empty_images, false);
 PLUGIN_API_HANDLE(set_info_flag, false);
 PLUGIN_API_HANDLE(print_device_info, false);
 PLUGIN_API_HANDLE(create_event, false);
diff --git a/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h b/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
index 3c2a4d7e6c0e7..9645ab2a67262 100644
--- a/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
+++ b/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
@@ -1048,9 +1048,6 @@ struct GenericPluginTy {
   /// we could not move this function into GenericDeviceTy.
   virtual Expected<bool> isELFCompatible(StringRef Image) const = 0;
 
-  /// Indicate whether the plugin supports empty images.
-  virtual bool supportsEmptyImages() const { return false; }
-
 protected:
   /// Indicate whether a device id is valid.
   bool isValidDeviceId(int32_t DeviceId) const {
diff --git a/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp b/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
index def9c14fa53f8..8c8c52de0c210 100644
--- a/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
@@ -1620,10 +1620,6 @@ int32_t __tgt_rtl_is_valid_binary(__tgt_device_image *Image) {
   }
 }
 
-int32_t __tgt_rtl_supports_empty_images() {
-  return Plugin::get().supportsEmptyImages();
-}
-
 int32_t __tgt_rtl_init_device(int32_t DeviceId) {
   auto Err = Plugin::get().initDevice(DeviceId);
   if (Err) {
diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index 5b852495b7501..25863540c975e 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -140,16 +140,13 @@ static int initLibrary(DeviceTy &Device) {
    */
   int32_t DeviceId = Device.DeviceID;
   int Rc = OFFLOAD_SUCCESS;
-  bool SupportsEmptyImages = Device.RTL->supports_empty_images &&
-                             Device.RTL->supports_empty_images() > 0;
   {
     std::lock_guard<decltype(PM->TrlTblMtx)> LG(PM->TrlTblMtx);
     for (auto *HostEntriesBegin : PM->HostEntriesBeginRegistrationOrder) {
       TranslationTable *TransTable =
           &PM->HostEntriesBeginToTransTable[HostEntriesBegin];
       if (TransTable->HostTable.EntriesBegin ==
-              TransTable->HostTable.EntriesEnd &&
-          !SupportsEmptyImages) {
+          TransTable->HostTable.EntriesEnd) {
         // No host entry so no need to proceed
         continue;
       }



More information about the Openmp-commits mailing list