Debian Codegraph @

gcc/testsuite/c-c++-common/goacc/classify-kernels.c

raw
1 /* Check offloaded function's attributes and classification for OpenACC
2 kernels. */
3
4 /* { dg-additional-options "--param openacc-kernels=decompose" } */
5
6 /* { dg-additional-options "-O2" }
7 { dg-additional-options "-fopt-info-all-omp" }
8 { dg-additional-options "-fdump-tree-ompexp" }
9 { dg-additional-options "-fdump-tree-parloops1-all" }
10 { dg-additional-options "-fdump-tree-oaccloops" } */
11
12 /* { dg-additional-options "--param=openacc-privatization=noisy" }
13 Prune a few: uninteresting:
14 { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
15
16 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
17 aspects of that functionality. */
18
19 #define N 1024
20
21 extern unsigned int *__restrict a;
22 extern unsigned int *__restrict b;
23 extern unsigned int *__restrict c;
24
25 void KERNELS ()
26 {
27 #pragma acc kernels copyin (a[0:N], b[0:N]) copyout (c[0:N]) /* { dg-line l_compute1 } */
28 /* { dg-note {OpenACC 'kernels' decomposition: variable 'i' declared in block requested to be made addressable} {} { target *-*-* } l_compute1 } */
29 /* { dg-note {variable 'i' made addressable} {} { target *-*-* } l_compute1 } */
30 /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} {} { target *-*-* } l_compute1 } */
31 /* { dg-note {variable '[abc]\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_compute1 } */
32 /* { dg-optimized {assigned OpenACC gang loop parallelism} {} { target *-*-* } l_compute1 } */
33 /* { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} {} { target *-*-* } .+1 } */
34 for (unsigned int i = 0; i < N; i++)
35 c[i] = a[i] + b[i];
36 }
37
38 /* Check the offloaded function's attributes.
39 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
40
41 /* Check that exactly one OpenACC kernels construct is analyzed, and that it
42 can be parallelized.
43 { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
44 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
45 { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
46
47 /* Check the offloaded function's classification and compute dimensions (will
48 always be 1 x 1 x 1 for non-offloading compilation).
49 { dg-final { scan-tree-dump-times "(?n)Function is parallelized OpenACC kernels offload" 1 "oaccloops" } }
50 { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
51 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */