Skip to content

Commit da51d56

Browse files
Update mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Co-authored-by: Fabian Mora <fmora.dev@gmail.com>
1 parent bfabf8d commit da51d56

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
10+
#include "mlir/Dialect/Arith/Utils/Utils.h"
1011
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
1112
#include "mlir/Dialect/Func/IR/FuncOps.h"
1213
#include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -195,9 +196,12 @@ FailureOr<Value> bufferization::allocateTensorForShapedValue(
195196
reifiedShapes = true;
196197
auto &shape =
197198
resultDims[llvm::cast<OpResult>(shapedValue).getResultNumber()];
198-
for (const auto &dim : enumerate(tensorType.getShape()))
199-
if (ShapedType::isDynamic(dim.value()))
200-
dynamicSizes.push_back(cast<Value>(shape[dim.index()]));
199+
for (const auto &dim : enumerate(tensorType.getShape())) {
200+
if (ShapedType::isDynamic(dim.value())) {
201+
dynamicSizes.push_back(
202+
getValueOrCreateConstantIndexOp(b, loc, shape[dim.index()]));
203+
}
204+
}
201205
}
202206
}
203207

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3809,7 +3809,6 @@ PadOp::reifyResultShapes(OpBuilder &b,
38093809
Value dim = b.createOrFold<tensor::DimOp>(
38103810
loc, getSource(), b.create<arith::ConstantIndexOp>(loc, i));
38113811

3812-
affine::AffineBuilder ab(b, loc);
38133812
AffineExpr d0, d1, d2;
38143813
bindDims(b.getContext(), d0, d1, d2);
38153814
reifiedReturnShapes[0][i] = affine::makeComposedFoldedAffineApply(

0 commit comments

Comments
 (0)