[Openmp-commits] [PATCH] D133541: [Libomptarget] Register OpenMP requires flags using the new interface

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Sep 8 16:55:01 PDT 2022


jhuber6 created this revision.
jhuber6 added reviewers: tianshilei1992, JonChesterfield, ye-luo, jdoerfert, ronlieb.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

A previous patch changed how we perform the generation of `omp requires`
flags. This patch adds the necessary support to the runtime and removes
the old interface.

Depends on D133539 <https://reviews.llvm.org/D133539>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133541

Files:
  openmp/libomptarget/include/omptarget.h
  openmp/libomptarget/src/LegacyAPI.cpp
  openmp/libomptarget/src/interface.cpp
  openmp/libomptarget/src/rtl.cpp


Index: openmp/libomptarget/src/rtl.cpp
===================================================================
--- openmp/libomptarget/src/rtl.cpp
+++ openmp/libomptarget/src/rtl.cpp
@@ -423,6 +423,13 @@
 void RTLsTy::registerLib(__tgt_bin_desc *Desc) {
   PM->RTLsMtx.lock();
 
+  for (int64_t *RequiresB = Desc->RegisterRequiresBegin,
+               *RequiresE = Desc->RegisterRequiresEnd;
+       RequiresB != RequiresE; ++RequiresB) {
+    if (*RequiresB != OMP_REQ_UNDEFINED)
+      registerRequires(*RequiresB);
+  }
+
   // Extract the exectuable image and extra information if availible.
   for (int32_t i = 0; i < Desc->NumDeviceImages; ++i)
     PM->Images.emplace_back(getExecutableImage(&Desc->DeviceImages[i]),
Index: openmp/libomptarget/src/interface.cpp
===================================================================
--- openmp/libomptarget/src/interface.cpp
+++ openmp/libomptarget/src/interface.cpp
@@ -21,13 +21,6 @@
 #include <cstdlib>
 #include <mutex>
 
-////////////////////////////////////////////////////////////////////////////////
-/// adds requires flags
-EXTERN void __tgt_register_requires(int64_t Flags) {
-  TIMESCOPE();
-  PM->RTLs.registerRequires(Flags);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 /// adds a target shared library to the target execution image
 EXTERN void __tgt_register_lib(__tgt_bin_desc *Desc) {
Index: openmp/libomptarget/src/LegacyAPI.cpp
===================================================================
--- openmp/libomptarget/src/LegacyAPI.cpp
+++ openmp/libomptarget/src/LegacyAPI.cpp
@@ -172,3 +172,7 @@
                                          uint64_t LoopTripcount) {
   __kmpc_push_target_tripcount_mapper(nullptr, DeviceId, LoopTripcount);
 }
+
+EXTERN void __tgt_register_requires(int64_t Flags) {
+  DP("__tgt_register_requires has been deprecated");
+}
Index: openmp/libomptarget/include/omptarget.h
===================================================================
--- openmp/libomptarget/include/omptarget.h
+++ openmp/libomptarget/include/omptarget.h
@@ -155,6 +155,8 @@
   __tgt_device_image *DeviceImages;  // Array of device images (1 per dev. type)
   __tgt_offload_entry *HostEntriesBegin; // Begin of table with all host entries
   __tgt_offload_entry *HostEntriesEnd;   // End of table (non inclusive)
+  int64_t *RegisterRequiresBegin; // Begin of requires flag array.
+  int64_t *RegisterRequiresEnd;   // End of requires flag array.
 };
 
 /// This struct contains the offload entries identified by the target runtime


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133541.458917.patch
Type: text/x-patch
Size: 2553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220908/b44da550/attachment.bin>


More information about the Openmp-commits mailing list