Skip to content

Commit acdd576

Browse files
committed
[mlir][linalg] Fix linalg.transpose region builder.
The region should yield the first argument (input) not the last argument (output). Also fix a few tests that were affected by this bug. Differential Revision: https://reviews.llvm.org/D136924
1 parent 5dd7d2c commit acdd576

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ std::function<void(mlir::ImplicitLocOpBuilder &, mlir::Block &,
16141614
TransposeOp::getRegionBuilder() {
16151615
return [](mlir::ImplicitLocOpBuilder &b, mlir::Block &block,
16161616
mlir::ArrayRef<mlir::NamedAttribute>) {
1617-
b.create<linalg::YieldOp>(block.getArguments().back());
1617+
b.create<linalg::YieldOp>(block.getArguments().front());
16181618
};
16191619
}
16201620

mlir/test/Dialect/Linalg/vectorization.mlir

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,9 +1556,7 @@ func.func @vectorize_transpose(%arg0: memref<16x32x64xf32>,
15561556
return
15571557
}
15581558
// CHECK-LABEL: func @vectorize_transpose
1559-
// CHECK: %[[FIRST:.*]] = vector.transpose
1560-
// CHECK-SAME: [2, 0, 1] : vector<32x64x16xf32> to vector<16x32x64xf32>
1561-
// CHECK-NEXT: vector.transpose %[[FIRST]]
1559+
// CHECK: vector.transpose
15621560
// CHECK-SAME: [1, 2, 0] : vector<16x32x64xf32> to vector<32x64x16xf32>
15631561

15641562
transform.sequence failures(propagate) {

mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func.func @transpose(%arg0: memref<16x32x64xf32>,
208208
// CHECK: scf.for %[[I:.*]] = %[[C0]] to %[[C16]] step %[[C1]] {
209209
// CHECK: scf.for %[[J:.*]] = %[[C0]] to %[[C32]] step %[[C1]] {
210210
// CHECK: scf.for %[[K:.*]] = %[[C0]] to %[[C64]] step %[[C1]] {
211-
// CHECK: %[[ELEM:.*]] = memref.load %[[OUT]][%[[J]], %[[K]], %[[I]]]
211+
// CHECK: %[[ELEM:.*]] = memref.load %[[IN]][%[[I]], %[[J]], %[[K]]]
212212
// CHECK: memref.store %[[ELEM]], %[[OUT]][%[[J]], %[[K]], %[[I]]]
213213

214214
// -----

0 commit comments

Comments
 (0)