sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / loop-w-1.c
blobb910e251fb1171987939cce041dda5153d4a98ff
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. */
7 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
8 aspects of that functionality. */
10 #include <stdio.h>
11 #include <openacc.h>
12 #include <gomp-constants.h>
14 #define N (32*32*32+17)
15 int main ()
17 int ary[N];
18 int ix;
19 int exit = 0;
20 int ondev = 0;
21 int workersize;
23 for (ix = 0; ix < N;ix++)
24 ary[ix] = -1;
26 #define NW 32
27 #define VL 32
28 #pragma acc parallel num_workers(NW) vector_length(VL) \
29 copy(ary) copy(ondev)
30 /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
31 /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "vector" { target *-*-* } .-3 } */
33 #pragma acc loop worker
34 /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
35 /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
36 /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
37 /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
38 for (unsigned ix = 0; ix < N; ix++)
40 if (acc_on_device (acc_device_not_host))
42 int g, w, v;
44 g = __builtin_goacc_parlevel_id (GOMP_DIM_GANG);
45 w = __builtin_goacc_parlevel_id (GOMP_DIM_WORKER);
46 v = __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR);
47 ary[ix] = (g << 16) | (w << 8) | v;
48 ondev = 1;
50 else
51 ary[ix] = ix;
54 workersize = NW;
55 #ifdef ACC_DEVICE_TYPE_radeon
56 /* AMD GCN has an upper limit of 'num_workers(16)'. */
57 if (workersize > 16)
58 workersize = 16;
59 #endif
61 for (ix = 0; ix < N; ix++)
63 int expected = ix;
64 if(ondev)
66 int g = 0;
67 int w = ix % workersize;
68 int v = 0;
70 expected = (g << 16) | (w << 8) | v;
73 if (ary[ix] != expected)
75 exit = 1;
76 printf ("ary[%d]=%x expected %x\n", ix, ary[ix], expected);
80 return exit;