This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[hsa] omp_target_associate_ptr and omp_target_is_present on shared memory


Hi,

when looking at why target-12.c and target-24.c in
libgomp/testsuite/libgomp.c/, I found two other places in libgomp's
target.c where shared-memory devices ought to be treated like the
host.  Committed to the branch.

Thanks,

Martin


2015-11-25  Martin Jambor  <mjambor@suse.cz>

libgomp/
	* target.c (omp_target_associate_ptr): Return EINVAL for shared
	memory devices.
	(omp_target_is_present): Return 1 for shared memory
	devices.
---
 libgomp/target.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libgomp/target.c b/libgomp/target.c
index f8a9803..b453c0c 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1922,7 +1922,8 @@ omp_target_is_present (void *ptr, int device_num)
   if (devicep == NULL)
     return 0;
 
-  if (!(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400))
+  if (!(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400)
+      || devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
     return 1;
 
   gomp_mutex_lock (&devicep->lock);
@@ -2146,7 +2147,8 @@ omp_target_associate_ptr (void *host_ptr, void *device_ptr, size_t size,
   if (devicep == NULL)
     return EINVAL;
 
-  if (!(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400))
+  if (!(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400)
+      || devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
     return EINVAL;
 
   gomp_mutex_lock (&devicep->lock);
-- 
2.6.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]