diff options
author | Julian Brown <julian@codesourcery.com> | 2015-05-28 09:29:19 +0000 |
---|---|---|
committer | Julian Brown <jules@gcc.gnu.org> | 2015-05-28 09:29:19 +0000 |
commit | 32eaed9380bfff86977823c0bf88fb69c2a375a6 (patch) | |
tree | 2bd3ae354d8dfe258860472c06b79b535af2b30b /libgomp/oacc-init.c | |
parent | 7d9880c94ce8d5bbce64f56f4e75c1ed073a1e52 (diff) | |
download | gcc-32eaed9380bfff86977823c0bf88fb69c2a375a6.zip gcc-32eaed9380bfff86977823c0bf88fb69c2a375a6.tar.gz gcc-32eaed9380bfff86977823c0bf88fb69c2a375a6.tar.bz2 |
re PR libgomp/65742 (Several libgomp.oacc-* failures after r221922.)
PR libgomp/65742
gcc/
* builtins.c (expand_builtin_acc_on_device): Don't use open-coded
sequence for !ACCEL_COMPILER.
libgomp/
* oacc-init.c (plugin/plugin-host.h): Include.
(acc_on_device): Check whether we're in an offloaded region for
host_nonshm
plugin. Don't use __builtin_acc_on_device.
* plugin/plugin-host.c (GOMP_OFFLOAD_openacc_parallel): Set
nonshm_exec flag in thread-local data.
(GOMP_OFFLOAD_openacc_create_thread_data): Allocate thread-local
data for host_nonshm plugin.
(GOMP_OFFLOAD_openacc_destroy_thread_data): Free thread-local data
for host_nonshm plugin.
* plugin/plugin-host.h: New.
From-SVN: r223801
Diffstat (limited to 'libgomp/oacc-init.c')
-rw-r--r-- | libgomp/oacc-init.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c index 54995e3..8e5fc3b 100644 --- a/libgomp/oacc-init.c +++ b/libgomp/oacc-init.c @@ -29,6 +29,7 @@ #include "libgomp.h" #include "oacc-int.h" #include "openacc.h" +#include "plugin/plugin-host.h" #include <assert.h> #include <stdlib.h> #include <strings.h> @@ -580,11 +581,18 @@ ialias (acc_set_device_num) int acc_on_device (acc_device_t dev) { - if (acc_get_device_type () == acc_device_host_nonshm) + struct goacc_thread *thr = goacc_thread (); + + /* We only want to appear to be the "host_nonshm" plugin from "offloaded" + code -- i.e. within a parallel region. Test a flag set by the + openacc_parallel hook of the host_nonshm plugin to determine that. */ + if (acc_get_device_type () == acc_device_host_nonshm + && thr && thr->target_tls + && ((struct nonshm_thread *)thr->target_tls)->nonshm_exec) return dev == acc_device_host_nonshm || dev == acc_device_not_host; - /* Just rely on the compiler builtin. */ - return __builtin_acc_on_device (dev); + /* For OpenACC, libgomp is only built for the host, so this is sufficient. */ + return dev == acc_device_host || dev == acc_device_none; } ialias (acc_on_device) |