Debian Codegraph @

gcc/testsuite/gfortran.dg/goacc/routine-multiple-directives-1.f90

raw
1 ! Check for valid cases of multiple OpenACC 'routine' directives.
2
3 ! { dg-additional-options "-fdump-tree-oaccloops" }
4 !TODO See PR101551 for 'offloading_enabled' differences.
5
6 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
7 ! aspects of that functionality.
8
9 SUBROUTINE s_1
10 !$ACC ROUTINE(s_1)
11 !$ACC ROUTINE(s_1) SEQ
12 !$ACC ROUTINE SEQ
13 END SUBROUTINE s_1
14 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
15 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
16
17 SUBROUTINE s_1_nh
18 !$ACC ROUTINE(s_1_nh) NOHOST
19 !$ACC ROUTINE(s_1_nh) SEQ NOHOST
20 !$ACC ROUTINE NOHOST SEQ
21 END SUBROUTINE s_1_nh
22 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
23 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_1_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
24
25 SUBROUTINE s_2
26 !$ACC ROUTINE
27 !$ACC ROUTINE SEQ
28 !$ACC ROUTINE(s_2)
29 END SUBROUTINE s_2
30 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
31 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
32
33 SUBROUTINE s_2_nh
34 !$ACC ROUTINE NOHOST
35 !$ACC ROUTINE NOHOST SEQ
36 !$ACC ROUTINE(s_2_nh) NOHOST
37 END SUBROUTINE s_2_nh
38 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
39 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 's_2_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
40
41 SUBROUTINE v_1
42 !$ACC ROUTINE VECTOR
43 !$ACC ROUTINE VECTOR
44 !$ACC ROUTINE(v_1) VECTOR
45 !$ACC ROUTINE VECTOR
46 ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-5 }
47 END SUBROUTINE v_1
48 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
49 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
50
51 SUBROUTINE v_1_nh
52 !$ACC ROUTINE NOHOST VECTOR
53 !$ACC ROUTINE VECTOR NOHOST
54 !$ACC ROUTINE(v_1_nh) NOHOST VECTOR
55 !$ACC ROUTINE VECTOR NOHOST
56 ! { dg-bogus "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-5 }
57 END SUBROUTINE v_1_nh
58 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
59 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_1_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
60
61 SUBROUTINE v_2
62 !$ACC ROUTINE(v_2) VECTOR
63 !$ACC ROUTINE VECTOR
64 !$ACC ROUTINE(v_2) VECTOR
65 ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 }
66 END SUBROUTINE v_2
67 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2' doesn't have 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
68 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2_' doesn't have 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
69
70 SUBROUTINE v_2_nh
71 !$ACC ROUTINE(v_2_nh) VECTOR NOHOST
72 !$ACC ROUTINE VECTOR NOHOST
73 !$ACC ROUTINE(v_2_nh) NOHOST VECTOR
74 ! { dg-bogus "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 }
75 END SUBROUTINE v_2_nh
76 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2_nh' has 'nohost' clause" 1 "oaccloops" { target { ! offloading_enabled } } } }
77 ! { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'v_2_nh_' has 'nohost' clause" 1 "oaccloops" { target offloading_enabled } } }
78
79 SUBROUTINE sub_1
80 IMPLICIT NONE
81 EXTERNAL :: g_1
82 !$ACC ROUTINE (g_1) GANG
83 !$ACC ROUTINE (g_1) GANG
84 !$ACC ROUTINE (g_1) GANG
85 EXTERNAL :: g_1_nh
86 !$ACC ROUTINE (g_1_nh) GANG NOHOST
87 !$ACC ROUTINE (g_1_nh) NOHOST GANG
88 !$ACC ROUTINE (g_1_nh) NOHOST GANG
89 !$ACC ROUTINE (g_1_nh) GANG NOHOST
90
91 CALL s_1
92 CALL s_1_nh
93 CALL s_2
94 CALL s_2_nh
95 CALL v_1
96 CALL v_1_nh
97 CALL v_2
98 CALL v_2_nh
99 CALL g_1
100 CALL g_1_nh
101 CALL ABORT
102 END SUBROUTINE sub_1
103
104 MODULE m_w_1
105 IMPLICIT NONE
106 EXTERNAL :: w_1
107 !$ACC ROUTINE (w_1) WORKER
108 !$ACC ROUTINE (w_1) WORKER
109 EXTERNAL :: w_1_nh
110 !$ACC ROUTINE (w_1_nh) NOHOST WORKER
111 !$ACC ROUTINE (w_1_nh) WORKER NOHOST
112
113 CONTAINS
114 SUBROUTINE sub_2
115 CALL s_1
116 CALL s_1_nh
117 CALL s_2
118 CALL s_2_nh
119 CALL v_1
120 CALL v_1_nh
121 CALL v_2
122 CALL v_2_nh
123 CALL w_1
124 CALL w_1_nh
125 CALL ABORT
126 END SUBROUTINE sub_2
127 END MODULE m_w_1