Debian Codegraph @

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

raw
1 /* Check offloaded function's attributes and classification for unparallelized
2 OpenACC 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 /* An "extern"al mapping of loop iterations/array indices makes the loop
26 unparallelizable. */
27 extern unsigned int f (unsigned int);
28
29 void KERNELS ()
30 {
31 #pragma acc kernels copyin (a[0:N], b[0:N]) copyout (c[0:N]) /* { dg-line l_compute1 } */
32 /* { dg-note {OpenACC 'kernels' decomposition: variable 'i' declared in block requested to be made addressable} {} { target *-*-* } l_compute1 } */
33 /* { dg-note {variable 'i' made addressable} {} { target *-*-* } l_compute1 } */
34 /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} {} { target *-*-* } l_compute1 } */
35 /* { dg-note {variable '[abc]\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_compute1 } */
36 /* { dg-optimized {assigned OpenACC seq loop parallelism} {} { target *-*-* } l_compute1 } */
37 /* { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} {} { target *-*-* } .+1 } */
38 for (unsigned int i = 0; i < N; i++)
39 c[i] = a[f (i)] + b[f (i)];
40 }
41
42 /* Check the offloaded function's attributes.
43 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
44
45 /* Check that exactly one OpenACC kernels construct is analyzed, and that it
46 can't be parallelized.
47 { dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
48 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
49 { dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } } */
50
51 /* Check the offloaded function's classification and compute dimensions (will
52 always be 1 x 1 x 1 for non-offloading compilation).
53 { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
54 { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
55 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */