[mlir][vector] Fix illegal vector.transfer + tensor.insert/extract_slice folding
vector.transfer operations do not have rank-reducing semantics. Bail on illegal rank-reduction: we need to check that the rank-reduced dims are exactly the leading dims. I.e. the following is illegal: ``` %0 = vector.transfer_write %v, %t[0,0], %cst : vector<2x4xf32>, tensor<2x4xf32> %1 = tensor.insert_slice %0 into %tt[0,0,0][2,1,4][1,1,1] : tensor<2x4xf32> into tensor<2x1x4xf32> ``` Cannot fold into: ``` %0 = vector.transfer_write %v, %t[0,0,0], %cst : vector<2x4xf32>, tensor<2x1x4xf32> ``` For this, check the trailing `vectorRank` dims of the insert_slice result tensor match the trailing dims of the inferred result tensor. Differential Revision: https://reviews.llvm.org/D116409
Loading
Please sign in to comment