From 163034784b05f5aaf9f27015d6ed125e98d60802 Mon Sep 17 00:00:00 2001 From: Jose Lopes Date: Mon, 27 Jan 2025 10:25:48 +0000 Subject: [PATCH] Remove duplicated function --- .../mlir/Dialect/Linalg/IR/LinalgInterfaces.td | 5 ----- mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp | 13 ------------- mlir/lib/Dialect/Linalg/Transforms/ConstantFold.cpp | 2 +- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td index 0a404194569c2..1e21f781bc4e5 100644 --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td @@ -850,11 +850,6 @@ def LinalgStructuredInterface /// `createFlatListOfOperandDims`. SmallVector createLoopRanges(OpBuilder &b, Location loc); - /// Compute the static loop sizes necessary to vectorize the computation. - /// This is done by applying `getShapesToLoopsMap` to - /// `createFlatListOfOperandStaticDims`. - SmallVector 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 bd77965194b27..3b705f64bfe40 100644 --- a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp @@ -1086,19 +1086,6 @@ SmallVector LinalgOp::createLoopRanges(OpBuilder &b, Location loc) { return res; } -SmallVector LinalgOp::computeStaticLoopSizes() { - AffineMap map = getLoopsToShapesMap(); - unsigned numDims = map.getNumDims(), numRes = map.getNumResults(); - SmallVector allShapeSizes = createFlatListOfOperandStaticDims(); - SmallVector res(numDims, 0); - for (unsigned idx = 0; idx < numRes; ++idx) { - auto result = map.getResult(idx); - if (auto d = dyn_cast(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 { return failure(); } - SmallVector loopBounds = linalgOp.computeStaticLoopSizes(); + SmallVector loopBounds = linalgOp.getStaticLoopRanges(); int64_t numElements = outputType.getNumElements(); // Use APInt/APFloat instead of Attribute here for constructing the output.