summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Transforms')
-rw-r--r--mlir/lib/Transforms/ComposeAffineMaps.cpp7
-rw-r--r--mlir/lib/Transforms/LowerVectorTransfers.cpp2
-rw-r--r--mlir/lib/Transforms/MaterializeVectors.cpp4
-rw-r--r--mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp6
-rw-r--r--mlir/lib/Transforms/Vectorize.cpp32
5 files changed, 24 insertions, 27 deletions
diff --git a/mlir/lib/Transforms/ComposeAffineMaps.cpp b/mlir/lib/Transforms/ComposeAffineMaps.cpp
index 3dc81a0d793..4752928d062 100644
--- a/mlir/lib/Transforms/ComposeAffineMaps.cpp
+++ b/mlir/lib/Transforms/ComposeAffineMaps.cpp
@@ -22,7 +22,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/MLFunctionMatcher.h"
+#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
@@ -49,7 +49,7 @@ struct ComposeAffineMaps : public FunctionPass {
PassResult runOnFunction(Function *f) override;
// Thread-safe RAII contexts local to pass, BumpPtrAllocator freed on exit.
- MLFunctionMatcherContext MLContext;
+ NestedPatternContext MLContext;
static char passID;
};
@@ -74,8 +74,7 @@ PassResult ComposeAffineMaps::runOnFunction(Function *f) {
auto apps = pattern.match(f);
for (auto m : apps) {
auto app = cast<OperationInst>(m.first)->cast<AffineApplyOp>();
- SmallVector<Value *, 8> operands(app->getOperands().begin(),
- app->getOperands().end());
+ SmallVector<Value *, 8> operands(app->getOperands());
FuncBuilder b(m.first);
auto newApp = makeComposedAffineApply(&b, app->getLoc(),
app->getAffineMap(), operands);
diff --git a/mlir/lib/Transforms/LowerVectorTransfers.cpp b/mlir/lib/Transforms/LowerVectorTransfers.cpp
index 19208d4c268..bb080949293 100644
--- a/mlir/lib/Transforms/LowerVectorTransfers.cpp
+++ b/mlir/lib/Transforms/LowerVectorTransfers.cpp
@@ -22,7 +22,7 @@
#include <type_traits>
#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/MLFunctionMatcher.h"
+#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Analysis/VectorAnalysis.h"
#include "mlir/EDSC/MLIREmitter.h"
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp
index 8be97afeebd..7dd3cecdfed 100644
--- a/mlir/lib/Transforms/MaterializeVectors.cpp
+++ b/mlir/lib/Transforms/MaterializeVectors.cpp
@@ -23,7 +23,7 @@
#include "mlir/Analysis/AffineAnalysis.h"
#include "mlir/Analysis/Dominance.h"
#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/MLFunctionMatcher.h"
+#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Analysis/Utils.h"
#include "mlir/Analysis/VectorAnalysis.h"
@@ -200,7 +200,7 @@ struct MaterializeVectorsPass : public FunctionPass {
PassResult runOnFunction(Function *f) override;
// Thread-safe RAII contexts local to pass, BumpPtrAllocator freed on exit.
- MLFunctionMatcherContext mlContext;
+ NestedPatternContext mlContext;
static char passID;
};
diff --git a/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp b/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp
index c08ffd4cd7d..0a199f008d6 100644
--- a/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp
+++ b/mlir/lib/Transforms/Vectorization/VectorizerTestPass.cpp
@@ -20,7 +20,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/AffineAnalysis.h"
-#include "mlir/Analysis/MLFunctionMatcher.h"
+#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Analysis/VectorAnalysis.h"
#include "mlir/IR/Builders.h"
@@ -95,7 +95,7 @@ struct VectorizerTestPass : public FunctionPass {
void testNormalizeMaps(Function *f);
// Thread-safe RAII contexts local to pass, BumpPtrAllocator freed on exit.
- MLFunctionMatcherContext MLContext;
+ NestedPatternContext MLContext;
static char passID;
};
@@ -153,7 +153,7 @@ static std::string toString(Instruction *inst) {
return res;
}
-static MLFunctionMatches matchTestSlicingOps(Function *f) {
+static NestedMatch matchTestSlicingOps(Function *f) {
// Just use a custom op name for this test, it makes life easier.
constexpr auto kTestSlicingOpName = "slicing-test-op";
using functional::map;
diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp
index 29a97991d5e..e9b37fcc04c 100644
--- a/mlir/lib/Transforms/Vectorize.cpp
+++ b/mlir/lib/Transforms/Vectorize.cpp
@@ -21,7 +21,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Analysis/LoopAnalysis.h"
-#include "mlir/Analysis/MLFunctionMatcher.h"
+#include "mlir/Analysis/NestedMatcher.h"
#include "mlir/Analysis/VectorAnalysis.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/Builders.h"
@@ -567,14 +567,14 @@ static FilterFunctionType
isVectorizableLoopPtrFactory(unsigned fastestVaryingMemRefDimension);
// Build a bunch of predetermined patterns that will be traversed in order.
-// Due to the recursive nature of MLFunctionMatchers, this captures
+// Due to the recursive nature of NestedPatterns, this captures
// arbitrarily nested pairs of loops at any position in the tree.
/// Note that this currently only matches 2 nested loops and will be extended.
// TODO(ntv): support 3-D loop patterns with a common reduction loop that can
// be matched to GEMMs.
-static std::vector<MLFunctionMatcher> defaultPatterns() {
+static std::vector<NestedPattern> defaultPatterns() {
using matcher::For;
- return std::vector<MLFunctionMatcher>{
+ return std::vector<NestedPattern>{
// 3-D patterns
For(isVectorizableLoopPtrFactory(2),
For(isVectorizableLoopPtrFactory(1),
@@ -627,7 +627,7 @@ static std::vector<MLFunctionMatcher> defaultPatterns() {
/// Up to 3-D patterns are supported.
/// If the command line argument requests a pattern of higher order, returns an
/// empty pattern list which will conservatively result in no vectorization.
-static std::vector<MLFunctionMatcher> makePatterns() {
+static std::vector<NestedPattern> makePatterns() {
using matcher::For;
if (clFastestVaryingPattern.empty()) {
return defaultPatterns();
@@ -644,7 +644,7 @@ static std::vector<MLFunctionMatcher> makePatterns() {
For(isVectorizableLoopPtrFactory(clFastestVaryingPattern[1]),
For(isVectorizableLoopPtrFactory(clFastestVaryingPattern[2]))))};
default:
- return std::vector<MLFunctionMatcher>();
+ return std::vector<NestedPattern>();
}
}
@@ -656,7 +656,7 @@ struct Vectorize : public FunctionPass {
PassResult runOnFunction(Function *f) override;
// Thread-safe RAII contexts local to pass, BumpPtrAllocator freed on exit.
- MLFunctionMatcherContext MLContext;
+ NestedPatternContext MLContext;
static char passID;
};
@@ -703,8 +703,8 @@ static void vectorizeLoopIfProfitable(ForInst *loop, unsigned depthInPattern,
/// 3. account for impact of vectorization on maximal loop fusion.
/// Then we can quantify the above to build a cost model and search over
/// strategies.
-static bool analyzeProfitability(MLFunctionMatches matches,
- unsigned depthInPattern, unsigned patternDepth,
+static bool analyzeProfitability(NestedMatch matches, unsigned depthInPattern,
+ unsigned patternDepth,
VectorizationStrategy *strategy) {
for (auto m : matches) {
auto *loop = cast<ForInst>(m.first);
@@ -890,7 +890,7 @@ static bool vectorizeForInst(ForInst *loop, int64_t step,
return false;
}
-/// Returns a FilterFunctionType that can be used in MLFunctionMatcher to
+/// Returns a FilterFunctionType that can be used in NestedPattern to
/// match a loop whose underlying load/store accesses are all varying along the
/// `fastestVaryingMemRefDimension`.
/// TODO(ntv): In the future, allow more interesting mixed layout permutation
@@ -906,16 +906,15 @@ isVectorizableLoopPtrFactory(unsigned fastestVaryingMemRefDimension) {
}
/// Forward-declaration.
-static bool vectorizeNonRoot(MLFunctionMatches matches,
- VectorizationState *state);
+static bool vectorizeNonRoot(NestedMatch matches, VectorizationState *state);
/// Apply vectorization of `loop` according to `state`. This is only triggered
/// if all vectorizations in `childrenMatches` have already succeeded
/// recursively in DFS post-order.
-static bool doVectorize(MLFunctionMatches::EntryType oneMatch,
+static bool doVectorize(NestedMatch::EntryType oneMatch,
VectorizationState *state) {
ForInst *loop = cast<ForInst>(oneMatch.first);
- MLFunctionMatches childrenMatches = oneMatch.second;
+ NestedMatch childrenMatches = oneMatch.second;
// 1. DFS postorder recursion, if any of my children fails, I fail too.
auto fail = vectorizeNonRoot(childrenMatches, state);
@@ -949,8 +948,7 @@ static bool doVectorize(MLFunctionMatches::EntryType oneMatch,
/// Non-root pattern iterates over the matches at this level, calls doVectorize
/// and exits early if anything below fails.
-static bool vectorizeNonRoot(MLFunctionMatches matches,
- VectorizationState *state) {
+static bool vectorizeNonRoot(NestedMatch matches, VectorizationState *state) {
for (auto m : matches) {
auto fail = doVectorize(m, state);
if (fail) {
@@ -1186,7 +1184,7 @@ static bool vectorizeOperations(VectorizationState *state) {
/// The root match thus needs to maintain a clone for handling failure.
/// Each root may succeed independently but will otherwise clean after itself if
/// anything below it fails.
-static bool vectorizeRootMatches(MLFunctionMatches matches,
+static bool vectorizeRootMatches(NestedMatch matches,
VectorizationStrategy *strategy) {
for (auto m : matches) {
auto *loop = cast<ForInst>(m.first);
OpenPOWER on IntegriCloud