[Openmp-commits] [PATCH] D63106: [OpenMP][libomptarget] Add support for declare target to clause under unified memory

Gheorghe-Teodor Bercea via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 10 16:43:06 PDT 2019


gtbercea created this revision.
gtbercea added reviewers: ABataev, caomhin, grokos.
Herald added subscribers: openmp-commits, jdoerfert, guansong.
Herald added a project: OpenMP.

This patch adds support for handling variables under the:

  #pragma omp declare target to()

clause when the

  #pragma omp requires unified_shared_memory

is used.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D63106

Files:
  libomptarget/include/omptarget.h
  libomptarget/plugins/cuda/src/rtl.cpp


Index: libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- libomptarget/plugins/cuda/src/rtl.cpp
+++ libomptarget/plugins/cuda/src/rtl.cpp
@@ -449,7 +449,8 @@
       entry.addr = (void *)cuptr;
 
       if (DeviceInfo.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY &&
-          e->flags & OMP_DECLARE_TARGET_LINK) {
+          (e->flags & OMP_DECLARE_TARGET_LINK ||
+           e->flags == OMP_DECLARE_TARGET_TO)) {
         // If unified memory is present any target link variables
         // can access host addresses directly. There is no longer a
         // need for device copies.
Index: libomptarget/include/omptarget.h
===================================================================
--- libomptarget/include/omptarget.h
+++ libomptarget/include/omptarget.h
@@ -52,6 +52,8 @@
 };
 
 enum OpenMPOffloadingDeclareTargetFlags {
+  /// Mark the entry as having a 'to' attribute.
+  OMP_DECLARE_TARGET_TO   = 0x00,
   /// Mark the entry as having a 'link' attribute.
   OMP_DECLARE_TARGET_LINK = 0x01,
   /// Mark the entry as being a global constructor.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63106.203934.patch
Type: text/x-patch
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190610/3df56dae/attachment.bin>


More information about the Openmp-commits mailing list