MLIR
20.0.0git
|
ReductionTreePass will build a reduction tree during module reduction and the ReductionNode represents the vertex of the tree. More...
#include "mlir/Reducer/ReductionNode.h"
Classes | |
class | iterator |
class | iterator< SinglePath > |
Public Types | |
using | Range = std::pair< int, int > |
Public Member Functions | |
ReductionNode (ReductionNode *parent, const std::vector< Range > &range, llvm::SpecificBumpPtrAllocator< ReductionNode > &allocator) | |
Root node will have the parent pointer point to themselves. More... | |
ReductionNode * | getParent () const |
ModuleOp | getModule () const |
If the ReductionNode hasn't been tested the interestingness, it'll be the same module as the one in the parent node. More... | |
Region & | getRegion () const |
Return the region we're reducing. More... | |
size_t | getSize () const |
Return the size of the module. More... | |
Tester::Interestingness | isInteresting () const |
Returns true if the module exhibits the interesting behavior. More... | |
ArrayRef< Range > | getStartRanges () const |
Return the range information that how this node is reduced from the parent node. More... | |
ArrayRef< Range > | getRanges () const |
Return the range set we are using to generate variants. More... | |
ArrayRef< ReductionNode * > | getVariants () const |
Return the generated variants(the child nodes). More... | |
ArrayRef< ReductionNode * > | generateNewVariants () |
Split the ranges and generate new variants. More... | |
void | update (std::pair< Tester::Interestingness, size_t > result) |
Update the interestingness result from tester. More... | |
LogicalResult | initialize (ModuleOp parentModule, Region &parentRegion) |
Each Reduction Node contains a copy of module for applying rewrite patterns. More... | |
ReductionTreePass will build a reduction tree during module reduction and the ReductionNode represents the vertex of the tree.
A ReductionNode records the information such as the reduced module, how this node is reduced from the parent node, etc. This information will be used to construct a reduction path to reduce the certain module.
Definition at line 43 of file ReductionNode.h.
using mlir::ReductionNode::Range = std::pair<int, int> |
Definition at line 48 of file ReductionNode.h.
ReductionNode::ReductionNode | ( | ReductionNode * | parent, |
const std::vector< Range > & | range, | ||
llvm::SpecificBumpPtrAllocator< ReductionNode > & | allocator | ||
) |
Root node will have the parent pointer point to themselves.
Definition at line 26 of file ReductionNode.cpp.
References getModule(), getRegion(), and initialize().
Referenced by generateNewVariants().
ArrayRef< ReductionNode * > ReductionNode::generateNewVariants | ( | ) |
Split the ranges and generate new variants.
If we haven't explored any variants from this node, we will create N variants, N is the length of ranges
if N > 1.
Otherwise, we will split the max element in ranges
and create 2 new variants for each call.
Definition at line 52 of file ReductionNode.cpp.
References getRanges(), getVariants(), and ReductionNode().
|
inline |
If the ReductionNode hasn't been tested the interestingness, it'll be the same module as the one in the parent node.
Otherwise, the returned module will have been applied certain reduction strategies. Note that it's not necessary to be an interesting case or a reduced module (has smaller size than parent's).
Definition at line 60 of file ReductionNode.h.
References mlir::OwningOpRef< OpTy >::get().
Referenced by findOptimal(), and ReductionNode().
|
inline |
Definition at line 53 of file ReductionNode.h.
Referenced by findOptimal().
Return the range set we are using to generate variants.
Definition at line 76 of file ReductionNode.h.
Referenced by findOptimal(), and generateNewVariants().
|
inline |
Return the region we're reducing.
Definition at line 63 of file ReductionNode.h.
Referenced by findOptimal(), and ReductionNode().
|
inline |
Return the size of the module.
Definition at line 66 of file ReductionNode.h.
Referenced by findOptimal().
Return the range information that how this node is reduced from the parent node.
Definition at line 73 of file ReductionNode.h.
Referenced by findOptimal().
|
inline |
Return the generated variants(the child nodes).
Definition at line 79 of file ReductionNode.h.
Referenced by generateNewVariants().
LogicalResult ReductionNode::initialize | ( | ModuleOp | parentModule, |
Region & | parentRegion | ||
) |
Each Reduction Node contains a copy of module for applying rewrite patterns.
In addition, we only apply rewrite patterns in a certain region. In init(), we will duplicate the module from parent node and locate the corresponding region.
Definition at line 38 of file ReductionNode.cpp.
References mlir::Region::begin(), mlir::Block::getParent(), and mlir::IRMapping::lookup().
Referenced by findOptimal(), and ReductionNode().
|
inline |
Returns true if the module exhibits the interesting behavior.
Definition at line 69 of file ReductionNode.h.
Referenced by findOptimal().
void ReductionNode::update | ( | std::pair< Tester::Interestingness, size_t > | result | ) |
Update the interestingness result from tester.
Definition at line 104 of file ReductionNode.cpp.
References mlir::Region::op_begin(), mlir::Region::op_end(), mlir::OwningOpRef< OpTy >::release(), and mlir::Tester::True.
Referenced by findOptimal().