This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Commit 90e46a4
committed
[mlir][bufferization] Support custom types (1/N) (#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 c743086 commit 90e46a4
File tree
27 files changed
+381
-129
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
+381
-129
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 | | |
| |||
600 | 601 | | |
601 | 602 | | |
602 | 603 | | |
603 | | - | |
| 604 | + | |
604 | 605 | | |
605 | 606 | | |
606 | 607 | | |
| |||
613 | 614 | | |
614 | 615 | | |
615 | 616 | | |
616 | | - | |
| 617 | + | |
617 | 618 | | |
618 | 619 | | |
619 | 620 | | |
| |||
721 | 722 | | |
722 | 723 | | |
723 | 724 | | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
724 | 738 | | |
725 | 739 | | |
726 | 740 | | |
| |||
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 | | |
| |||
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
386 | 395 | | |
387 | 396 | | |
388 | 397 | | |
389 | 398 | | |
390 | | - | |
| 399 | + | |
391 | 400 | | |
392 | | - | |
| 401 | + | |
393 | 402 | | |
394 | | - | |
395 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
396 | 408 | | |
397 | 409 | | |
398 | 410 | | |
399 | | - | |
| 411 | + | |
400 | 412 | | |
401 | 413 | | |
402 | 414 | | |
| |||
438 | 450 | | |
439 | 451 | | |
440 | 452 | | |
441 | | - | |
| 453 | + | |
442 | 454 | | |
443 | | - | |
| 455 | + | |
444 | 456 | | |
445 | | - | |
| 457 | + | |
446 | 458 | | |
447 | 459 | | |
448 | 460 | | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
| 461 | + | |
| 462 | + | |
454 | 463 | | |
455 | 464 | | |
456 | 465 | | |
| |||
468 | 477 | | |
469 | 478 | | |
470 | 479 | | |
471 | | - | |
| 480 | + | |
472 | 481 | | |
473 | 482 | | |
474 | 483 | | |
475 | 484 | | |
476 | | - | |
477 | | - | |
| 485 | + | |
| 486 | + | |
478 | 487 | | |
479 | 488 | | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
| |||
498 | 500 | | |
499 | 501 | | |
500 | 502 | | |
501 | | - | |
502 | | - | |
| 503 | + | |
503 | 504 | | |
504 | | - | |
| 505 | + | |
505 | 506 | | |
506 | 507 | | |
507 | 508 | | |
| |||
519 | 520 | | |
520 | 521 | | |
521 | 522 | | |
522 | | - | |
523 | | - | |
| 523 | + | |
| 524 | + | |
524 | 525 | | |
525 | 526 | | |
526 | 527 | | |
| |||
554 | 555 | | |
555 | 556 | | |
556 | 557 | | |
557 | | - | |
| 558 | + | |
558 | 559 | | |
559 | 560 | | |
560 | 561 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
16 | 25 | | |
17 | 26 | | |
18 | 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 | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
| 162 | + | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| |||
0 commit comments