Skip to content

Commit 4bc1938

Browse files
Update mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Co-authored-by: Fabian Mora <[email protected]>
1 parent bfabf8d commit 4bc1938

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

mlir/include/mlir/Interfaces/InferTypeOpInterface.td

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,8 @@ def ReifyRankedShapedTypeOpInterface :
366366

367367
`reifiedReturnShapes` is populated with one vector per op result. Each
368368
of those vectors contains an OpFoldResult for each dimension of the
369-
shaped type. In case a dimension in the type is static, the
370-
corresponding entry is an IntegerAttr. Otherwise, it is a Value. The
371-
given builder may be used to insert ops that compute result shapes.
369+
shaped type. The given builder may be used to insert ops that compute
370+
result shapes.
372371

373372
If the shape of a particular result cannot be computed it must be empty.
374373
}],

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
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"
1314
#include "mlir/Dialect/Tensor/IR/Tensor.h"
1415
#include "mlir/IR/AsmState.h"
15-
#include "mlir/IR/BuiltinOps.h"
16-
#include "mlir/IR/IRMapping.h"
1716
#include "mlir/IR/Operation.h"
1817
#include "mlir/IR/TypeUtilities.h"
1918
#include "mlir/IR/Value.h"
@@ -195,9 +194,12 @@ FailureOr<Value> bufferization::allocateTensorForShapedValue(
195194
reifiedShapes = true;
196195
auto &shape =
197196
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()]));
197+
for (const auto &dim : enumerate(tensorType.getShape())) {
198+
if (ShapedType::isDynamic(dim.value())) {
199+
dynamicSizes.push_back(
200+
getValueOrCreateConstantIndexOp(b, loc, shape[dim.index()]));
201+
}
202+
}
201203
}
202204
}
203205

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)