Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 1 | // RUN: mlir-opt -split-input-file -verify-diagnostics %s |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 2 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 3 | %1 = arith.constant 1 : i32 |
| 4 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 5 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 6 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 7 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 8 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 9 | } attributes {seq = [#acc.device_type<none>], gang = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 10 | |
| 11 | // ----- |
| 12 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 13 | %1 = arith.constant 1 : i32 |
| 14 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 15 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 16 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 17 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 18 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 19 | } attributes {seq = [#acc.device_type<none>], worker = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 20 | |
| 21 | // ----- |
| 22 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 23 | %1 = arith.constant 1 : i32 |
| 24 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 25 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 26 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 27 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 28 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 29 | } attributes {seq = [#acc.device_type<none>], vector = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 30 | |
| 31 | // ----- |
| 32 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 33 | %1 = arith.constant 1 : i32 |
| 34 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 35 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 36 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 37 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 38 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 39 | } attributes {seq = [#acc.device_type<none>], worker = [#acc.device_type<none>], gang = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 40 | |
| 41 | // ----- |
| 42 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 43 | %1 = arith.constant 1 : i32 |
| 44 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 45 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 46 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 47 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 48 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 49 | } attributes {seq = [#acc.device_type<none>], vector = [#acc.device_type<none>], gang = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 50 | |
| 51 | // ----- |
| 52 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 53 | %1 = arith.constant 1 : i32 |
| 54 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 55 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 56 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 57 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 58 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 59 | } attributes {seq = [#acc.device_type<none>], vector = [#acc.device_type<none>], worker = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 60 | |
| 61 | // ----- |
| 62 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 63 | %1 = arith.constant 1 : i32 |
| 64 | %2 = arith.constant 10 : i32 |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 65 | // expected-error@+1 {{gang, worker or vector cannot appear with the seq attr}} |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 66 | acc.loop { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 67 | "test.openacc_dummy_op"() : () -> () |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 68 | acc.yield |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 69 | } attributes {seq = [#acc.device_type<none>], vector = [#acc.device_type<none>], worker = [#acc.device_type<none>], gang = [#acc.device_type<none>]} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 70 | |
| 71 | // ----- |
| 72 | |
| 73 | // expected-error@+1 {{expected non-empty body.}} |
| 74 | acc.loop { |
| 75 | } |
| 76 | |
| 77 | // ----- |
| 78 | |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 79 | // expected-error@+1 {{'acc.loop' op duplicate device_type found in gang attribute}} |
| 80 | acc.loop { |
| 81 | acc.yield |
| 82 | } attributes {gang = [#acc.device_type<none>, #acc.device_type<none>]} |
| 83 | |
| 84 | // ----- |
| 85 | |
| 86 | // expected-error@+1 {{'acc.loop' op duplicate device_type found in worker attribute}} |
| 87 | acc.loop { |
| 88 | acc.yield |
| 89 | } attributes {worker = [#acc.device_type<none>, #acc.device_type<none>]} |
| 90 | |
| 91 | // ----- |
| 92 | |
| 93 | // expected-error@+1 {{'acc.loop' op duplicate device_type found in vector attribute}} |
| 94 | acc.loop { |
| 95 | acc.yield |
| 96 | } attributes {vector = [#acc.device_type<none>, #acc.device_type<none>]} |
| 97 | |
| 98 | // ----- |
| 99 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 100 | %1 = arith.constant 1 : i32 |
| 101 | %2 = arith.constant 10 : i32 |
Valentin Clement | b6c1930 | 2023-04-17 19:44:36 | [diff] [blame] | 102 | // expected-error@+1 {{only one of "auto", "independent", "seq" can be present at the same time}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 103 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 104 | acc.yield |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 105 | } attributes {auto_ = [#acc.device_type<none>], seq = [#acc.device_type<none>], inclusiveUpperbound = array<i1: true>} |
Valentin Clement | 01f5fcd | 2020-09-15 15:41:50 | [diff] [blame] | 106 | |
| 107 | // ----- |
Valentin Clement | bbb5dc4 | 2020-09-29 01:22:07 | [diff] [blame] | 108 | |
| 109 | // expected-error@+1 {{at least one operand or the default attribute must appear on the data operation}} |
| 110 | acc.data { |
| 111 | acc.yield |
| 112 | } |
| 113 | |
| 114 | // ----- |
Valentin Clement | cc3b8e7 | 2020-09-29 14:39:13 | [diff] [blame] | 115 | |
Valentin Clement | a7b50ef | 2023-05-08 16:26:34 | [diff] [blame] | 116 | %value = memref.alloc() : memref<10xf32> |
| 117 | // expected-error@+1 {{expect data entry/exit operation or acc.getdeviceptr as defining op}} |
| 118 | acc.data dataOperands(%value : memref<10xf32>) { |
| 119 | acc.yield |
| 120 | } |
| 121 | |
| 122 | // ----- |
| 123 | |
Valentin Clement | 689afa8 | 2023-05-08 17:03:04 | [diff] [blame] | 124 | // expected-error@+1 {{at least one value must be present in dataOperands}} |
Valentin Clement | ecc99780 | 2020-09-29 13:56:54 | [diff] [blame] | 125 | acc.update |
| 126 | |
| 127 | // ----- |
| 128 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 129 | %cst = arith.constant 1 : index |
Valentin Clement | 689afa8 | 2023-05-08 17:03:04 | [diff] [blame] | 130 | %value = memref.alloc() : memref<f32> |
| 131 | %0 = acc.update_device varPtr(%value : memref<f32>) -> memref<f32> |
River Riddle | ef72cf44 | 2022-02-02 18:22:57 | [diff] [blame] | 132 | // expected-error@+1 {{async attribute cannot appear with asyncOperand}} |
Valentin Clement (バレンタイン クレメン) | 78ef032 | 2024-01-25 21:58:58 | [diff] [blame] | 133 | acc.update async(%cst: index) dataOperands(%0 : memref<f32>) attributes {async = [#acc.device_type<none>]} |
Valentin Clement | ecc99780 | 2020-09-29 13:56:54 | [diff] [blame] | 134 | |
| 135 | // ----- |
| 136 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 137 | %cst = arith.constant 1 : index |
Valentin Clement | 689afa8 | 2023-05-08 17:03:04 | [diff] [blame] | 138 | %value = memref.alloc() : memref<f32> |
| 139 | %0 = acc.update_device varPtr(%value : memref<f32>) -> memref<f32> |
Valentin Clement | ecc99780 | 2020-09-29 13:56:54 | [diff] [blame] | 140 | // expected-error@+1 {{wait attribute cannot appear with waitOperands}} |
Valentin Clement (バレンタイン クレメン) | c09dc2d | 2024-01-29 05:17:36 | [diff] [blame] | 141 | acc.update wait({%cst: index}) dataOperands(%0: memref<f32>) attributes {waitOnly = [#acc.device_type<none>]} |
Valentin Clement | cc3b8e7 | 2020-09-29 14:39:13 | [diff] [blame] | 142 | |
| 143 | // ----- |
| 144 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 145 | %cst = arith.constant 1 : index |
Valentin Clement | cc3b8e7 | 2020-09-29 14:39:13 | [diff] [blame] | 146 | // expected-error@+1 {{wait_devnum cannot appear without waitOperands}} |
| 147 | acc.wait wait_devnum(%cst: index) |
| 148 | |
| 149 | // ----- |
| 150 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 151 | %cst = arith.constant 1 : index |
Valentin Clement | cc3b8e7 | 2020-09-29 14:39:13 | [diff] [blame] | 152 | // expected-error@+1 {{async attribute cannot appear with asyncOperand}} |
| 153 | acc.wait async(%cst: index) attributes {async} |
Valentin Clement | 51323fe | 2020-09-29 14:58:46 | [diff] [blame] | 154 | |
| 155 | // ----- |
| 156 | |
| 157 | acc.parallel { |
| 158 | // expected-error@+1 {{'acc.init' op cannot be nested in a compute operation}} |
| 159 | acc.init |
| 160 | acc.yield |
| 161 | } |
| 162 | |
| 163 | // ----- |
| 164 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 165 | %1 = arith.constant 1 : i32 |
| 166 | %2 = arith.constant 10 : i32 |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 167 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32){ |
Valentin Clement | 51323fe | 2020-09-29 14:58:46 | [diff] [blame] | 168 | // expected-error@+1 {{'acc.init' op cannot be nested in a compute operation}} |
| 169 | acc.init |
| 170 | acc.yield |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 171 | } attributes {inclusiveUpperbound = array<i1: true>} |
Valentin Clement | 9c77350 | 2020-09-29 17:12:54 | [diff] [blame] | 172 | |
| 173 | // ----- |
| 174 | |
| 175 | acc.parallel { |
| 176 | // expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}} |
| 177 | acc.shutdown |
| 178 | acc.yield |
| 179 | } |
| 180 | |
| 181 | // ----- |
| 182 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 183 | %1 = arith.constant 1 : i32 |
| 184 | %2 = arith.constant 10 : i32 |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 185 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | 9c77350 | 2020-09-29 17:12:54 | [diff] [blame] | 186 | // expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}} |
| 187 | acc.shutdown |
| 188 | acc.yield |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 189 | } attributes {inclusiveUpperbound = array<i1: true>} |
Valentin Clement | 9c77350 | 2020-09-29 17:12:54 | [diff] [blame] | 190 | |
| 191 | // ----- |
| 192 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 193 | %1 = arith.constant 1 : i32 |
| 194 | %2 = arith.constant 10 : i32 |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 195 | acc.loop control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | dd4fb7c | 2020-09-30 16:23:06 | [diff] [blame] | 196 | "test.openacc_dummy_op"() ({ |
Valentin Clement | 9c77350 | 2020-09-29 17:12:54 | [diff] [blame] | 197 | // expected-error@+1 {{'acc.shutdown' op cannot be nested in a compute operation}} |
| 198 | acc.shutdown |
| 199 | }) : () -> () |
| 200 | acc.yield |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 201 | } attributes {inclusiveUpperbound = array<i1: true>} |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 202 | |
| 203 | // ----- |
| 204 | |
Valentin Clement | 15a480c | 2023-05-09 18:36:28 | [diff] [blame] | 205 | // expected-error@+1 {{at least one operand must be present in dataOperands on the exit data operation}} |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 206 | acc.exit_data attributes {async} |
| 207 | |
| 208 | // ----- |
| 209 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 210 | %cst = arith.constant 1 : index |
Valentin Clement | 15a480c | 2023-05-09 18:36:28 | [diff] [blame] | 211 | %value = memref.alloc() : memref<f32> |
| 212 | %0 = acc.getdeviceptr varPtr(%value : memref<f32>) -> memref<f32> |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 213 | // expected-error@+1 {{async attribute cannot appear with asyncOperand}} |
Valentin Clement | 15a480c | 2023-05-09 18:36:28 | [diff] [blame] | 214 | acc.exit_data async(%cst: index) dataOperands(%0 : memref<f32>) attributes {async} |
| 215 | acc.delete accPtr(%0 : memref<f32>) |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 216 | |
| 217 | // ----- |
| 218 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 219 | %cst = arith.constant 1 : index |
Valentin Clement | 15a480c | 2023-05-09 18:36:28 | [diff] [blame] | 220 | %value = memref.alloc() : memref<f32> |
| 221 | %0 = acc.getdeviceptr varPtr(%value : memref<f32>) -> memref<f32> |
Valentin Clement | 4b01190 | 2020-10-12 01:26:54 | [diff] [blame] | 222 | // expected-error@+1 {{wait_devnum cannot appear without waitOperands}} |
Valentin Clement | 15a480c | 2023-05-09 18:36:28 | [diff] [blame] | 223 | acc.exit_data wait_devnum(%cst: index) dataOperands(%0 : memref<f32>) |
| 224 | acc.delete accPtr(%0 : memref<f32>) |
Valentin Clement | 4b01190 | 2020-10-12 01:26:54 | [diff] [blame] | 225 | |
| 226 | // ----- |
| 227 | |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 228 | // expected-error@+1 {{at least one operand must be present in dataOperands on the enter data operation}} |
Valentin Clement | 4b01190 | 2020-10-12 01:26:54 | [diff] [blame] | 229 | acc.enter_data attributes {async} |
| 230 | |
| 231 | // ----- |
| 232 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 233 | %cst = arith.constant 1 : index |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 234 | %value = memref.alloc() : memref<f32> |
| 235 | %0 = acc.create varPtr(%value : memref<f32>) -> memref<f32> |
Valentin Clement | 4b01190 | 2020-10-12 01:26:54 | [diff] [blame] | 236 | // expected-error@+1 {{async attribute cannot appear with asyncOperand}} |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 237 | acc.enter_data async(%cst: index) dataOperands(%0 : memref<f32>) attributes {async} |
Valentin Clement | 4b01190 | 2020-10-12 01:26:54 | [diff] [blame] | 238 | |
| 239 | // ----- |
| 240 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 241 | %cst = arith.constant 1 : index |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 242 | %value = memref.alloc() : memref<f32> |
| 243 | %0 = acc.create varPtr(%value : memref<f32>) -> memref<f32> |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 244 | // expected-error@+1 {{wait attribute cannot appear with waitOperands}} |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 245 | acc.enter_data wait(%cst: index) dataOperands(%0 : memref<f32>) attributes {wait} |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 246 | |
| 247 | // ----- |
| 248 | |
Mogball | a54f4ea | 2021-10-12 23:14:57 | [diff] [blame] | 249 | %cst = arith.constant 1 : index |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 250 | %value = memref.alloc() : memref<f32> |
| 251 | %0 = acc.create varPtr(%value : memref<f32>) -> memref<f32> |
Valentin Clement | 6260cb1 | 2020-10-10 01:02:29 | [diff] [blame] | 252 | // expected-error@+1 {{wait_devnum cannot appear without waitOperands}} |
Valentin Clement | 9dec07f | 2023-05-09 16:00:36 | [diff] [blame] | 253 | acc.enter_data wait_devnum(%cst: index) dataOperands(%0 : memref<f32>) |
Valentin Clement | ed35b58 | 2023-04-20 21:42:56 | [diff] [blame] | 254 | |
| 255 | // ----- |
| 256 | |
Valentin Clement | 7cb9629 | 2023-05-08 16:28:13 | [diff] [blame] | 257 | %value = memref.alloc() : memref<10xf32> |
| 258 | // expected-error@+1 {{expect data entry operation as defining op}} |
| 259 | acc.enter_data dataOperands(%value : memref<10xf32>) |
| 260 | |
| 261 | // ----- |
| 262 | |
Valentin Clement | ed35b58 | 2023-04-20 21:42:56 | [diff] [blame] | 263 | %0 = arith.constant 1.0 : f32 |
| 264 | // expected-error@+1 {{operand #0 must be integer or index, but got 'f32'}} |
| 265 | %1 = acc.bounds lowerbound(%0 : f32) |
| 266 | |
Valentin Clement | 78a09cb | 2023-05-08 16:29:08 | [diff] [blame] | 267 | // ----- |
| 268 | |
| 269 | %value = memref.alloc() : memref<10xf32> |
| 270 | // expected-error@+1 {{expect data entry/exit operation or acc.getdeviceptr as defining op}} |
| 271 | acc.update dataOperands(%value : memref<10xf32>) |
Valentin Clement | aad53e3 | 2023-05-08 16:30:01 | [diff] [blame] | 272 | |
| 273 | // ----- |
| 274 | |
| 275 | %value = memref.alloc() : memref<10xf32> |
| 276 | // expected-error@+1 {{expect data entry/exit operation or acc.getdeviceptr as defining op}} |
| 277 | acc.parallel dataOperands(%value : memref<10xf32>) { |
| 278 | acc.yield |
| 279 | } |
| 280 | |
| 281 | // ----- |
| 282 | |
| 283 | %value = memref.alloc() : memref<10xf32> |
| 284 | // expected-error@+1 {{expect data entry/exit operation or acc.getdeviceptr as defining op}} |
| 285 | acc.serial dataOperands(%value : memref<10xf32>) { |
| 286 | acc.yield |
| 287 | } |
| 288 | |
| 289 | // ----- |
| 290 | |
| 291 | %value = memref.alloc() : memref<10xf32> |
| 292 | // expected-error@+1 {{expect data entry/exit operation or acc.getdeviceptr as defining op}} |
| 293 | acc.kernels dataOperands(%value : memref<10xf32>) { |
| 294 | acc.yield |
| 295 | } |
Valentin Clement | 9c3299b | 2023-05-17 18:06:07 | [diff] [blame] | 296 | |
| 297 | // ----- |
| 298 | |
| 299 | // expected-error@+1 {{expects non-empty init region}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 300 | acc.private.recipe @privatization_i32 : !llvm.ptr init { |
Valentin Clement | 9c3299b | 2023-05-17 18:06:07 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | // ----- |
| 304 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 305 | // expected-error@+1 {{expects init region first argument of the privatization type}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 306 | acc.private.recipe @privatization_i32 : !llvm.ptr init { |
| 307 | ^bb0(%arg0 : i32): |
Valentin Clement | 9c3299b | 2023-05-17 18:06:07 | [diff] [blame] | 308 | %c1 = arith.constant 1 : i32 |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 309 | %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr |
| 310 | acc.yield %0 : !llvm.ptr |
Valentin Clement | 9c3299b | 2023-05-17 18:06:07 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | // ----- |
| 314 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 315 | // expected-error@+1 {{expects destroy region first argument of the privatization type}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 316 | acc.private.recipe @privatization_i32 : !llvm.ptr init { |
| 317 | ^bb0(%arg0 : !llvm.ptr): |
Valentin Clement | 9c3299b | 2023-05-17 18:06:07 | [diff] [blame] | 318 | %c1 = arith.constant 1 : i32 |
| 319 | %c0 = arith.constant 0 : i32 |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 320 | %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr |
| 321 | llvm.store %c0, %0 : i32, !llvm.ptr |
| 322 | acc.yield %0 : !llvm.ptr |
Valentin Clement | 9c3299b | 2023-05-17 18:06:07 | [diff] [blame] | 323 | } destroy { |
| 324 | ^bb0(%arg0 : f32): |
| 325 | "test.openacc_dummy_op"(%arg0) : (f32) -> () |
| 326 | } |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 327 | |
| 328 | // ----- |
| 329 | |
| 330 | // expected-error@+1 {{expects non-empty init region}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 331 | acc.firstprivate.recipe @privatization_i32 : !llvm.ptr init { |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 332 | } copy {} |
| 333 | |
| 334 | // ----- |
| 335 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 336 | // expected-error@+1 {{expects init region first argument of the privatization type}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 337 | acc.firstprivate.recipe @privatization_i32 : !llvm.ptr init { |
| 338 | ^bb0(%arg0 : i32): |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 339 | %c1 = arith.constant 1 : i32 |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 340 | %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr |
| 341 | acc.yield %0 : !llvm.ptr |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 342 | } copy {} |
| 343 | |
| 344 | // ----- |
| 345 | |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 346 | // expected-error@+1 {{expects non-empty copy region}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 347 | acc.firstprivate.recipe @privatization_i32 : !llvm.ptr init { |
| 348 | ^bb0(%arg0 : !llvm.ptr): |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 349 | %c1 = arith.constant 1 : i32 |
| 350 | %c0 = arith.constant 0 : i32 |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 351 | %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr |
| 352 | llvm.store %c0, %0 : i32, !llvm.ptr |
| 353 | acc.yield %0 : !llvm.ptr |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 354 | } copy { |
| 355 | } |
| 356 | |
| 357 | // ----- |
| 358 | |
| 359 | // expected-error@+1 {{expects copy region with two arguments of the privatization type}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 360 | acc.firstprivate.recipe @privatization_i32 : !llvm.ptr init { |
| 361 | ^bb0(%arg0 : !llvm.ptr): |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 362 | %c1 = arith.constant 1 : i32 |
| 363 | %c0 = arith.constant 0 : i32 |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 364 | %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr |
| 365 | llvm.store %c0, %0 : i32, !llvm.ptr |
| 366 | acc.yield %0 : !llvm.ptr |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 367 | } copy { |
| 368 | ^bb0(%arg0 : f32): |
| 369 | "test.openacc_dummy_op"(%arg0) : (f32) -> () |
| 370 | } |
| 371 | |
| 372 | // ----- |
| 373 | |
| 374 | // expected-error@+1 {{expects copy region with two arguments of the privatization type}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 375 | acc.firstprivate.recipe @privatization_i32 : !llvm.ptr init { |
| 376 | ^bb0(%arg0 : !llvm.ptr): |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 377 | %c1 = arith.constant 1 : i32 |
| 378 | %c0 = arith.constant 0 : i32 |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 379 | %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr |
| 380 | llvm.store %c0, %0 : i32, !llvm.ptr |
| 381 | acc.yield %0 : !llvm.ptr |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 382 | } copy { |
| 383 | ^bb0(%arg0 : f32, %arg1 : i32): |
| 384 | "test.openacc_dummy_op"(%arg0) : (f32) -> () |
| 385 | } |
| 386 | |
| 387 | // ----- |
| 388 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 389 | // expected-error@+1 {{expects destroy region first argument of the privatization type}} |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 390 | acc.firstprivate.recipe @privatization_i32 : i32 init { |
| 391 | ^bb0(%arg0 : i32): |
| 392 | %0 = arith.constant 1 : i32 |
| 393 | acc.yield %0 : i32 |
| 394 | } copy { |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 395 | ^bb0(%arg0 : i32, %arg1 : !llvm.ptr): |
| 396 | llvm.store %arg0, %arg1 : i32, !llvm.ptr |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 397 | acc.yield |
| 398 | } destroy { |
| 399 | ^bb0(%arg0 : f32): |
| 400 | acc.yield |
| 401 | } |
| 402 | |
Valentin Clement | 12f3ae6 | 2023-05-18 23:20:57 | [diff] [blame] | 403 | // ----- |
Valentin Clement | 8497dfd | 2023-05-17 18:11:42 | [diff] [blame] | 404 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 405 | %1 = arith.constant 1 : i32 |
| 406 | %2 = arith.constant 10 : i32 |
Valentin Clement | 2e69944 | 2023-06-13 18:16:31 | [diff] [blame] | 407 | // expected-error@+1 {{expected ')'}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 408 | acc.loop gang({static=%i64Value: i64, num=%i64Value: i64} control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | 2e69944 | 2023-06-13 18:16:31 | [diff] [blame] | 409 | "test.openacc_dummy_op"() : () -> () |
| 410 | acc.yield |
| 411 | } |
| 412 | |
| 413 | // ----- |
| 414 | |
Valentin Clement | 12f3ae6 | 2023-05-18 23:20:57 | [diff] [blame] | 415 | // expected-error@+1 {{expects non-empty init region}} |
| 416 | acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init { |
| 417 | } combiner {} |
| 418 | |
| 419 | // ----- |
| 420 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 421 | // expected-error@+1 {{expects init region first argument of the reduction type}} |
Valentin Clement | 12f3ae6 | 2023-05-18 23:20:57 | [diff] [blame] | 422 | acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init { |
| 423 | ^bb0(%0: i32): |
| 424 | %1 = arith.constant 0 : i64 |
| 425 | acc.yield %1 : i64 |
| 426 | } combiner {} |
| 427 | |
| 428 | // ----- |
| 429 | |
Valentin Clement | 12f3ae6 | 2023-05-18 23:20:57 | [diff] [blame] | 430 | // expected-error@+1 {{expects non-empty combiner region}} |
| 431 | acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init { |
| 432 | ^bb0(%0: i64): |
| 433 | %1 = arith.constant 0 : i64 |
| 434 | acc.yield %1 : i64 |
| 435 | } combiner {} |
| 436 | |
| 437 | // ----- |
| 438 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 439 | // expected-error@+1 {{expects combiner region with the first two arguments of the reduction type}} |
Valentin Clement | 12f3ae6 | 2023-05-18 23:20:57 | [diff] [blame] | 440 | acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init { |
| 441 | ^bb0(%0: i64): |
| 442 | %1 = arith.constant 0 : i64 |
| 443 | acc.yield %1 : i64 |
| 444 | } combiner { |
| 445 | ^bb0(%0: i32): |
| 446 | acc.yield %0 : i32 |
| 447 | } |
| 448 | |
| 449 | // ----- |
| 450 | |
Valentin Clement | 1d49834 | 2023-07-19 17:30:42 | [diff] [blame] | 451 | // expected-error@+1 {{expects combiner region with the first two arguments of the reduction type}} |
Valentin Clement | 12f3ae6 | 2023-05-18 23:20:57 | [diff] [blame] | 452 | acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init { |
| 453 | ^bb0(%0: i64): |
| 454 | %1 = arith.constant 0 : i64 |
| 455 | acc.yield %1 : i64 |
| 456 | } combiner { |
| 457 | ^bb0(%0: i64): |
| 458 | acc.yield %0 : i64 |
| 459 | } |
| 460 | |
| 461 | // ----- |
| 462 | |
| 463 | // expected-error@+1 {{expects combiner region to yield a value of the reduction type}} |
| 464 | acc.reduction.recipe @reduction_i64 : i64 reduction_operator<add> init { |
| 465 | ^bb0(%0: i64): |
| 466 | %1 = arith.constant 0 : i64 |
| 467 | acc.yield %1 : i64 |
| 468 | } combiner { |
| 469 | ^bb0(%0: i64, %1: i64): |
| 470 | %2 = arith.constant 0 : i32 |
| 471 | acc.yield %2 : i32 |
| 472 | } |
Valentin Clement | eaf29b3 | 2023-05-24 17:39:00 | [diff] [blame] | 473 | |
| 474 | // ----- |
| 475 | |
Valentin Clement (バレンタイン クレメン) | 3eb4178 | 2024-01-22 18:31:29 | [diff] [blame] | 476 | %1 = arith.constant 1 : i32 |
| 477 | %2 = arith.constant 10 : i32 |
Valentin Clement | 2e69944 | 2023-06-13 18:16:31 | [diff] [blame] | 478 | // expected-error@+1 {{new value expected after comma}} |
Valentin Clement (バレンタイン クレメン) | 6b42625 | 2024-02-05 22:22:36 | [diff] [blame] | 479 | acc.loop gang({static=%i64Value: i64, ) control(%iv : i32) = (%1 : i32) to (%2 : i32) step (%1 : i32) { |
Valentin Clement | 2e69944 | 2023-06-13 18:16:31 | [diff] [blame] | 480 | "test.openacc_dummy_op"() : () -> () |
| 481 | acc.yield |
| 482 | } |
| 483 | |
| 484 | // ----- |
| 485 | |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 486 | func.func @fct1(%0 : !llvm.ptr) -> () { |
Valentin Clement | eaf29b3 | 2023-05-24 17:39:00 | [diff] [blame] | 487 | // expected-error@+1 {{expected symbol reference @privatization_i32 to point to a private declaration}} |
Christian Ulmann | 7ed96b1 | 2023-11-04 13:13:31 | [diff] [blame] | 488 | acc.serial private(@privatization_i32 -> %0 : !llvm.ptr) { |
Valentin Clement | eaf29b3 | 2023-05-24 17:39:00 | [diff] [blame] | 489 | } |
| 490 | return |
| 491 | } |
Valentin Clement | 2e69944 | 2023-06-13 18:16:31 | [diff] [blame] | 492 | |
| 493 | // ----- |
| 494 | |
Valentin Clement | 7f3d2cc | 2023-06-13 20:39:06 | [diff] [blame] | 495 | // expected-error@+1 {{expect at least one of num, dim or static values}} |
Valentin Clement (バレンタイン クレメン) | e456689 | 2024-01-05 00:33:33 | [diff] [blame] | 496 | acc.loop gang({}) { |
Valentin Clement | 2e69944 | 2023-06-13 18:16:31 | [diff] [blame] | 497 | "test.openacc_dummy_op"() : () -> () |
| 498 | acc.yield |
| 499 | } |
Valentin Clement | c4a63b8 | 2023-06-27 18:08:22 | [diff] [blame] | 500 | |
| 501 | // ----- |
| 502 | |
| 503 | %i64value = arith.constant 1 : i64 |
Valentin Clement | a25da1a | 2023-12-07 22:04:54 | [diff] [blame] | 504 | // expected-error@+1 {{num_gangs expects a maximum of 3 values per segment}} |
| 505 | acc.parallel num_gangs({%i64value: i64, %i64value : i64, %i64value : i64, %i64value : i64}) { |
Valentin Clement | c4a63b8 | 2023-06-27 18:08:22 | [diff] [blame] | 506 | } |
Valentin Clement | 4bac6ed | 2023-08-23 16:31:49 | [diff] [blame] | 507 | |
| 508 | // ----- |
| 509 | |
Valentin Clement (バレンタイン クレメン) | 65bd5ed | 2024-10-09 20:07:09 | [diff] [blame] | 510 | %0 = "arith.constant"() <{value = 1 : i64}> : () -> i64 |
| 511 | // expected-error@+1 {{num_gangs operand count does not match count in segments}} |
| 512 | "acc.parallel"(%0) <{numGangsSegments = array<i32: 1>, operandSegmentSizes = array<i32: 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0>}> ({ |
| 513 | }) : (i64) -> () |
| 514 | |
| 515 | // ----- |
| 516 | |
Valentin Clement | 4bac6ed | 2023-08-23 16:31:49 | [diff] [blame] | 517 | %i64value = arith.constant 1 : i64 |
| 518 | acc.parallel { |
| 519 | // expected-error@+1 {{'acc.set' op cannot be nested in a compute operation}} |
Valentin Clement (バレンタイン クレメン) | f706837 | 2023-10-30 16:51:42 | [diff] [blame] | 520 | acc.set attributes {device_type = #acc.device_type<nvidia>} |
Valentin Clement | 4bac6ed | 2023-08-23 16:31:49 | [diff] [blame] | 521 | acc.yield |
| 522 | } |
| 523 | |
| 524 | // ----- |
| 525 | |
| 526 | // expected-error@+1 {{'acc.set' op at least one default_async, device_num, or device_type operand must appear}} |
| 527 | acc.set |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 528 | |
| 529 | // ----- |
| 530 | |
| 531 | func.func @acc_atomic_write(%addr : memref<memref<i32>>, %val : i32) { |
| 532 | // expected-error @below {{address must dereference to value type}} |
| 533 | acc.atomic.write %addr = %val : memref<memref<i32>>, i32 |
| 534 | return |
| 535 | } |
| 536 | |
| 537 | // ----- |
| 538 | |
| 539 | func.func @acc_atomic_update(%x: memref<i32>, %expr: f32) { |
| 540 | // expected-error @below {{the type of the operand must be a pointer type whose element type is the same as that of the region argument}} |
| 541 | acc.atomic.update %x : memref<i32> { |
| 542 | ^bb0(%xval: f32): |
| 543 | %newval = llvm.fadd %xval, %expr : f32 |
| 544 | acc.yield %newval : f32 |
| 545 | } |
| 546 | return |
| 547 | } |
| 548 | |
| 549 | // ----- |
| 550 | |
| 551 | func.func @acc_atomic_update(%x: memref<i32>, %expr: i32) { |
| 552 | // expected-error @+2 {{op expects regions to end with 'acc.yield', found 'acc.terminator'}} |
| 553 | // expected-note @below {{in custom textual format, the absence of terminator implies 'acc.yield'}} |
| 554 | acc.atomic.update %x : memref<i32> { |
| 555 | ^bb0(%xval: i32): |
| 556 | %newval = llvm.add %xval, %expr : i32 |
| 557 | acc.terminator |
| 558 | } |
| 559 | return |
| 560 | } |
| 561 | // ----- |
| 562 | |
| 563 | func.func @acc_atomic_update(%x: memref<i32>, %expr: i32) { |
| 564 | // expected-error @below {{invalid kind of type specified}} |
| 565 | acc.atomic.update %x : i32 { |
| 566 | ^bb0(%xval: i32): |
| 567 | %newval = llvm.add %xval, %expr : i32 |
| 568 | acc.yield %newval : i32 |
| 569 | } |
| 570 | return |
| 571 | } |
| 572 | |
| 573 | // ----- |
| 574 | |
| 575 | func.func @acc_atomic_update(%x: memref<i32>, %expr: i32) { |
| 576 | // expected-error @below {{only updated value must be returned}} |
| 577 | acc.atomic.update %x : memref<i32> { |
| 578 | ^bb0(%xval: i32): |
| 579 | %newval = llvm.add %xval, %expr : i32 |
| 580 | acc.yield %newval, %expr : i32, i32 |
| 581 | } |
| 582 | return |
| 583 | } |
| 584 | |
| 585 | // ----- |
| 586 | |
| 587 | func.func @acc_atomic_update(%x: memref<i32>, %expr: i32, %y: f32) { |
| 588 | // expected-error @below {{input and yielded value must have the same type}} |
| 589 | acc.atomic.update %x : memref<i32> { |
| 590 | ^bb0(%xval: i32): |
| 591 | %newval = llvm.add %xval, %expr : i32 |
| 592 | acc.yield %y: f32 |
| 593 | } |
| 594 | return |
| 595 | } |
| 596 | |
| 597 | // ----- |
| 598 | |
| 599 | func.func @acc_atomic_update(%x: memref<i32>, %expr: i32) { |
| 600 | // expected-error @below {{the region must accept exactly one argument}} |
| 601 | acc.atomic.update %x : memref<i32> { |
| 602 | ^bb0(%xval: i32, %tmp: i32): |
| 603 | %newval = llvm.add %xval, %expr : i32 |
| 604 | acc.yield %newval : i32 |
| 605 | } |
| 606 | return |
| 607 | } |
| 608 | |
| 609 | // ----- |
| 610 | |
| 611 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 612 | // expected-error @below {{expected three operations in atomic.capture region}} |
| 613 | acc.atomic.capture { |
khaki3 | a63f91577 | 2024-11-05 15:52:45 | [diff] [blame] | 614 | acc.atomic.read %v = %x : memref<i32>, memref<i32>, i32 |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 615 | acc.terminator |
| 616 | } |
| 617 | return |
| 618 | } |
| 619 | |
| 620 | // ----- |
| 621 | |
| 622 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 623 | acc.atomic.capture { |
| 624 | // expected-error @below {{invalid sequence of operations in the capture region}} |
khaki3 | a63f91577 | 2024-11-05 15:52:45 | [diff] [blame] | 625 | acc.atomic.read %v = %x : memref<i32>, memref<i32>, i32 |
| 626 | acc.atomic.read %v = %x : memref<i32>, memref<i32>, i32 |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 627 | acc.terminator |
| 628 | } |
| 629 | return |
| 630 | } |
| 631 | |
| 632 | // ----- |
| 633 | |
| 634 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 635 | acc.atomic.capture { |
| 636 | // expected-error @below {{invalid sequence of operations in the capture region}} |
| 637 | acc.atomic.update %x : memref<i32> { |
| 638 | ^bb0(%xval: i32): |
| 639 | %newval = llvm.add %xval, %expr : i32 |
| 640 | acc.yield %newval : i32 |
| 641 | } |
| 642 | acc.atomic.update %x : memref<i32> { |
| 643 | ^bb0(%xval: i32): |
| 644 | %newval = llvm.add %xval, %expr : i32 |
| 645 | acc.yield %newval : i32 |
| 646 | } |
| 647 | acc.terminator |
| 648 | } |
| 649 | return |
| 650 | } |
| 651 | |
| 652 | // ----- |
| 653 | |
| 654 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 655 | acc.atomic.capture { |
| 656 | // expected-error @below {{invalid sequence of operations in the capture region}} |
| 657 | acc.atomic.write %x = %expr : memref<i32>, i32 |
| 658 | acc.atomic.write %x = %expr : memref<i32>, i32 |
| 659 | acc.terminator |
| 660 | } |
| 661 | return |
| 662 | } |
| 663 | |
| 664 | // ----- |
| 665 | |
| 666 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 667 | acc.atomic.capture { |
| 668 | // expected-error @below {{invalid sequence of operations in the capture region}} |
| 669 | acc.atomic.write %x = %expr : memref<i32>, i32 |
| 670 | acc.atomic.update %x : memref<i32> { |
| 671 | ^bb0(%xval: i32): |
| 672 | %newval = llvm.add %xval, %expr : i32 |
| 673 | acc.yield %newval : i32 |
| 674 | } |
| 675 | acc.terminator |
| 676 | } |
| 677 | return |
| 678 | } |
| 679 | |
| 680 | // ----- |
| 681 | |
| 682 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 683 | acc.atomic.capture { |
| 684 | // expected-error @below {{invalid sequence of operations in the capture region}} |
| 685 | acc.atomic.update %x : memref<i32> { |
| 686 | ^bb0(%xval: i32): |
| 687 | %newval = llvm.add %xval, %expr : i32 |
| 688 | acc.yield %newval : i32 |
| 689 | } |
| 690 | acc.atomic.write %x = %expr : memref<i32>, i32 |
| 691 | acc.terminator |
| 692 | } |
| 693 | return |
| 694 | } |
| 695 | |
| 696 | // ----- |
| 697 | |
| 698 | func.func @acc_atomic_capture(%x: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 699 | acc.atomic.capture { |
| 700 | // expected-error @below {{invalid sequence of operations in the capture region}} |
| 701 | acc.atomic.write %x = %expr : memref<i32>, i32 |
khaki3 | a63f91577 | 2024-11-05 15:52:45 | [diff] [blame] | 702 | acc.atomic.read %v = %x : memref<i32>, memref<i32>, i32 |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 703 | acc.terminator |
| 704 | } |
| 705 | return |
| 706 | } |
| 707 | |
| 708 | // ----- |
| 709 | |
| 710 | func.func @acc_atomic_capture(%x: memref<i32>, %y: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 711 | acc.atomic.capture { |
| 712 | // expected-error @below {{updated variable in atomic.update must be captured in second operation}} |
| 713 | acc.atomic.update %x : memref<i32> { |
| 714 | ^bb0(%xval: i32): |
| 715 | %newval = llvm.add %xval, %expr : i32 |
| 716 | acc.yield %newval : i32 |
| 717 | } |
khaki3 | a63f91577 | 2024-11-05 15:52:45 | [diff] [blame] | 718 | acc.atomic.read %v = %y : memref<i32>, memref<i32>, i32 |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 719 | acc.terminator |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | // ----- |
| 724 | |
| 725 | func.func @acc_atomic_capture(%x: memref<i32>, %y: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 726 | acc.atomic.capture { |
| 727 | // expected-error @below {{captured variable in atomic.read must be updated in second operation}} |
khaki3 | a63f91577 | 2024-11-05 15:52:45 | [diff] [blame] | 728 | acc.atomic.read %v = %y : memref<i32>, memref<i32>, i32 |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 729 | acc.atomic.update %x : memref<i32> { |
| 730 | ^bb0(%xval: i32): |
| 731 | %newval = llvm.add %xval, %expr : i32 |
| 732 | acc.yield %newval : i32 |
| 733 | } |
| 734 | acc.terminator |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | // ----- |
| 739 | |
| 740 | func.func @acc_atomic_capture(%x: memref<i32>, %y: memref<i32>, %v: memref<i32>, %expr: i32) { |
| 741 | acc.atomic.capture { |
| 742 | // expected-error @below {{captured variable in atomic.read must be updated in second operation}} |
khaki3 | a63f91577 | 2024-11-05 15:52:45 | [diff] [blame] | 743 | acc.atomic.read %v = %x : memref<i32>, memref<i32>, i32 |
Razvan Lupusoru | 61278ec | 2023-09-06 20:54:39 | [diff] [blame] | 744 | acc.atomic.write %y = %expr : memref<i32>, i32 |
| 745 | acc.terminator |
| 746 | } |
| 747 | } |
Razvan Lupusoru | a435e1f | 2024-03-07 18:06:47 | [diff] [blame] | 748 | |
| 749 | // ----- |
| 750 | |
| 751 | func.func @acc_combined() { |
| 752 | // expected-error @below {{expected 'loop'}} |
| 753 | acc.parallel combined() { |
| 754 | } |
Razvan Lupusoru | a435e1f | 2024-03-07 18:06:47 | [diff] [blame] | 755 | return |
| 756 | } |
| 757 | |
| 758 | // ----- |
| 759 | |
| 760 | func.func @acc_combined() { |
| 761 | // expected-error @below {{expected compute construct name}} |
| 762 | acc.loop combined(loop) { |
| 763 | } |
Razvan Lupusoru | a435e1f | 2024-03-07 18:06:47 | [diff] [blame] | 764 | return |
| 765 | } |
| 766 | |
| 767 | // ----- |
| 768 | |
| 769 | func.func @acc_combined() { |
| 770 | // expected-error @below {{expected 'loop'}} |
| 771 | acc.parallel combined(parallel loop) { |
| 772 | } |
Razvan Lupusoru | a435e1f | 2024-03-07 18:06:47 | [diff] [blame] | 773 | return |
| 774 | } |
| 775 | |
| 776 | // ----- |
| 777 | |
| 778 | func.func @acc_combined() { |
| 779 | // expected-error @below {{expected ')'}} |
| 780 | acc.loop combined(parallel loop) { |
| 781 | } |
Razvan Lupusoru | e8f590e | 2025-04-30 20:48:51 | [diff] [blame] | 782 | return |
| 783 | } |
Razvan Lupusoru | a435e1f | 2024-03-07 18:06:47 | [diff] [blame] | 784 | |
Razvan Lupusoru | e8f590e | 2025-04-30 20:48:51 | [diff] [blame] | 785 | // ----- |
| 786 | |
| 787 | func.func @acc_loop_container() { |
| 788 | %c0 = arith.constant 0 : index |
| 789 | %c10 = arith.constant 10 : index |
| 790 | %c1 = arith.constant 1 : index |
| 791 | // expected-error @below {{found sibling loops inside container-like acc.loop}} |
| 792 | acc.loop { |
| 793 | scf.for %arg4 = %c0 to %c10 step %c1 { |
| 794 | scf.yield |
| 795 | } |
| 796 | scf.for %arg5 = %c0 to %c10 step %c1 { |
| 797 | scf.yield |
| 798 | } |
| 799 | acc.yield |
| 800 | } attributes { collapse = [2], collapseDeviceType = [#acc.device_type<none>] } |
| 801 | return |
| 802 | } |
| 803 | |
| 804 | // ----- |
| 805 | |
| 806 | func.func @acc_loop_container() { |
| 807 | %c0 = arith.constant 0 : index |
| 808 | %c10 = arith.constant 10 : index |
| 809 | %c1 = arith.constant 1 : index |
| 810 | // expected-error @below {{failed to find enough loop-like operations inside container-like acc.loop}} |
| 811 | acc.loop { |
| 812 | scf.for %arg4 = %c0 to %c10 step %c1 { |
| 813 | scf.for %arg5 = %c0 to %c10 step %c1 { |
| 814 | scf.yield |
| 815 | } |
| 816 | scf.yield |
| 817 | } |
| 818 | acc.yield |
| 819 | } attributes { collapse = [3], collapseDeviceType = [#acc.device_type<none>] } |
Razvan Lupusoru | a435e1f | 2024-03-07 18:06:47 | [diff] [blame] | 820 | return |
| 821 | } |