Skip to content

Commit 1c27899

Browse files
committed
[mlir][SCF] Pass result of getAsOpFoldResult to getBoundedTileSize.
A recent change modified the parameter tileSize from Value to OpFoldResult. Therefore we should call getAsOpFoldResult before passing on the tileSize. Adjust a test regarding this new behavior.
1 parent a323896 commit 1c27899

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ static SmallVector<scf::ForOp> generateTileLoopNest(
172172
loc, offset, size, tileSize, ValueRange{},
173173
[&](OpBuilder &bodyBuilder, Location bodyLoc, Value iv,
174174
ValueRange /*iterArgs*/) {
175-
sizes[loopRange.index()] = getBoundedTileSize(
176-
bodyBuilder, bodyLoc, loopRange.value(), iv, tileSize);
175+
sizes[loopRange.index()] =
176+
getBoundedTileSize(bodyBuilder, bodyLoc, loopRange.value(), iv,
177+
getAsOpFoldResult(tileSize));
177178
builder.create<scf::YieldOp>(loc);
178179
});
179180
offsets[loopRange.index()] = loop.getInductionVar();

mlir/test/Dialect/Tensor/tiling.mlir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ transform.sequence failures(propagate) {
150150
// CHECK: %[[RESULT:.*]] = scf.for %[[IV:.*]] = %[[C0]] to %[[C15]] step %[[C3]] iter_args(%[[INNER_OUT:.*]] =
151151
// CHECK: %[[R2:.*]] = scf.if
152152
// CHECK: %[[GEN:.*]] = tensor.generate
153-
// CHECK: %[[cast_0:.*]] = tensor.cast %[[GEN]] : tensor<14x3xf32> to tensor<?x?xf32>
154-
// CHECK: scf.yield %[[cast_0]] : tensor<?x?xf32>
153+
// CHECK: %[[cast_0:.*]] = tensor.cast %[[GEN]] : tensor<14x3xf32> to tensor<?x3xf32>
154+
// CHECK: scf.yield %[[cast_0]] : tensor<?x3xf32>
155155
// CHECK: else
156156
// CHECK: %[[SLICE:.*]] = tensor.extract_slice %arg0[0, %{{.*}}] [7, %{{.*}}] [1, 1] : tensor<7x9xf32> to tensor<7x?xf32>
157157
// CHECK: %[[PAD:.*]] = tensor.pad %[[SLICE]] low[0, 0] high[7, %{{.*}}]
158-
// CHECK: %[[cast_1:.*]] = tensor.cast %[[PAD]] : tensor<14x?xf32> to tensor<?x?xf32>
159-
// CHECK: scf.yield %[[cast_1]] : tensor<?x?xf32>
160-
// CHECK: %[[cast:.*]] = tensor.cast %[[R2]] : tensor<?x?xf32> to tensor<14x3xf32>
158+
// CHECK: %[[cast_1:.*]] = tensor.cast %[[PAD]] : tensor<14x?xf32> to tensor<?x3xf32>
159+
// CHECK: scf.yield %[[cast_1]] : tensor<?x3xf32>
160+
// CHECK: %[[cast:.*]] = tensor.cast %[[R2]] : tensor<?x3xf32> to tensor<14x3xf32>
161161
// CHECK: %[[R3:.*]] = tensor.insert_slice %[[cast]] into %[[INNER_OUT]][0, %[[IV]]] [14, 3] [1, 1] : tensor<14x3xf32> into tensor<14x15xf32>
162162
// CHECK: scf.yield %[[R3]] : tensor<14x15xf32>
163163
// CHECK: return %[[RESULT]] : tensor<14x15xf32>

0 commit comments

Comments
 (0)