1// RUN: mlir-opt -split-input-file -verify-diagnostics %s
2
3// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
4acc.loop gang {
5  "test.openacc_dummy_op"() : () -> ()
6  acc.yield
7} attributes {seq}
8
9// -----
10
11// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
12acc.loop worker {
13  "test.openacc_dummy_op"() : () -> ()
14  acc.yield
15} attributes {seq}
16
17// -----
18
19// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
20acc.loop vector {
21  "test.openacc_dummy_op"() : () -> ()
22  acc.yield
23} attributes {seq}
24
25// -----
26
27// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
28acc.loop gang worker {
29  "test.openacc_dummy_op"() : () -> ()
30  acc.yield
31} attributes {seq}
32
33// -----
34
35// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
36acc.loop gang vector {
37  "test.openacc_dummy_op"() : () -> ()
38  acc.yield
39} attributes {seq}
40
41// -----
42
43// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
44acc.loop worker vector {
45  "test.openacc_dummy_op"() : () -> ()
46  acc.yield
47} attributes {seq}
48
49// -----
50
51// expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}}
52acc.loop gang worker vector {
53  "test.openacc_dummy_op"() : () -> ()
54  acc.yield
55} attributes {seq}
56
57// -----
58
59// expected-error@+1 {{expected non-empty body.}}
60acc.loop {
61}
62
63// -----
64
65// expected-error@+1 {{only one of auto, independent, seq can be present at the same time}}
66acc.loop {
67  acc.yield
68} attributes {auto_, seq}
69
70// -----
71
72// expected-error@+1 {{at least one operand or the default attribute must appear on the data operation}}
73acc.data {
74  acc.yield
75}
76
77// -----
78
79// expected-error@+1 {{at least one value must be present in hostOperands or deviceOperands}}
80acc.update
81
82// -----
83
84%cst = constant 1 : index
85%value = alloc() : memref<10xf32>
86// expected-error@+1 {{wait_devnum cannot appear without waitOperands}}
87acc.update wait_devnum(%cst: index) host(%value: memref<10xf32>)
88
89// -----
90
91%cst = constant 1 : index
92%value = alloc() : memref<10xf32>
93// expected-error@+1 {{async attribute cannot appear with  asyncOperand}}
94acc.update async(%cst: index) host(%value: memref<10xf32>) attributes {async}
95
96// -----
97
98%cst = constant 1 : index
99%value = alloc() : memref<10xf32>
100// expected-error@+1 {{wait attribute cannot appear with waitOperands}}
101acc.update wait(%cst: index) host(%value: memref<10xf32>) attributes {wait}
102
103// -----
104
105%cst = constant 1 : index
106// expected-error@+1 {{wait_devnum cannot appear without waitOperands}}
107acc.wait wait_devnum(%cst: index)
108
109// -----
110
111%cst = constant 1 : index
112// expected-error@+1 {{async attribute cannot appear with asyncOperand}}
113acc.wait async(%cst: index) attributes {async}
114
115// -----
116
117acc.parallel {
118// expected-error@+1 {{'acc.init' op cannot be nested in a compute operation}}
119  acc.init
120  acc.yield
121}
122
123// -----
124
125acc.loop {
126// expected-error@+1 {{'acc.init' op cannot be nested in a compute operation}}
127  acc.init
128  acc.yield
129}
130
131// -----
132
133acc.parallel {
134// expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}}
135  acc.shutdown
136  acc.yield
137}
138
139// -----
140
141acc.loop {
142// expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}}
143  acc.shutdown
144  acc.yield
145}
146
147// -----
148
149acc.loop {
150  "test.openacc_dummy_op"() ({
151    // expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}}
152    acc.shutdown
153  }) : () -> ()
154  acc.yield
155}
156
157// -----
158
159// expected-error@+1 {{at least one operand in copyout, delete or detach must appear on the exit data operation}}
160acc.exit_data attributes {async}
161
162// -----
163
164%cst = constant 1 : index
165%value = alloc() : memref<10xf32>
166// expected-error@+1 {{async attribute cannot appear with asyncOperand}}
167acc.exit_data async(%cst: index) delete(%value : memref<10xf32>) attributes {async}
168
169// -----
170
171%cst = constant 1 : index
172%value = alloc() : memref<10xf32>
173// expected-error@+1 {{wait_devnum cannot appear without waitOperands}}
174acc.exit_data wait_devnum(%cst: index) delete(%value : memref<10xf32>)
175
176// -----
177
178// expected-error@+1 {{at least one operand in copyin, create, create_zero or attach must appear on the enter data operation}}
179acc.enter_data attributes {async}
180
181// -----
182
183%cst = constant 1 : index
184%value = alloc() : memref<10xf32>
185// expected-error@+1 {{async attribute cannot appear with asyncOperand}}
186acc.enter_data async(%cst: index) create(%value : memref<10xf32>) attributes {async}
187
188// -----
189
190%cst = constant 1 : index
191%value = alloc() : memref<10xf32>
192// expected-error@+1 {{wait attribute cannot appear with waitOperands}}
193acc.enter_data wait(%cst: index) create(%value : memref<10xf32>) attributes {wait}
194
195// -----
196
197%cst = constant 1 : index
198%value = alloc() : memref<10xf32>
199// expected-error@+1 {{wait_devnum cannot appear without waitOperands}}
200acc.enter_data wait_devnum(%cst: index) create(%value : memref<10xf32>)
201