MLIR  17.0.0git
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 44 of file ReductionNode.h.

◆ Range

 using mlir::ReductionNode::Range = std::pair

Definition at line 49 of file ReductionNode.h.

◆ 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 mlir::failed(), getModule(), getRegion(), and initialize().

Referenced by generateNewVariants().

◆ 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 61 of file ReductionNode.h.

References mlir::OwningOpRef< OpTy >::get().

Referenced by findOptimal(), and ReductionNode().

◆ getParent()

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

Definition at line 54 of file ReductionNode.h.

Referenced by findOptimal().

◆ getRanges()

 ArrayRef mlir::ReductionNode::getRanges ( ) const
inline

Return the range set we are using to generate variants.

Definition at line 77 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 64 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 67 of file ReductionNode.h.

Referenced by findOptimal().

◆ getStartRanges()

 ArrayRef mlir::ReductionNode::getStartRanges ( ) const
inline

Return the range information that how this node is reduced from the parent node.

Definition at line 74 of file ReductionNode.h.

Referenced by findOptimal().

◆ getVariants()

 ArrayRef mlir::ReductionNode::getVariants ( ) const
inline

Return the generated variants(the child nodes).

Definition at line 80 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.

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 70 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.

Referenced by findOptimal().

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