1 /* { dg-additional-options "-fopt-info-note-omp" }
2 { dg-additional-options "--param=openacc-privatization=noisy" }
3 { dg-additional-options "-foffload=-fopt-info-note-omp" }
4 { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
5 for testing/documenting aspects of that functionality. */
6
7 #include <stdio.h>
8 #include <openacc.h>
9 #include <gomp-constants.h>
10
11 #define N (32*32*32+17)
12 int main ()
13 {
14 int ary[N];
15 int ix;
16 int exit = 0;
17 int ondev = 0;
18
19 for (ix = 0; ix < N;ix++)
20 ary[ix] = -1;
21
22 #pragma acc parallel num_gangs(32) copy(ary) copy(ondev)
23 /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
24 {
25 #pragma acc loop gang
26 /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
27 /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
28 /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
29 /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
30 for (unsigned ix = 0; ix < N; ix++)
31 {
32 if (acc_on_device (acc_device_not_host))
33 {
34 int g, w, v;
35 g = __builtin_goacc_parlevel_id (GOMP_DIM_GANG);
36 w = __builtin_goacc_parlevel_id (GOMP_DIM_WORKER);
37 v = __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR);
38 ary[ix] = (g << 16) | (w << 8) | v;
39 ondev = 1;
40 }
41 else
42 ary[ix] = ix;
43 }
44 }
45
46 for (ix = 0; ix < N; ix++)
47 {
48 int expected = ix;
49 if(ondev)
50 {
51 int g = ix / ((N + 31) / 32);
52 int w = 0;
53 int v = 0;
54
55 expected = (g << 16) | (w << 8) | v;
56 }
57
58 if (ary[ix] != expected)
59 {
60 exit = 1;
61 printf ("ary[%d]=%x expected %x\n", ix, ary[ix], expected);
62 }
63 }
64
65 return exit;
66 }