forked from OSchip/llvm-project
[mlir][vector] Check minor identity map in FoldExtractSliceIntoTransferRead
vecotr.transfer_read ops with minor identity indexing map is rank reducing, with implicit leading unit dimensions. This should be a natural extension to support in addition to full identity indexing maps. Reviewed By: ThomasRaoux Differential Revision: https://reviews.llvm.org/D133883
This commit is contained in:
parent
6e675fba3a
commit
8a5cb939e7
|
@ -3294,7 +3294,7 @@ public:
|
|||
return failure();
|
||||
if (xferOp.hasOutOfBoundsDim())
|
||||
return failure();
|
||||
if (!xferOp.getPermutationMap().isIdentity())
|
||||
if (!xferOp.getPermutationMap().isMinorIdentity())
|
||||
return failure();
|
||||
if (xferOp.getMask())
|
||||
return failure();
|
||||
|
|
|
@ -1169,6 +1169,24 @@ func.func @transfer_read_of_extract_slice(%t : tensor<?x?xf32>, %s1 : index, %s2
|
|||
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: func @transfer_read_of_extract_slice(
|
||||
// CHECK-SAME: %[[t:.*]]: tensor<?x?xf32>, %[[s1:.*]]: index, %[[s2:.*]]: index
|
||||
// CHECK-DAG: %[[c4:.*]] = arith.constant 4 : index
|
||||
// CHECK-DAG: %[[c8:.*]] = arith.constant 8 : index
|
||||
// CHECK: %[[add:.*]] = arith.addi %[[s1]], %[[c4]]
|
||||
// CHECK: %[[r:.*]] = vector.transfer_read %[[t]][%[[c8]], %[[add]]], %{{.*}} {in_bounds = [true]} : tensor<?x?xf32>, vector<6xf32>
|
||||
// CHECK: return %[[r]]
|
||||
func.func @transfer_read_of_extract_slice(%t : tensor<?x?xf32>, %s1 : index, %s2 : index) -> vector<6xf32> {
|
||||
%c3 = arith.constant 3 : index
|
||||
%c4 = arith.constant 4 : index
|
||||
%cst = arith.constant 0.0 : f32
|
||||
%0 = tensor.extract_slice %t[5, %s1] [10, %s2] [1, 1] : tensor<?x?xf32> to tensor<10x?xf32>
|
||||
%1 = vector.transfer_read %0[%c3, %c4], %cst {in_bounds = [true]} : tensor<10x?xf32>, vector<6xf32>
|
||||
return %1 : vector<6xf32>
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// CHECK-LABEL: func @transfer_read_of_extract_slice_rank_reducing(
|
||||
// CHECK-SAME: %[[t:.*]]: tensor<?x?x?xf32>, %[[s1:.*]]: index, %[[s2:.*]]: index
|
||||
// CHECK-DAG: %[[c3:.*]] = arith.constant 3 : index
|
||||
|
|
Loading…
Reference in New Issue