Hi!

On Mon, 3 Aug 2015 08:00:36 -0400, Nathan Sidwell <nat...@codesourcery.com> 
wrote:
> On 08/03/15 07:37, Thomas Schwinge wrote:
> > On Sun, 2 Aug 2015 21:23:30 -0400, Nathan Sidwell <nat...@acm.org> wrote:
> >> I've committed this to gomp4 branch.  It expands the acc_on_device builtin
> >> earlier in the new oacc_xform pass.  This will allow more optimization 
> >> earlier on.
> >
> > Thanks!
> >
> >> The existing expansion point now only needs to deal with the host-side 
> >> case.
> >
> > Actually, no; committed to gomp-4_0-branch in r226498:
> 
> Please clarify.  This suggests a logic fault elsewhere.

Hmm, I had the following in the commit log:

    When building an x86_64-intelmicemul-linux-gnu offloading compiler with
    r226484, the __builtin_acc_on_device usage in 
libgomp/oacc-init.c:acc_on_device
    makes it blow up:

        [...]/source-gcc/libgomp/oacc-init.c: In function 'acc_on_device':
        [...]/source-gcc/libgomp/oacc-init.c:643:10: internal compiler error: 
in expand_builtin_acc_on_device, at builtins.c:5891
           return __builtin_acc_on_device (dev);
                  ^
        0x6d9632 expand_builtin_acc_on_device
                [...]/source-gcc/gcc/builtins.c:5891

In case that has been too terse (sorry), here's a bit more detail.

GCC can be configured to use nvptx-none as well as
x86_64-intelmicemul-linux-gnu offloading compilers.  In offloading
compilers' configurations, ACCEL_COMPILER is defined.  The nvptx-none
offloading compilers' libgcc/libgomp build will use the specific
libgcc/config/nvptx/gomp-acc_on_device.c:acc_on_device implementation,
but the x86_64-intelmicemul-linux-gnu one will use the default
libgomp/oacc-init.c:acc_on_device implementation (which is implemented in
terms of __builtin_acc_on_device).  Thus, in the latter case, we'd run
into this gcc_unreachable during the x86_64-intelmicemul-linux-gnu
offloading compiler's libgomp build:

    /* Expand OpenACC acc_on_device.  This is expanded in the openacc
       transform pass, but if the user has this outside of an offloaded
       region, we'll find it here.  In that case we must be host or none.  */
    
    static rtx
    expand_builtin_acc_on_device (tree exp, rtx target)
    {
    #ifdef ACCEL_COMPILER
      gcc_unreachable ();
    #else
      gcc_assert (!get_oacc_fn_attrib (current_function_decl));

In r226498, I then restored the earlier logic of
gcc/builtins.c:expand_builtin_acc_on_device, and could then also simplify
libgcc/config/nvptx/gomp-acc_on_device.c:acc_on_device to the very same
generic/simple implementation in terms of __builtin_acc_on_device.

Does that clarify?


Grüße,
 Thomas

Attachment: pgp1H8R9bv5JO.pgp
Description: PGP signature

Reply via email to