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

Phabricator via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jun 19 08:44:50 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL363825: [OpenMP][libomptarget] Add support for declare target to clause under unified… (authored by gbercea, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63106/new/

https://reviews.llvm.org/D63106

Files:
  openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp
@@ -448,9 +448,18 @@
           DPxPTR(e - HostBegin), e->name, DPxPTR(cuptr));
       entry.addr = (void *)cuptr;
 
-      if (DeviceInfo.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY &&
-          e->flags & OMP_DECLARE_TARGET_LINK) {
-        // If unified memory is present any target link variables
+      // Note: In the current implementation declare target variables
+      // can either be link or to. This means that once unified
+      // memory is activated via the requires directive, the variable
+      // can be used directly from the host in both cases.
+      // TODO: when variables types other than to or link are added,
+      // the below condition should be changed to explicitely
+      // check for to and link variables types:
+      //  (DeviceInfo.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY &&
+      //   (e->flags & OMP_DECLARE_TARGET_LINK ||
+      //    e->flags == OMP_DECLARE_TARGET_TO))
+      if (DeviceInfo.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY) {
+        // If unified memory is present any target link or to variables
         // can access host addresses directly. There is no longer a
         // need for device copies.
         cuMemcpyHtoD(cuptr, e->addr, sizeof(void *));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63106.205610.patch
Type: text/x-patch
Size: 1465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190619/915e6ad0/attachment.bin>


More information about the Openmp-commits mailing list