]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized.f95
[PR middle-end/69921] Use "oacc kernels parallelized" attribute for parallelized...
[thirdparty/gcc.git] / gcc / testsuite / gfortran.dg / goacc / classify-kernels-unparallelized.f95
1 ! Check offloaded function's attributes and classification for unparallelized
2 ! OpenACC kernels.
3
4 ! { dg-additional-options "-O2" }
5 ! { dg-additional-options "-fdump-tree-ompexp" }
6 ! { dg-additional-options "-fdump-tree-parloops1-all" }
7 ! { dg-additional-options "-fdump-tree-oaccdevlow" }
8
9 program main
10 implicit none
11 integer, parameter :: n = 1024
12 integer, dimension (0:n-1) :: a, b, c
13 integer :: i
14
15 ! An "external" mapping of loop iterations/array indices makes the loop
16 ! unparallelizable.
17 integer, external :: f
18
19 call setup(a, b)
20
21 !$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1))
22 do i = 0, n - 1
23 c(i) = a(f (i)) + b(f (i))
24 end do
25 !$acc end kernels
26 end program main
27
28 ! Check the offloaded function's attributes.
29 ! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } }
30
31 ! Check that exactly one OpenACC kernels construct is analyzed, and that it
32 ! can't be parallelized.
33 ! { dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
34 ! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
35 ! { dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } }
36
37 ! Check the offloaded function's classification and compute dimensions (will
38 ! always be 1 x 1 x 1 for non-offloading compilation).
39 ! { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccdevlow" } }
40 ! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
41 ! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }