Commit ee070d0
authored
[mlir][bufferization] Support custom types (1/N) (llvm#142986)
Following the addition of TensorLike and BufferLike type interfaces (see
00eaff3), introduce minimal changes
required to bufferize a custom tensor operation into a custom buffer
operation.
To achieve this, new interface methods are added to TensorLike type
interface that abstract away the differences between existing (tensor ->
memref) and custom conversions.
The scope of the changes is intentionally limited (for example,
BufferizableOpInterface is untouched) in order to first understand the
basics and reach consensus design-wise.
---
Notable changes:
* mlir::bufferization::getBufferType() returns BufferLikeType (instead
of BaseMemRefType)
* ToTensorOp / ToBufferOp operate on TensorLikeType / BufferLikeType.
Operation argument "memref" renamed to "buffer"
* ToTensorOp's tensor type inferring builder is dropped (users now need
to provide the tensor type explicitly)1 parent 40d2f39 commit ee070d0
File tree
27 files changed
+389
-135
lines changed- mlir
- include/mlir/Dialect/Bufferization/IR
- lib/Dialect
- Arith/Transforms
- Bufferization
- IR
- Transforms
- Linalg/Transforms
- SCF/Transforms
- Shape/Transforms
- SparseTensor/Transforms
- Utils
- Tensor/Transforms
- test
- Dialect/Bufferization/Transforms
- lib/Dialect/Test
27 files changed
+389
-135
lines changedLines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
615 | 616 | | |
616 | 617 | | |
617 | 618 | | |
618 | | - | |
| 619 | + | |
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
| |||
629 | 630 | | |
630 | 631 | | |
631 | 632 | | |
632 | | - | |
| 633 | + | |
633 | 634 | | |
634 | 635 | | |
635 | 636 | | |
| |||
739 | 740 | | |
740 | 741 | | |
741 | 742 | | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
742 | 756 | | |
743 | 757 | | |
744 | 758 | | |
| |||
Lines changed: 30 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
389 | 398 | | |
390 | 399 | | |
391 | 400 | | |
392 | 401 | | |
393 | | - | |
| 402 | + | |
394 | 403 | | |
395 | | - | |
| 404 | + | |
396 | 405 | | |
397 | | - | |
398 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
399 | 411 | | |
400 | 412 | | |
401 | 413 | | |
402 | | - | |
| 414 | + | |
403 | 415 | | |
404 | 416 | | |
405 | 417 | | |
| |||
441 | 453 | | |
442 | 454 | | |
443 | 455 | | |
444 | | - | |
| 456 | + | |
445 | 457 | | |
446 | | - | |
| 458 | + | |
447 | 459 | | |
448 | | - | |
| 460 | + | |
449 | 461 | | |
450 | 462 | | |
451 | 463 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
| 464 | + | |
| 465 | + | |
457 | 466 | | |
458 | 467 | | |
459 | 468 | | |
| |||
472 | 481 | | |
473 | 482 | | |
474 | 483 | | |
475 | | - | |
| 484 | + | |
476 | 485 | | |
477 | 486 | | |
478 | 487 | | |
479 | 488 | | |
480 | | - | |
481 | | - | |
| 489 | + | |
| 490 | + | |
482 | 491 | | |
483 | 492 | | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| |||
502 | 504 | | |
503 | 505 | | |
504 | 506 | | |
505 | | - | |
506 | | - | |
| 507 | + | |
507 | 508 | | |
508 | | - | |
| 509 | + | |
509 | 510 | | |
510 | 511 | | |
511 | 512 | | |
| |||
523 | 524 | | |
524 | 525 | | |
525 | 526 | | |
526 | | - | |
527 | | - | |
| 527 | + | |
| 528 | + | |
528 | 529 | | |
529 | 530 | | |
530 | 531 | | |
| |||
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
562 | | - | |
| 563 | + | |
563 | 564 | | |
564 | 565 | | |
565 | 566 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
28 | 48 | | |
29 | 49 | | |
30 | 50 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
| 167 | + | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
194 | 196 | | |
195 | 197 | | |
196 | 198 | | |
| |||
0 commit comments