MLIR
20.0.0git
|
#include "mlir/IR/DialectInterface.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/Reducer/Passes.h"
#include "mlir/Reducer/ReductionNode.h"
#include "mlir/Reducer/ReductionPatternInterface.h"
#include "mlir/Reducer/Tester.h"
#include "mlir/Rewrite/FrozenRewritePatternSet.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ManagedStatic.h"
#include "mlir/Reducer/Passes.h.inc"
Go to the source code of this file.
Namespaces | |
mlir | |
Include the generated interface declarations. | |
Macros | |
#define | GEN_PASS_DEF_REDUCTIONTREE |
Functions | |
static void | applyPatterns (Region ®ion, const FrozenRewritePatternSet &patterns, ArrayRef< ReductionNode::Range > rangeToKeep, bool eraseOpNotInRange) |
We implicitly number each operation in the region and if an operation's number falls into rangeToKeep, we need to keep it and apply the given rewrite patterns on it. More... | |
template<typename IteratorType > | |
static LogicalResult | findOptimal (ModuleOp module, Region ®ion, const FrozenRewritePatternSet &patterns, const Tester &test, bool eraseOpNotInRange) |
We will apply the reducer patterns to the operations in the ranges specified by ReductionNode. More... | |
template<typename IteratorType > | |
static LogicalResult | findOptimal (ModuleOp module, Region ®ion, const FrozenRewritePatternSet &patterns, const Tester &test) |
#define GEN_PASS_DEF_REDUCTIONTREE |
Definition at line 32 of file ReductionTreePass.cpp.
|
static |
We implicitly number each operation in the region and if an operation's number falls into rangeToKeep, we need to keep it and apply the given rewrite patterns on it.
Definition at line 41 of file ReductionTreePass.cpp.
References mlir::applyOpPatternsAndFold(), mlir::detail::enumerate(), mlir::ExistingOps, mlir::Region::getOps(), and mlir::GreedyRewriteConfig::strictMode.
Referenced by findOptimal().
|
static |
Definition at line 151 of file ReductionTreePass.cpp.
|
static |
We will apply the reducer patterns to the operations in the ranges specified by ReductionNode.
Note that we are not able to remove an operation without replacing it with another valid operation. However, The validity of module reduction is based on the Tester provided by the user and that means certain invalid module is still interested by the use. Thus we provide an alternative way to remove operations, which is using eraseOpNotInRange
to erase the operations not in the range specified by ReductionNode.
Definition at line 86 of file ReductionTreePass.cpp.
References applyPatterns(), mlir::ReductionNode::getModule(), mlir::ReductionNode::getParent(), mlir::ReductionNode::getRanges(), mlir::ReductionNode::getRegion(), mlir::ReductionNode::getSize(), mlir::ReductionNode::getStartRanges(), mlir::ReductionNode::initialize(), mlir::ReductionNode::isInteresting(), mlir::Tester::isInteresting(), mlir::Region::op_begin(), mlir::Region::op_end(), mlir::Tester::True, and mlir::ReductionNode::update().