Debian Codegraph @

gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95

raw
1 ! Test OpenACC 'kernels' construct decomposition.
2
3 ! { dg-additional-options "-fopt-info-omp-all" }
4
5 ! { dg-additional-options "-fdump-tree-gimple" }
6
7 ! { dg-additional-options "--param=openacc-kernels=decompose" }
8 ! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" }
9
10 ! { dg-additional-options "--param=openacc-privatization=noisy" }
11 ! Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types):
12 ! { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} }
13
14 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
15 ! aspects of that functionality.
16
17 ! See also '../../c-c++-common/goacc/kernels-decompose-1.c'.
18
19 ! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
20 ! passed to 'incr' may be unset, and in that case, it will be set to [...]",
21 ! so to maintain compatibility with earlier Tcl releases, we manually
22 ! initialize counter variables:
23 ! { dg-line l_dummy[variable c_compute 0 c_loop_i 0] }
24 ! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
25 ! "WARNING: dg-line var l_dummy defined, but not used".
26
27 program main
28 implicit none
29 integer, parameter :: N = 1024
30 integer, dimension (1:N) :: a
31 integer :: i, sum
32
33 !$acc kernels copyin(a(1:N)) copy(sum) ! { dg-line l_compute[incr c_compute] }
34 ! { dg-note {variable 'sum\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_compute$c_compute }
35 ! { dg-bogus "optimized: assigned OpenACC seq loop parallelism" "TODO" { xfail *-*-* } l_compute$c_compute }
36 !TODO Is this maybe the report that belongs to the XFAILed report further down? */
37
38 !$acc loop ! { dg-line l_loop_i[incr c_loop_i] }
39 ! { dg-note {forwarded loop nest in OpenACC 'kernels' region to 'parloops' for analysis} {} { target *-*-* } l_loop_i$c_loop_i }
40 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_loop_i$c_loop_i }
41 ! { dg-optimized "assigned OpenACC seq loop parallelism" "" { target *-*-* } l_loop_i$c_loop_i }
42 do i = 1, N
43 sum = sum + a(i)
44 end do
45
46 ! { dg-note {beginning 'gang-single' part in OpenACC 'kernels' region} {} { target *-*-* } .+1 }
47 sum = sum + 1
48 a(1) = a(1) + 1
49
50 !$acc loop independent ! { dg-line l_loop_i[incr c_loop_i] }
51 ! { dg-note {parallelized loop nest in OpenACC 'kernels' region} {} { target *-*-* } l_loop_i$c_loop_i }
52 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_loop_i$c_loop_i }
53 ! { dg-optimized "assigned OpenACC gang vector loop parallelism" "" { target *-*-* } l_loop_i$c_loop_i }
54 do i = 1, N
55 sum = sum + a(i)
56 end do
57
58 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} {} { target *-*-* } .+1 }
59 if (sum .gt. 10) then
60 !$acc loop ! { dg-line l_loop_i[incr c_loop_i] }
61 ! { dg-missed "unparallelized loop nest in OpenACC 'kernels' region: it's executed conditionally" "" { target *-*-* } l_loop_i$c_loop_i }
62 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_loop_i$c_loop_i }
63 !TODO { dg-optimized "assigned OpenACC seq loop parallelism" "TODO" { xfail *-*-* } l_loop_i$c_loop_i }
64 do i = 1, N
65 sum = sum + a(i)
66 end do
67 end if
68
69 !$acc loop auto ! { dg-line l_loop_i[incr c_loop_i] }
70 ! { dg-note {forwarded loop nest in OpenACC 'kernels' region to 'parloops' for analysis} {} { target *-*-* } l_loop_i$c_loop_i }
71 ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_loop_i$c_loop_i }
72 ! { dg-optimized "assigned OpenACC seq loop parallelism" "" { target *-*-* } l_loop_i$c_loop_i }
73 do i = 1, N
74 sum = sum + a(i)
75 end do
76
77 !$acc end kernels
78 end program main
79
80 ! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_kernels map\(to:a\[_[0-9]+\] \[len: _[0-9]+\]\) map\(alloc:a \[pointer assign, bias: _[0-9]+\]\) map\(tofrom:sum \[len: [0-9]+\]\)$} 1 "gimple" } }
81
82 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop private\(i\)$} 2 "gimple" } }
83 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop private\(i\) independent$} 1 "gimple" } }
84 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop private\(i\) auto$} 1 "gimple" } }
85 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop} 4 "gimple" } }
86
87 ! Check that the OpenACC 'kernels' got decomposed into 'data' and an enclosed
88 ! sequence of compute constructs.
89 ! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_data_kernels map\(to:a\[_[0-9]+\] \[len: _[0-9]+\]\) map\(tofrom:sum \[len: [0-9]+\]\)$} 1 "omp_oacc_kernels_decompose" } }
90 ! As noted above, we get three "old-style" kernel regions, one gang-single region, and one parallelized loop region.
91 ! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_kernels async\(-1\) map\(force_present:a\[_[0-9]+\] \[len: _[0-9]+\]\) map\(alloc:a \[pointer assign, bias: _[0-9]+\]\) map\(force_present:sum \[len: [0-9]+\]\)$} 3 "omp_oacc_kernels_decompose" } }
92 ! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_parallel_kernels_parallelized async\(-1\) map\(force_present:a\[_[0-9]+\] \[len: _[0-9]+\]\) map\(alloc:a \[pointer assign, bias: _[0-9]+\]\) map\(force_present:sum \[len: [0-9]+\]\)$} 1 "omp_oacc_kernels_decompose" } }
93 ! { dg-final { scan-tree-dump-times {(?n)#pragma omp target oacc_parallel_kernels_gang_single async\(-1\) num_gangs\(1\) map\(force_present:a\[_[0-9]+\] \[len: _[0-9]+\]\) map\(alloc:a \[pointer assign, bias: _[0-9]+\]\) map\(force_present:sum \[len: [0-9]+\]\)$} 1 "omp_oacc_kernels_decompose" } }
94 !
95 ! 'data' plus five CCs.
96 ! { dg-final { scan-tree-dump-times {(?n)#pragma omp target } 6 "omp_oacc_kernels_decompose" } }
97
98 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop private\(i\)$} 2 "omp_oacc_kernels_decompose" } }
99 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop private\(i\) independent$} 1 "omp_oacc_kernels_decompose" } }
100 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop private\(i\) auto} 1 "omp_oacc_kernels_decompose" } }
101 ! { dg-final { scan-tree-dump-times {(?n)#pragma acc loop} 4 "omp_oacc_kernels_decompose" } }
102
103 ! Each of the parallel regions is async, and there is a final call to
104 ! __builtin_GOACC_wait.
105 ! { dg-final { scan-tree-dump-times "__builtin_GOACC_wait" 1 "omp_oacc_kernels_decompose" } }