Debian Codegraph @

gcc/testsuite/gfortran.dg/goacc/classify-kernels-unparallelized-parloops.f95

raw
1 ! Check offloaded function's attributes and classification for unparallelized
2 ! OpenACC kernels.
3
4 ! { dg-additional-options "--param openacc-kernels=parloops" }
5
6 ! { dg-additional-options "-O2" }
7 ! { dg-additional-options "-fopt-info-optimized-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 "-Wopenacc-parallelism" } for testing/documenting
13 ! aspects of that functionality.
14
15 program main
16 implicit none
17 integer, parameter :: n = 1024
18 integer, dimension (0:n-1) :: a, b, c
19 integer :: i
20
21 ! An "external" mapping of loop iterations/array indices makes the loop
22 ! unparallelizable.
23 integer, external :: f
24
25 call setup(a, b)
26
27 !$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-line l_compute1 }
28 ! { dg-optimized {assigned OpenACC seq loop parallelism} {} { target *-*-* } l_compute1 }
29 do i = 0, n - 1
30 c(i) = a(f (i)) + b(f (i))
31 end do
32 !$acc end kernels
33 end program main
34
35 ! Check the offloaded function's attributes.
36 ! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } }
37
38 ! Check that exactly one OpenACC kernels construct is analyzed, and that it
39 ! can't be parallelized.
40 ! { dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
41 ! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "parloops1" } }
42 ! { dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } }
43
44 ! Check the offloaded function's classification and compute dimensions (will
45 ! always be 1 x 1 x 1 for non-offloading compilation).
46 ! { dg-final { scan-tree-dump-times "(?n)Function is unparallelized OpenACC kernels offload" 1 "oaccloops" } }
47 ! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
48 ! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } }