Skip to content

Commit aeda3ee

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

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
@@ -850,11 +850,6 @@ def LinalgStructuredInterface
850850
/// `createFlatListOfOperandDims`.
851851
SmallVector<Range, 4> createLoopRanges(OpBuilder &b, Location loc);
852852

853-
/// Compute the static loop sizes necessary to vectorize the computation.
854-
/// This is done by applying `getShapesToLoopsMap` to
855-
/// `createFlatListOfOperandStaticDims`.
856-
SmallVector<int64_t, 4> computeStaticLoopSizes();
857-
858853
/// Returns the value that expresses the shape of the output in terms of
859854
/// shape of the input operands where possible
860855
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
@@ -1086,19 +1086,6 @@ SmallVector<Range, 4> LinalgOp::createLoopRanges(OpBuilder &b, Location loc) {
10861086
return res;
10871087
}
10881088

1089-
SmallVector<int64_t, 4> LinalgOp::computeStaticLoopSizes() {
1090-
AffineMap map = getLoopsToShapesMap();
1091-
unsigned numDims = map.getNumDims(), numRes = map.getNumResults();
1092-
SmallVector<int64_t, 4> allShapeSizes = createFlatListOfOperandStaticDims();
1093-
SmallVector<int64_t, 4> res(numDims, 0);
1094-
for (unsigned idx = 0; idx < numRes; ++idx) {
1095-
auto result = map.getResult(idx);
1096-
if (auto d = dyn_cast<AffineDimExpr>(result))
1097-
res[d.getPosition()] = allShapeSizes[idx];
1098-
}
1099-
return res;
1100-
}
1101-
11021089
/// Visitor to check if any of the given set of positions from AffineDimExprs
11031090
/// are used within an AffineExpr.
11041091
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)