Skip to content

Commit b302829

Browse files
authored
[mlir][linalg] Remove computeStaticLoopSizes (llvm#124778)
`computeStaticLoopSizes()` is functionally identical to `getStaticLoopRanges()`. Replace all uses of `computeStaticLoopSizes()` by `getStaticLoopRanges()` and remove the former.
1 parent f378e52 commit b302829

File tree

3 files changed

+1
-19
lines changed

3 files changed

+1
-19
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,6 @@ def LinalgStructuredInterface
863863
/// `createFlatListOfOperandDims`.
864864
SmallVector<Range, 4> createLoopRanges(OpBuilder &b, Location loc);
865865

866-
/// Compute the static loop sizes necessary to vectorize the computation.
867-
/// This is done by applying `getShapesToLoopsMap` to
868-
/// `createFlatListOfOperandStaticDims`.
869-
SmallVector<int64_t, 4> computeStaticLoopSizes();
870-
871866
/// Returns the value that expresses the shape of the output in terms of
872867
/// shape of the input operands where possible
873868
LogicalResult reifyResultShapes(OpBuilder &b,

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,19 +1094,6 @@ SmallVector<Range, 4> LinalgOp::createLoopRanges(OpBuilder &b, Location loc) {
10941094
return res;
10951095
}
10961096

1097-
SmallVector<int64_t, 4> LinalgOp::computeStaticLoopSizes() {
1098-
AffineMap map = getLoopsToShapesMap();
1099-
unsigned numDims = map.getNumDims(), numRes = map.getNumResults();
1100-
SmallVector<int64_t, 4> allShapeSizes = createFlatListOfOperandStaticDims();
1101-
SmallVector<int64_t, 4> res(numDims, 0);
1102-
for (unsigned idx = 0; idx < numRes; ++idx) {
1103-
auto result = map.getResult(idx);
1104-
if (auto d = dyn_cast<AffineDimExpr>(result))
1105-
res[d.getPosition()] = allShapeSizes[idx];
1106-
}
1107-
return res;
1108-
}
1109-
11101097
/// Visitor to check if any of the given set of positions from AffineDimExprs
11111098
/// are used within an AffineExpr.
11121099
struct HasAffineDimExprVisitor

mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class FoldConstantBase : public OpInterfaceRewritePattern<LinalgOp> {
130130
return failure();
131131
}
132132

133-
SmallVector<int64_t, 4> loopBounds = linalgOp.computeStaticLoopSizes();
133+
SmallVector<int64_t, 4> loopBounds = linalgOp.getStaticLoopRanges();
134134
int64_t numElements = outputType.getNumElements();
135135

136136
// Use APInt/APFloat instead of Attribute here for constructing the output.

0 commit comments

Comments
 (0)