MLIR
20.0.0git
|
OpOrInterfaceRewritePatternBase is a wrapper around RewritePattern that allows for matching and rewriting against an instance of a derived operation class or Interface. More...
#include "mlir/IR/PatternMatch.h"
Inherits mlir::RewritePattern.
Inherited by mlir::OpInterfaceRewritePattern< DestinationStyleOpInterface >, mlir::OpInterfaceRewritePattern< LinalgOp >, mlir::OpRewritePattern< DepthwiseConv2DNhwcHwcOp >, mlir::OpRewritePattern< tosa::MaxPool2dOp >, mlir::OpRewritePattern< tosa::PadOp >, mlir::OpRewritePattern< Op >, mlir::OpRewritePattern< CollapseOpTy >, mlir::OpRewritePattern< BitcastOp >, mlir::OpRewritePattern< ExpandOpTy >, mlir::OpRewritePattern< spirv::UModOp >, mlir::OpRewritePattern< tensor::InsertSliceOp >, mlir::OpRewritePattern< OpTy >, mlir::OpRewritePattern< PackOp >, mlir::OpRewritePattern< IndexSwitchOp >, mlir::OpRewritePattern< CollapseShapeOp >, mlir::OpRewritePattern< GenericOp >, mlir::OpRewritePattern< tensor::PackOp >, mlir::OpRewritePattern< tensor::UnPackOp >, mlir::OpRewritePattern< tosa::ConcatOp >, mlir::OpRewritePattern< T >, mlir::OpRewritePattern< math::ErfOp >, mlir::OpRewritePattern< tensor::PadOp >, mlir::OpRewritePattern< memref::CopyOp >, mlir::OpRewritePattern< ReshapeOpTy >, mlir::OpRewritePattern< MulOp >, mlir::OpRewritePattern< linalg::TransposeOp >, mlir::OpRewritePattern< scf::IndexSwitchOp >, mlir::OpRewritePattern< AllocaScopeOp >, mlir::OpRewritePattern< arith::SelectOp >, mlir::OpRewritePattern< IterateOp >, mlir::OpRewritePattern< ForOp >, mlir::OpRewritePattern< spirv::IAddCarryOp >, mlir::OpRewritePattern< InsertStridedSliceOp >, mlir::OpRewritePattern< linalg::AddOp >, mlir::OpRewritePattern< AddOpType >, mlir::OpRewritePattern< vector::TransposeOp >, mlir::OpRewritePattern< vector::TransferReadOp >, mlir::OpRewritePattern< WarpExecuteOnLane0Op >, mlir::OpRewritePattern< arith::BitcastOp >, mlir::OpRewritePattern< CmpFOp >, mlir::OpRewritePattern< tosa::ClampOp >, mlir::OpRewritePattern< spirv::UMulExtendedOp >, mlir::OpRewritePattern< ExtractStridedSliceOp >, mlir::OpRewritePattern< tosa::SliceOp >, mlir::OpRewritePattern< Conv2DOp >, mlir::OpRewritePattern< LaunchOp >, mlir::OpRewritePattern< tosa::TransposeOp >, mlir::OpRewritePattern< vector::TransferWriteOp >, mlir::OpRewritePattern< OpType >, mlir::OpRewritePattern< tensor::ExtractSliceOp >, mlir::OpRewritePattern< ExecuteRegionOp >, mlir::OpInterfaceRewritePattern< SourceOp >, and mlir::OpRewritePattern< SourceOp >.
Public Member Functions | |
void | rewrite (Operation *op, PatternRewriter &rewriter) const final |
Wrappers around the RewritePattern methods that pass the derived op type. More... | |
LogicalResult | match (Operation *op) const final |
Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind(). More... | |
LogicalResult | matchAndRewrite (Operation *op, PatternRewriter &rewriter) const final |
Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind(). More... | |
virtual void | rewrite (SourceOp op, PatternRewriter &rewriter) const |
Rewrite and Match methods that operate on the SourceOp type. More... | |
virtual LogicalResult | match (SourceOp op) const |
virtual LogicalResult | matchAndRewrite (SourceOp op, PatternRewriter &rewriter) const |
Public Member Functions inherited from mlir::RewritePattern | |
virtual | ~RewritePattern ()=default |
Public Member Functions inherited from mlir::Pattern | |
ArrayRef< OperationName > | getGeneratedOps () const |
Return a list of operations that may be generated when rewriting an operation instance with this pattern. More... | |
std::optional< OperationName > | getRootKind () const |
Return the root node that this pattern matches. More... | |
std::optional< TypeID > | getRootInterfaceID () const |
Return the interface ID used to match the root operation of this pattern. More... | |
std::optional< TypeID > | getRootTraitID () const |
Return the trait ID used to match the root operation of this pattern. More... | |
PatternBenefit | getBenefit () const |
Return the benefit (the inverse of "cost") of matching this pattern. More... | |
bool | hasBoundedRewriteRecursion () const |
Returns true if this pattern is known to result in recursive application, i.e. More... | |
MLIRContext * | getContext () const |
Return the MLIRContext used to create this pattern. More... | |
StringRef | getDebugName () const |
Return a readable name for this pattern. More... | |
void | setDebugName (StringRef name) |
Set the human readable debug name used for this pattern. More... | |
ArrayRef< StringRef > | getDebugLabels () const |
Return the set of debug labels attached to this pattern. More... | |
void | addDebugLabels (ArrayRef< StringRef > labels) |
Add the provided debug labels to this pattern. More... | |
void | addDebugLabels (StringRef label) |
Additional Inherited Members | |
Static Public Member Functions inherited from mlir::RewritePattern | |
template<typename T , typename... Args> | |
static std::unique_ptr< T > | create (Args &&...args) |
This method provides a convenient interface for creating and initializing derived rewrite patterns of the given type T . More... | |
Protected Member Functions inherited from mlir::RewritePattern | |
Pattern (StringRef rootName, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Inherit the base constructors from Pattern . More... | |
Pattern (MatchAnyOpTypeTag tag, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Inherit the base constructors from Pattern . More... | |
Pattern (MatchInterfaceOpTypeTag tag, TypeID interfaceID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Inherit the base constructors from Pattern . More... | |
Pattern (MatchTraitOpTypeTag tag, TypeID traitID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Inherit the base constructors from Pattern . More... | |
Protected Member Functions inherited from mlir::Pattern | |
Pattern (StringRef rootName, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Construct a pattern with a certain benefit that matches the operation with the given root name. More... | |
Pattern (MatchAnyOpTypeTag tag, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Construct a pattern that may match any operation type. More... | |
Pattern (MatchInterfaceOpTypeTag tag, TypeID interfaceID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Construct a pattern that may match any operation that implements the interface defined by the provided interfaceID . More... | |
Pattern (MatchTraitOpTypeTag tag, TypeID traitID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
Construct a pattern that may match any operation that implements the trait defined by the provided traitID . More... | |
void | setHasBoundedRewriteRecursion (bool hasBoundedRecursionArg=true) |
Set the flag detailing if this pattern has bounded rewrite recursion or not. More... | |
OpOrInterfaceRewritePatternBase is a wrapper around RewritePattern that allows for matching and rewriting against an instance of a derived operation class or Interface.
Definition at line 319 of file PatternMatch.h.
|
inlinefinalvirtual |
Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind().
Reimplemented from mlir::RewritePattern.
Definition at line 326 of file PatternMatch.h.
Referenced by mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >::matchAndRewrite().
|
inlinevirtual |
Definition at line 339 of file PatternMatch.h.
|
inlinefinalvirtual |
Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind().
If successful, this function will automatically perform the rewrite.
Reimplemented from mlir::RewritePattern.
Definition at line 329 of file PatternMatch.h.
|
inlinevirtual |
Definition at line 342 of file PatternMatch.h.
References mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >::match(), and mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >::rewrite().
|
inlinefinalvirtual |
Wrappers around the RewritePattern methods that pass the derived op type.
Reimplemented from mlir::RewritePattern.
Definition at line 323 of file PatternMatch.h.
Referenced by mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >::matchAndRewrite().
|
inlinevirtual |
Rewrite and Match methods that operate on the SourceOp type.
These must be overridden by the derived pattern class.
Definition at line 336 of file PatternMatch.h.