3 /* { dg-additional-options "-fopt-info-note-omp" }
4 { dg-additional-options "-foffload=-fopt-info-note-omp" } */
6 /* { dg-additional-options "--param=openacc-privatization=noisy" }
7 { dg-additional-options "-foffload=--param=openacc-privatization=noisy" } */
9 /* { dg-additional-options "-Wuninitialized" } */
11 /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
12 passed to 'incr' may be unset, and in that case, it will be set to [...]",
13 so to maintain compatibility with earlier Tcl releases, we manually
14 initialize counter variables:
15 { dg-line l_dummy[variable c_compute 0 c_loop 0] }
16 { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
17 "WARNING: dg-line var l_dummy defined, but not used". */
26 #pragma acc parallel copyout(res) num_gangs(64) /* { dg-line l_compute[incr c_compute] } */
27 /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
28 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
31 #pragma acc loop collapse(2) gang /* { dg-line l_loop[incr c_loop] } */
32 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
33 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
34 /* { dg-note {variable 'tmpvar' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
35 But, with optimizations enabled, per the '*.ssa' dump ('gcc/tree-ssa.c:execute_update_addresses_taken'):
36 No longer having address taken: tmpvar
37 Now a gimple register: tmpvar
38 However, 'tmpvar' remains in the candidate set:
39 { dg-note {variable 'tmpvar' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
40 Now, for GCN offloading, 'adjust_private_decl' does the privatization change right away:
41 { dg-note {variable 'tmpvar' adjusted for OpenACC privatization level: 'gang'} "" { target openacc_radeon_accel_selected } l_loop$c_loop }
42 For nvptx offloading however, we first mark up 'tmpvar', and then later apply the privatization change -- or, with optimizations enabled, don't, because we then don't actually call 'expand_var_decl'.
43 { dg-note {variable 'tmpvar' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } } l_loop$c_loop }
44 { dg-bogus {note: variable 'tmpvar' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && __OPTIMIZE__ } } l_loop$c_loop }
46 /* { dg-note {variable 'tmpref' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
47 for (i = 0; i < 256; i++)
49 for (j = 0; j < 256; j++)
53 tmpref = (i * 256 + j) * 97;
54 res[i * 256 + j] = tmpref;
59 for (i = 0; i < 65536; i++)
69 #pragma acc parallel copyout(res) num_gangs(64) num_workers(64) /* { dg-line l_compute[incr c_compute] } */
70 /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
71 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
72 /* { dg-warning "using .num_workers \\(32\\)., ignoring 64" "" { target openacc_nvidia_accel_selected } l_compute$c_compute } */
75 #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
76 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
77 for (i = 0; i < 256; i++)
79 #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
80 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
81 /* { dg-note {variable 'tmpvar' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
82 { dg-note {variable 'tmpvar' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop }
83 { dg-note {variable 'tmpvar' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */
84 /* { dg-note {variable 'tmpref' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
85 for (j = 0; j < 256; j++)
89 tmpref = (i * 256 + j) * 99;
90 res[i * 256 + j] = tmpref;
95 for (i = 0; i < 65536; i++)
105 #pragma acc parallel copyout(res) num_gangs(64) num_workers(64) /* { dg-line l_compute[incr c_compute] } */
106 /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
107 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
108 /* { dg-warning "using .num_workers \\(32\\)., ignoring 64" "" { target openacc_nvidia_accel_selected } l_compute$c_compute } */
111 #pragma acc loop gang worker /* { dg-line l_loop[incr c_loop] } */
112 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
113 for (i = 0; i < 256; i++)
115 #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
116 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
117 /* { dg-note {variable 'tmpvar' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
118 { dg-note {variable 'tmpvar' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
119 { dg-note {variable 'tmpvar' adjusted for OpenACC privatization level: 'vector'} "TODO" { target { ! openacc_host_selected } } l_loop$c_loop } */
120 /* { dg-note {variable 'tmpref' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
121 for (j = 0; j < 256; j++)
124 int &tmpref = tmpvar;
125 tmpref = (i * 256 + j) * 101;
126 res[i * 256 + j] = tmpref;
131 for (i = 0; i < 65536; i++)
132 if (res[i] != i * 101)
136 void gangs_workers_vectors (void)
141 #pragma acc parallel copyout(res) num_gangs(64) num_workers(64) /* { dg-line l_compute[incr c_compute] } */
142 /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
143 /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
144 /* { dg-warning "using .num_workers \\(32\\)., ignoring 64" "" { target openacc_nvidia_accel_selected } l_compute$c_compute } */
147 #pragma acc loop collapse(2) gang worker vector /* { dg-line l_loop[incr c_loop] } */
148 /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
149 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
150 /* { dg-note {variable 'tmpvar' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
151 { dg-note {variable 'tmpvar' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
152 { dg-note {variable 'tmpvar' adjusted for OpenACC privatization level: 'vector'} "TODO" { target { ! openacc_host_selected } } l_loop$c_loop } */
153 /* { dg-note {variable 'tmpref' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
154 for (i = 0; i < 256; i++)
156 for (j = 0; j < 256; j++)
159 int &tmpref = tmpvar;
160 tmpref = (i * 256 + j) * 103;
161 res[i * 256 + j] = tmpref;
166 for (i = 0; i < 65536; i++)
167 if (res[i] != i * 103)
171 int main (int argc, char *argv[])
176 gangs_workers_vectors ();