[Mlir-commits] [mlir] b302829 - [mlir][linalg] Remove `computeStaticLoopSizes` (#124778)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Feb 17 02:23:31 PST 2025
Author: josel-amd
Date: 2025-02-17T11:23:27+01:00
New Revision: b3028295e741159e5014c126cd74988785fe8bdb
URL: https://github.com/llvm/llvm-project/commit/b3028295e741159e5014c126cd74988785fe8bdb
DIFF: https://github.com/llvm/llvm-project/commit/b3028295e741159e5014c126cd74988785fe8bdb.diff
LOG: [mlir][linalg] Remove `computeStaticLoopSizes` (#124778)
`computeStaticLoopSizes()` is functionally identical to `getStaticLoopRanges()`.
Replace all uses of `computeStaticLoopSizes()` by `getStaticLoopRanges()` and remove the former.
Added:
Modified:
mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
index 98a5fd278a997..dbc1ac60e0973 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td
@@ -863,11 +863,6 @@ def LinalgStructuredInterface
/// `createFlatListOfOperandDims`.
SmallVector<Range, 4> createLoopRanges(OpBuilder &b, Location loc);
- /// Compute the static loop sizes necessary to vectorize the computation.
- /// This is done by applying `getShapesToLoopsMap` to
- /// `createFlatListOfOperandStaticDims`.
- SmallVector<int64_t, 4> computeStaticLoopSizes();
-
/// Returns the value that expresses the shape of the output in terms of
/// shape of the input operands where possible
LogicalResult reifyResultShapes(OpBuilder &b,
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
index 4185fcce393d5..466a9799295f9 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
@@ -1094,19 +1094,6 @@ SmallVector<Range, 4> LinalgOp::createLoopRanges(OpBuilder &b, Location loc) {
return res;
}
-SmallVector<int64_t, 4> LinalgOp::computeStaticLoopSizes() {
- AffineMap map = getLoopsToShapesMap();
- unsigned numDims = map.getNumDims(), numRes = map.getNumResults();
- SmallVector<int64_t, 4> allShapeSizes = createFlatListOfOperandStaticDims();
- SmallVector<int64_t, 4> res(numDims, 0);
- for (unsigned idx = 0; idx < numRes; ++idx) {
- auto result = map.getResult(idx);
- if (auto d = dyn_cast<AffineDimExpr>(result))
- res[d.getPosition()] = allShapeSizes[idx];
- }
- return res;
-}
-
/// Visitor to check if any of the given set of positions from AffineDimExprs
/// are used within an AffineExpr.
struct HasAffineDimExprVisitor
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp b/mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp
index 2e6079e1402e1..b53180b5cf7c3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp
@@ -130,7 +130,7 @@ class FoldConstantBase : public OpInterfaceRewritePattern<LinalgOp> {
return failure();
}
- SmallVector<int64_t, 4> loopBounds = linalgOp.computeStaticLoopSizes();
+ SmallVector<int64_t, 4> loopBounds = linalgOp.getStaticLoopRanges();
int64_t numElements = outputType.getNumElements();
// Use APInt/APFloat instead of Attribute here for constructing the output.
More information about the Mlir-commits
mailing list