Commit 1bc2d8e
committed
[mlir][tensor] Introduce
This patch specializes `FoldTensorCastProducerOp` for `tensor::UnPackOp` by
introducing a dedicated pattern: `FoldTensorCastUnPackOp`. This change
mirrors a similar update made for `tensor::PackOp` in #114559. Below is
the updated rationale for `tensor::UnPackOp`.
Currently, `FoldTensorCastProducerOp` incorrectly folds the following:
```mlir
%cast = tensor.cast %dest : tensor<1x1x8x1xi32> to tensor<1x1x?x1xi32>
%unpack = tensor.unpack %cast
inner_dims_pos = [0, 1]
inner_tiles = [%c8, 1]
into %res : tensor<1x1x?x1xi32> -> tensor<7x?xi32>
```
as:
```mlir
%unpack = tensor.unpack %cast
inner_dims_pos = [0, 1]
inner_tiles = [%c8, 1]
into %res : tensor<1x1x?x1xi32> -> tensor<7x?xi32>
```
This leads to an Op verification failure because the folder does not
update the inner tile sizes in the unpack Op. This patch resolves the
issue.
Additional Changes:
* invalid.mlir: Fixes a typo.
* TensorOps.cpp: Removes unnecessary `(void)tileSize` and adds extra
comments following this discussion:
#115772.FoldTensorCastUnPackOp
1 parent 998bdae commit 1bc2d8e
File tree
3 files changed
+107
-5
lines changed- mlir
- lib/Dialect/Tensor/IR
- test/Dialect/Tensor
3 files changed
+107
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4837 | 4837 | | |
4838 | 4838 | | |
4839 | 4839 | | |
4840 | | - | |
4841 | | - | |
4842 | | - | |
| 4840 | + | |
| 4841 | + | |
4843 | 4842 | | |
4844 | 4843 | | |
4845 | 4844 | | |
4846 | 4845 | | |
4847 | 4846 | | |
4848 | 4847 | | |
| 4848 | + | |
| 4849 | + | |
| 4850 | + | |
4849 | 4851 | | |
4850 | 4852 | | |
4851 | 4853 | | |
| |||
4865 | 4867 | | |
4866 | 4868 | | |
4867 | 4869 | | |
| 4870 | + | |
| 4871 | + | |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
| 4875 | + | |
| 4876 | + | |
| 4877 | + | |
| 4878 | + | |
| 4879 | + | |
| 4880 | + | |
| 4881 | + | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
| 4885 | + | |
| 4886 | + | |
| 4887 | + | |
| 4888 | + | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
| 4893 | + | |
| 4894 | + | |
| 4895 | + | |
| 4896 | + | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
| 4910 | + | |
| 4911 | + | |
| 4912 | + | |
| 4913 | + | |
| 4914 | + | |
| 4915 | + | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
| 4919 | + | |
| 4920 | + | |
| 4921 | + | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
| 4927 | + | |
| 4928 | + | |
| 4929 | + | |
| 4930 | + | |
| 4931 | + | |
| 4932 | + | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
4868 | 4947 | | |
4869 | 4948 | | |
4870 | 4949 | | |
| |||
4890 | 4969 | | |
4891 | 4970 | | |
4892 | 4971 | | |
4893 | | - | |
| 4972 | + | |
| 4973 | + | |
4894 | 4974 | | |
4895 | 4975 | | |
4896 | 4976 | | |
| |||
4923 | 5003 | | |
4924 | 5004 | | |
4925 | 5005 | | |
| 5006 | + | |
4926 | 5007 | | |
4927 | 5008 | | |
4928 | 5009 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2786 | 2786 | | |
2787 | 2787 | | |
2788 | 2788 | | |
| 2789 | + | |
2789 | 2790 | | |
2790 | 2791 | | |
2791 | 2792 | | |
| |||
2814 | 2815 | | |
2815 | 2816 | | |
2816 | 2817 | | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
2817 | 2838 | | |
2818 | 2839 | | |
2819 | 2840 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
702 | | - | |
| 702 | + | |
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| |||
0 commit comments