Commit ae05589
committed
TOSA: concat: fix canonicalization that would result in concat with no operands
The fold() of the concat had two issues:
a) It would fold `concat (tensor<0x2>, tensor<0x4>), axis=1 -> tensor<0x6>` into `concat ()` (no operands)
based on the observation that both operands have zero elements. This is invalid as concat needs to have
at least one operand.
b) After that fix, it would fold `concat (tensor<0x2>, tensor<0x4>), axis=1 -> tensor<0x6>`
int `concat (tensor<0x4>), axis=1 -> tensor<0x6>`. This is also invalid; even though the concat
still produces the same number of elements (= none), shape relations are not corret (0x4 input, but 0x6 output).
I fixed that by only removing operands from the concat when
- the operand has zero dim on the concatenation axis (i.e. it doesn't contribute to the result shape)
- there is at least one operand left after removing1 parent 63401e3 commit ae05589
File tree
2 files changed
+29
-9
lines changed- mlir
- lib/Dialect/Tosa/IR
- test/Dialect/Tosa
2 files changed
+29
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1349 | 1349 | | |
1350 | 1350 | | |
1351 | 1351 | | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
1358 | | - | |
1359 | 1352 | | |
1360 | 1353 | | |
1361 | 1354 | | |
1362 | 1355 | | |
1363 | | - | |
1364 | | - | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
1365 | 1359 | | |
1366 | 1360 | | |
1367 | 1361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
207 | 233 | | |
208 | 234 | | |
209 | 235 | | |
| |||
0 commit comments