MLIR  20.0.0git
Classes | Public Types | Public Member Functions | List of all members
mlir::ReductionNode Class Reference

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...
 
ReductionNodegetParent () 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...
 
RegiongetRegion () 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< RangegetStartRanges () const
 Return the range information that how this node is reduced from the parent node. More...
 
ArrayRef< RangegetRanges () 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...
 

Detailed Description

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.

Member Typedef Documentation

◆ Range

using mlir::ReductionNode::Range = std::pair<int, int>

Definition at line 48 of file ReductionNode.h.

Constructor & Destructor Documentation

◆ ReductionNode()

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().

Member Function Documentation

◆ 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().

◆ getModule()

ModuleOp mlir::ReductionNode::getModule ( ) const
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().

◆ getParent()

ReductionNode* mlir::ReductionNode::getParent ( ) const
inline

Definition at line 53 of file ReductionNode.h.

Referenced by findOptimal().

◆ getRanges()

ArrayRef<Range> mlir::ReductionNode::getRanges ( ) const
inline

Return the range set we are using to generate variants.

Definition at line 76 of file ReductionNode.h.

Referenced by findOptimal(), and generateNewVariants().

◆ getRegion()

Region& mlir::ReductionNode::getRegion ( ) const
inline

Return the region we're reducing.

Definition at line 63 of file ReductionNode.h.

Referenced by findOptimal(), and ReductionNode().

◆ getSize()

size_t mlir::ReductionNode::getSize ( ) const
inline

Return the size of the module.

Definition at line 66 of file ReductionNode.h.

Referenced by findOptimal().

◆ getStartRanges()

ArrayRef<Range> mlir::ReductionNode::getStartRanges ( ) const
inline

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().

◆ getVariants()

ArrayRef<ReductionNode *> mlir::ReductionNode::getVariants ( ) const
inline

Return the generated variants(the child nodes).

Definition at line 79 of file ReductionNode.h.

Referenced by generateNewVariants().

◆ initialize()

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().

◆ isInteresting()

Tester::Interestingness mlir::ReductionNode::isInteresting ( ) const
inline

Returns true if the module exhibits the interesting behavior.

Definition at line 69 of file ReductionNode.h.

Referenced by findOptimal().

◆ update()

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().


The documentation for this class was generated from the following files: