Commit fb2842e
authored
[mlir][linalg] fix DecomposeOuterUnitDimsPackOpPattern (#21)
Given the following example:
```
func.func @pack_with_unit_outer_dims_and_non_adjacent_inner(%arg0: tensor<3x1x4xf32>, %arg1: tensor<1x1x1x4x3xf32>) -> tensor<1x1x1x4x3xf32> {
%pack = linalg.pack %arg0 outer_dims_perm = [1, 2, 0] inner_dims_pos = [2, 0] inner_tiles = [4, 3] into %arg1 : tensor<3x1x4xf32> -> tensor<1x1x1x4x3xf32>
return %pack : tensor<1x1x1x4x3xf32>
}
```
We would up until now creating an invalid transpose. That is because we would use the `getDimAndTileMapping()` function of the packOp which tranposes the tile dimensions to match based on the given `inner_dims_pos` value.
Here in the above example we have `inner_dims_pos` of `[2, 0]` meaning from the source tensors the indices 2 and 0 must be the `inner_tiles`. This property is not required for calculating the tile sizes as the destination tensor shape will be simply `[1x1x1x4x3]`. The inner dimensions positions are only required for calculating the tranpose. With this we can simplify the pattern.1 parent c357983 commit fb2842e
File tree
3 files changed
+51
-19
lines changed- mlir
- lib/Dialect/Linalg/Transforms
- test/Dialect/Linalg
3 files changed
+51
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
1163 | | - | |
1164 | | - | |
1165 | 1163 | | |
1166 | 1164 | | |
1167 | 1165 | | |
| |||
1174 | 1172 | | |
1175 | 1173 | | |
1176 | 1174 | | |
1177 | | - | |
1178 | | - | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
1179 | 1182 | | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1189 | 1190 | | |
1190 | 1191 | | |
1191 | 1192 | | |
| |||
1218 | 1219 | | |
1219 | 1220 | | |
1220 | 1221 | | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | 1222 | | |
1225 | 1223 | | |
1226 | 1224 | | |
| |||
1233 | 1231 | | |
1234 | 1232 | | |
1235 | 1233 | | |
1236 | | - | |
1237 | | - | |
| 1234 | + | |
1238 | 1235 | | |
1239 | 1236 | | |
1240 | 1237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
0 commit comments