MLIR  21.0.0git
Public Member Functions | Static Public Attributes | List of all members
mlir::GreedyRewriteConfig Class Reference

This class allows control over how the GreedyPatternRewriteDriver works. More...

#include "mlir/Transforms/GreedyPatternRewriteDriver.h"

Public Member Functions

bool getUseTopDownTraversal () const
 This specifies the order of initial traversal that populates the rewriters worklist. More...
 
GreedyRewriteConfigsetUseTopDownTraversal (bool use=true)
 
GreedySimplifyRegionLevel getRegionSimplificationLevel () const
 Perform control flow optimizations to the region tree after applying all patterns. More...
 
GreedyRewriteConfigsetRegionSimplificationLevel (GreedySimplifyRegionLevel level)
 
int64_t getMaxIterations () const
 This specifies the maximum number of times the rewriter will iterate between applying patterns and simplifying regions. More...
 
GreedyRewriteConfigsetMaxIterations (int64_t iterations)
 
int64_t getMaxNumRewrites () const
 This specifies the maximum number of rewrites within an iteration. More...
 
GreedyRewriteConfigsetMaxNumRewrites (int64_t limit)
 
RegiongetScope () const
 Only ops within the scope are added to the worklist. More...
 
GreedyRewriteConfigsetScope (Region *scope)
 
GreedyRewriteStrictness getStrictness () const
 Strict mode can restrict the ops that are added to the worklist during the rewrite. More...
 
GreedyRewriteConfigsetStrictness (GreedyRewriteStrictness mode)
 
RewriterBase::ListenergetListener () const
 An optional listener that should be notified about IR modifications. More...
 
GreedyRewriteConfigsetListener (RewriterBase::Listener *listener)
 
bool isFoldingEnabled () const
 Whether this should fold while greedily rewriting. More...
 
GreedyRewriteConfigenableFolding (bool enable=true)
 
bool isConstantCSEEnabled () const
 If set to "true", constants are CSE'd (even across multiple regions that are in a parent-ancestor relationship). More...
 
GreedyRewriteConfigenableConstantCSE (bool enable=true)
 

Static Public Attributes

static constexpr int64_t kNoLimit = -1
 

Detailed Description

This class allows control over how the GreedyPatternRewriteDriver works.

Definition at line 43 of file GreedyPatternRewriteDriver.h.

Member Function Documentation

◆ enableConstantCSE()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::enableConstantCSE ( bool  enable = true)
inline

Definition at line 135 of file GreedyPatternRewriteDriver.h.

◆ enableFolding()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::enableFolding ( bool  enable = true)
inline

Definition at line 127 of file GreedyPatternRewriteDriver.h.

◆ getListener()

RewriterBase::Listener* mlir::GreedyRewriteConfig::getListener ( ) const
inline

An optional listener that should be notified about IR modifications.

Definition at line 119 of file GreedyPatternRewriteDriver.h.

◆ getMaxIterations()

int64_t mlir::GreedyRewriteConfig::getMaxIterations ( ) const
inline

This specifies the maximum number of times the rewriter will iterate between applying patterns and simplifying regions.

Use kNoLimit to disable this iteration limit.

Note: Only applicable when simplifying entire regions.

Definition at line 76 of file GreedyPatternRewriteDriver.h.

◆ getMaxNumRewrites()

int64_t mlir::GreedyRewriteConfig::getMaxNumRewrites ( ) const
inline

This specifies the maximum number of rewrites within an iteration.

Use kNoLimit to disable this limit.

Definition at line 84 of file GreedyPatternRewriteDriver.h.

◆ getRegionSimplificationLevel()

GreedySimplifyRegionLevel mlir::GreedyRewriteConfig::getRegionSimplificationLevel ( ) const
inline

Perform control flow optimizations to the region tree after applying all patterns.

Note: Only applicable when simplifying entire regions.

Definition at line 62 of file GreedyPatternRewriteDriver.h.

◆ getScope()

Region* mlir::GreedyRewriteConfig::getScope ( ) const
inline

Only ops within the scope are added to the worklist.

If no scope is specified, the closest enclosing region around the initial list of ops (or the specified region, depending on which greedy rewrite entry point is used) is used as a scope.

Definition at line 96 of file GreedyPatternRewriteDriver.h.

◆ getStrictness()

GreedyRewriteStrictness mlir::GreedyRewriteConfig::getStrictness ( ) const
inline

Strict mode can restrict the ops that are added to the worklist during the rewrite.

Definition at line 112 of file GreedyPatternRewriteDriver.h.

◆ getUseTopDownTraversal()

bool mlir::GreedyRewriteConfig::getUseTopDownTraversal ( ) const
inline

This specifies the order of initial traversal that populates the rewriters worklist.

When set to true, it walks the operations top-down, which is generally more efficient in compile time. When set to false, its initial traversal of the region tree is bottom up on each block, which may match larger patterns when given an ambiguous pattern set.

Note: Only applicable when simplifying entire regions.

Definition at line 52 of file GreedyPatternRewriteDriver.h.

◆ isConstantCSEEnabled()

bool mlir::GreedyRewriteConfig::isConstantCSEEnabled ( ) const
inline

If set to "true", constants are CSE'd (even across multiple regions that are in a parent-ancestor relationship).

Definition at line 134 of file GreedyPatternRewriteDriver.h.

◆ isFoldingEnabled()

bool mlir::GreedyRewriteConfig::isFoldingEnabled ( ) const
inline

Whether this should fold while greedily rewriting.

Definition at line 126 of file GreedyPatternRewriteDriver.h.

◆ setListener()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setListener ( RewriterBase::Listener listener)
inline

Definition at line 120 of file GreedyPatternRewriteDriver.h.

◆ setMaxIterations()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setMaxIterations ( int64_t  iterations)
inline

Definition at line 77 of file GreedyPatternRewriteDriver.h.

◆ setMaxNumRewrites()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setMaxNumRewrites ( int64_t  limit)
inline

Definition at line 85 of file GreedyPatternRewriteDriver.h.

◆ setRegionSimplificationLevel()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setRegionSimplificationLevel ( GreedySimplifyRegionLevel  level)
inline

Definition at line 66 of file GreedyPatternRewriteDriver.h.

◆ setScope()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setScope ( Region scope)
inline

Definition at line 97 of file GreedyPatternRewriteDriver.h.

◆ setStrictness()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setStrictness ( GreedyRewriteStrictness  mode)
inline

◆ setUseTopDownTraversal()

GreedyRewriteConfig& mlir::GreedyRewriteConfig::setUseTopDownTraversal ( bool  use = true)
inline

Definition at line 53 of file GreedyPatternRewriteDriver.h.

Member Data Documentation

◆ kNoLimit

constexpr int64_t mlir::GreedyRewriteConfig::kNoLimit = -1
staticconstexpr

Definition at line 90 of file GreedyPatternRewriteDriver.h.


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