Commit 6daa20e
authored
Use op.dtype to create aten.empty.memory_format during decomposition. (#3941)
Prior to the change in this PR `torch-mlir-opt
--convert-torch-to-linalg` was running into the following error:
```
error: 'tensor.cast' op operand type 'tensor<200x200x26xf32>' and result type 'tensor<200x200x26xf64>' are cast incompatible
%1 = torch.aten.empty.memory_format %0, %none, %none, %none, %false, %none : !torch.list<int>, !torch.none, !torch.none, !torch.none, !torch.bool, !torch.none -> !torch.vtensor<[200,200,26],f64>
^
note: see current operation: %12 = "tensor.cast"(%11) : (tensor<200x200x26xf32>) -> tensor<200x200x26xf64
```
This is because when `dtype` of the `aten.empty.memory_format` is
`none`, by default `f32` was being selected as the element type of the
resulting tensor which doesn't match with the actual element type of the
result.1 parent ae310b4 commit 6daa20e
File tree
5 files changed
+139
-20
lines changed- include/torch-mlir/Dialect/Torch/Utils
- lib/Dialect/Torch
- Transforms
- Utils
- projects/pt1/python/torch_mlir_e2e_test/test_suite
- test/Dialect/Torch
5 files changed
+139
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7087 | 7087 | | |
7088 | 7088 | | |
7089 | 7089 | | |
| 7090 | + | |
| 7091 | + | |
| 7092 | + | |
| 7093 | + | |
| 7094 | + | |
| 7095 | + | |
| 7096 | + | |
7090 | 7097 | | |
7091 | | - | |
7092 | | - | |
| 7098 | + | |
| 7099 | + | |
7093 | 7100 | | |
7094 | 7101 | | |
7095 | 7102 | | |
| |||
7838 | 7845 | | |
7839 | 7846 | | |
7840 | 7847 | | |
7841 | | - | |
7842 | | - | |
7843 | | - | |
7844 | | - | |
7845 | | - | |
7846 | | - | |
7847 | | - | |
7848 | | - | |
7849 | | - | |
| 7848 | + | |
| 7849 | + | |
| 7850 | + | |
| 7851 | + | |
7850 | 7852 | | |
7851 | 7853 | | |
7852 | | - | |
| 7854 | + | |
7853 | 7855 | | |
7854 | 7856 | | |
7855 | 7857 | | |
| |||
9257 | 9259 | | |
9258 | 9260 | | |
9259 | 9261 | | |
9260 | | - | |
| 9262 | + | |
| 9263 | + | |
9261 | 9264 | | |
9262 | | - | |
| 9265 | + | |
9263 | 9266 | | |
9264 | 9267 | | |
9265 | | - | |
9266 | 9268 | | |
9267 | 9269 | | |
9268 | 9270 | | |
| |||
9274 | 9276 | | |
9275 | 9277 | | |
9276 | 9278 | | |
9277 | | - | |
| 9279 | + | |
9278 | 9280 | | |
9279 | 9281 | | |
9280 | 9282 | | |
9281 | 9283 | | |
9282 | | - | |
| 9284 | + | |
9283 | 9285 | | |
9284 | 9286 | | |
9285 | 9287 | | |
| |||
9377 | 9379 | | |
9378 | 9380 | | |
9379 | 9381 | | |
| 9382 | + | |
| 9383 | + | |
| 9384 | + | |
| 9385 | + | |
| 9386 | + | |
9380 | 9387 | | |
9381 | | - | |
| 9388 | + | |
9382 | 9389 | | |
9383 | 9390 | | |
9384 | 9391 | | |
| |||
9536 | 9543 | | |
9537 | 9544 | | |
9538 | 9545 | | |
| 9546 | + | |
| 9547 | + | |
| 9548 | + | |
| 9549 | + | |
| 9550 | + | |
9539 | 9551 | | |
9540 | | - | |
9541 | | - | |
| 9552 | + | |
| 9553 | + | |
9542 | 9554 | | |
9543 | 9555 | | |
9544 | 9556 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
240 | 276 | | |
241 | 277 | | |
242 | 278 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
644 | 664 | | |
645 | 665 | | |
646 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
0 commit comments