[gomp4, committed] Fix OACC_LOOP usage in goacc tests

Tom de Vries Tom_deVries@mentor.com
Sat Jul 18 07:38:00 GMT 2015


Hi Chung-Lin,

when compiling f.i. kernels-loop-acc-loop.c with -Wall, I ran into:
...
In file included from kernels-loop-acc-loop.c:8:0:
kernels-loop.c: In function ‘main’:
kernels-loop.c:30:0: warning: ignoring #pragma ACC_LOOP  [-Wunknown-pragmas]
...

kernels-loop-acc-loop.c contains:
...
#define ACC_LOOP acc loop
#include "kernels-loop.c"
...

and kernels-loop.c contains:
...
#pragma ACC_LOOP
  ...

Unfortunately, this expands to '#pragma ACC_LOOP', instead of the 
desired '#pragma acc loop'.

Something that works, is:
...
#define ACC_LOOP loop
#pragma acc ACC_LOOP
...

But the empty variant (the one we need for kernels-loop.c) doesn't work. 
We either get 'ignoring #pragma ACC_LOOP' for:
...
#define ACC_LOOP
#pragma acc ACC_LOOP
...
or 'ignoring #pragma acc' for:
...
#define ACC_LOOP ""
#pragma acc ACC_LOOP
...

It would be nice if the openacc standard defined a pragma acc nop.

For now, I've fixed this using simple conditional compilation:
...
#ifdef ACC_LOOP
#pragma acc loop
#endif
...
which works for both:
- undefined ACC_LOOP, and
- #define ACC_LOOP

[ Btw, note that this scheme:
...
#ifdef ACC_LOOP
#pragma acc ACC_LOOP
#endif
...
would work with:
- undefined ACC_LOOP,
- #define ACC_LOOP loop
- #define ACC_LOOP loop independent ]

Committed to gomp-4_0-branch.

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-OACC_LOOP-usage-in-goacc-tests.patch
Type: text/x-patch
Size: 6654 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150718/88df8603/attachment.bin>


More information about the Gcc-patches mailing list