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]

acc_on_device for device_type_host_nonshm (was: libgomp nvptx plugin: rework initialisation and support the proposed load/unload hooks)


Hi!

On Tue, 14 Apr 2015 15:15:02 +0100, Julian Brown <julian@codesourcery.com> wrote:
> On Wed, 8 Apr 2015 17:58:56 +0300
> Ilya Verbin <iverbin@gmail.com> wrote:
> > I see several regressions:
> > FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/acc_on_device-1.c
> > -DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 execution test
> > FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/if-1.c
> > -DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 execution test
> 
> I think there may be multiple issues here. The attached patch addresses
> one -- acc_device_type not distinguishing between "offloaded" and host
> code with the host_nonshm plugin.

(You mean acc_on_device?)

> --- libgomp/oacc-init.c	(revision 221922)
> +++ libgomp/oacc-init.c	(working copy)
> @@ -548,7 +549,14 @@ 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.  */

Really, acc_on_device is implemented as a compiler builtin (which is just
disabled for a few libgomp test cases, in order to test the acc_on_device
library function in libgomp), and I never understood why the "fallback"
implementation in libgomp (cited above) should be doing anything
different from the GCC builtin.  Is the "problem" actually, that some
libgomp test cases are expecting from acc_on_device for
acc_device_host_nonshm a different answer than the one they're currently
getting?  What is the expected answer?  Given that the OpenACC
specification doesn't talk about a host_nonshm device type, can we
accordingly define what the expected behavior is, so that we can just
have libgomp/oacc-init.c:acc_on_device Ârely on the compiler builtinÂ?


GrÃÃe,
 Thomas

Attachment: pgp7BFiO9zHJr.pgp
Description: PGP signature


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