|
MLIR 22.0.0git
|
RewritePattern is the common base class for all DAG to DAG replacements. More...
#include "mlir/IR/PatternMatch.h"
Inherits mlir::Pattern.
Inherited by mlir::HomomorphismSimplification< GetEndomorphismOpOperandFn, GetEndomorphismOpResultFn, GetAlgebraicOpOperandsFn, GetAlgebraicOpResultFn, GetAlgebraicOpResultFn, IsEndomorphismOpFn, IsAlgebraicOpFn, detail::CreateAlgebraicOpForEndomorphismSimplification >, mlir::OpTraitRewritePattern< OpTrait::Elementwise >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::TransposeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< WhileOp >, mlir::detail::OpOrInterfaceRewritePatternBase< AllocaScopeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::ReductionOp >, mlir::detail::OpOrInterfaceRewritePatternBase< T >, mlir::detail::OpOrInterfaceRewritePatternBase< AddOpType >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::ContractionOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::ClampOp >, mlir::detail::OpOrInterfaceRewritePatternBase< CmpFOp >, mlir::detail::OpOrInterfaceRewritePatternBase< CollapseShapeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::ConcatOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::SliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::TransposeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ExtractStridedSliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< InsertStridedSliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::TransferReadOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::TransferWriteOp >, mlir::detail::OpOrInterfaceRewritePatternBase< scf::ForOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ExecuteRegionOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::AddOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::BroadcastOp >, mlir::detail::OpOrInterfaceRewritePatternBase< scf::IndexSwitchOp >, mlir::detail::OpOrInterfaceRewritePatternBase< xegpu::ConvertLayoutOp >, mlir::detail::OpOrInterfaceRewritePatternBase< LaunchOp >, mlir::detail::OpOrInterfaceRewritePatternBase< DestinationStyleOpInterface >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::TransposeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< FromElementsOp >, mlir::detail::OpOrInterfaceRewritePatternBase< spirv::IAddCarryOp >, mlir::detail::OpOrInterfaceRewritePatternBase< OpTy >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::MaxPool2dOp >, mlir::detail::OpOrInterfaceRewritePatternBase< arith::BitcastOp >, mlir::detail::OpOrInterfaceRewritePatternBase< BitcastOp >, mlir::detail::OpOrInterfaceRewritePatternBase< MulOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::OuterProductOp >, mlir::detail::OpOrInterfaceRewritePatternBase< IterateOp >, mlir::detail::OpOrInterfaceRewritePatternBase< arith::SelectOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tensor::ExtractSliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ToElementsOp >, mlir::detail::OpOrInterfaceRewritePatternBase< spirv::UModOp >, mlir::detail::OpOrInterfaceRewritePatternBase< spirv::UMulExtendedOp >, mlir::detail::OpOrInterfaceRewritePatternBase< emitc::FuncOp >, mlir::detail::OpOrInterfaceRewritePatternBase< CollapseOpTy >, mlir::detail::OpOrInterfaceRewritePatternBase< ExpandOpTy >, mlir::detail::OpOrInterfaceRewritePatternBase< OpType >, mlir::detail::OpOrInterfaceRewritePatternBase< GatherToLDSOp >, mlir::detail::OpOrInterfaceRewritePatternBase< WarpExecuteOnLane0Op >, mlir::detail::OpOrInterfaceRewritePatternBase< memref::CopyOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::PackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::UnPackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tensor::PadOp >, mlir::detail::OpOrInterfaceRewritePatternBase< Conv2DOp >, mlir::detail::OpOrInterfaceRewritePatternBase< DepthwiseConv2DNhwcHwcOp >, mlir::detail::OpOrInterfaceRewritePatternBase< PackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< UnPackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< LinalgOp >, mlir::detail::OpOrInterfaceRewritePatternBase< GenericOp >, mlir::detail::OpOrInterfaceRewritePatternBase< math::ErfOp >, mlir::detail::OpOrInterfaceRewritePatternBase< math::ErfcOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ForOp >, mlir::detail::OpOrInterfaceRewritePatternBase< Op >, SortCommutativeOperands, mlir::ExternalRewritePattern, mlir::HomomorphismSimplification< GetHomomorphismOpOperandFn, GetHomomorphismOpResultFn, GetSourceAlgebraicOpOperandsFn, GetSourceAlgebraicOpResultFn, GetTargetAlgebraicOpResultFn, IsHomomorphismOpFn, IsSourceAlgebraicOpFn, CreateTargetAlgebraicOpFn >, mlir::OpTraitRewritePattern< TraitType >, and mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >.
Public Member Functions | |
| virtual | ~RewritePattern ()=default |
| virtual LogicalResult | matchAndRewrite (Operation *op, PatternRewriter &rewriter) const =0 |
| Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind(). | |
| 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. | |
| std::optional< OperationName > | getRootKind () const |
| Return the root node that this pattern matches. | |
| std::optional< TypeID > | getRootInterfaceID () const |
| Return the interface ID used to match the root operation of this pattern. | |
| std::optional< TypeID > | getRootTraitID () const |
| Return the trait ID used to match the root operation of this pattern. | |
| PatternBenefit | getBenefit () const |
| Return the benefit (the inverse of "cost") of matching this pattern. | |
| bool | hasBoundedRewriteRecursion () const |
| Returns true if this pattern is known to result in recursive application, i.e. | |
| MLIRContext * | getContext () const |
| Return the MLIRContext used to create this pattern. | |
| StringRef | getDebugName () const |
| Return a readable name for this pattern. | |
| void | setDebugName (StringRef name) |
| Set the human readable debug name used for this pattern. | |
| ArrayRef< StringRef > | getDebugLabels () const |
| Return the set of debug labels attached to this pattern. | |
| void | addDebugLabels (ArrayRef< StringRef > labels) |
| Add the provided debug labels to this pattern. | |
| void | addDebugLabels (StringRef label) |
Static Public Member Functions | |
| 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. | |
Protected Member Functions | |
| Pattern (StringRef rootName, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
| Inherit the base constructors from Pattern. | |
| Pattern (MatchAnyOpTypeTag tag, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
| Inherit the base constructors from Pattern. | |
| Pattern (MatchInterfaceOpTypeTag tag, TypeID interfaceID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
| Inherit the base constructors from Pattern. | |
| Pattern (MatchTraitOpTypeTag tag, TypeID traitID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
| Inherit the base constructors from Pattern. | |
| 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. | |
| Pattern (MatchAnyOpTypeTag tag, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={}) | |
| Construct a pattern that may match any operation type. | |
| 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. | |
| 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. | |
| void | setHasBoundedRewriteRecursion (bool hasBoundedRecursionArg=true) |
| Set the flag detailing if this pattern has bounded rewrite recursion or not. | |
RewritePattern is the common base class for all DAG to DAG replacements.
Definition at line 238 of file PatternMatch.h.
|
virtualdefault |
|
inlinestatic |
This method provides a convenient interface for creating and initializing derived rewrite patterns of the given type T.
Definition at line 254 of file PatternMatch.h.
|
pure virtual |
Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind().
If successful, perform the rewrite.
Note: Implementations must modify the IR if and only if the function returns "success".
Implemented in DropUnitDimFromElementwiseOps, mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< AddOpType >, mlir::detail::OpOrInterfaceRewritePatternBase< AllocaScopeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< arith::BitcastOp >, mlir::detail::OpOrInterfaceRewritePatternBase< arith::SelectOp >, mlir::detail::OpOrInterfaceRewritePatternBase< BitcastOp >, mlir::detail::OpOrInterfaceRewritePatternBase< CmpFOp >, mlir::detail::OpOrInterfaceRewritePatternBase< CollapseOpTy >, mlir::detail::OpOrInterfaceRewritePatternBase< CollapseShapeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< Conv2DOp >, mlir::detail::OpOrInterfaceRewritePatternBase< DepthwiseConv2DNhwcHwcOp >, mlir::detail::OpOrInterfaceRewritePatternBase< DestinationStyleOpInterface >, mlir::detail::OpOrInterfaceRewritePatternBase< emitc::FuncOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ExecuteRegionOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ExpandOpTy >, mlir::detail::OpOrInterfaceRewritePatternBase< ExtractStridedSliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ForOp >, mlir::detail::OpOrInterfaceRewritePatternBase< FromElementsOp >, mlir::detail::OpOrInterfaceRewritePatternBase< GatherToLDSOp >, mlir::detail::OpOrInterfaceRewritePatternBase< GenericOp >, mlir::detail::OpOrInterfaceRewritePatternBase< InsertStridedSliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< IterateOp >, mlir::detail::OpOrInterfaceRewritePatternBase< LaunchOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::AddOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::BroadcastOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::PackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::TransposeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< linalg::UnPackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< LinalgOp >, mlir::detail::OpOrInterfaceRewritePatternBase< math::ErfcOp >, mlir::detail::OpOrInterfaceRewritePatternBase< math::ErfOp >, mlir::detail::OpOrInterfaceRewritePatternBase< memref::CopyOp >, mlir::detail::OpOrInterfaceRewritePatternBase< MulOp >, mlir::detail::OpOrInterfaceRewritePatternBase< Op >, mlir::detail::OpOrInterfaceRewritePatternBase< OpTy >, mlir::detail::OpOrInterfaceRewritePatternBase< OpType >, mlir::detail::OpOrInterfaceRewritePatternBase< PackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< scf::ForOp >, mlir::detail::OpOrInterfaceRewritePatternBase< scf::IndexSwitchOp >, mlir::detail::OpOrInterfaceRewritePatternBase< spirv::IAddCarryOp >, mlir::detail::OpOrInterfaceRewritePatternBase< spirv::UModOp >, mlir::detail::OpOrInterfaceRewritePatternBase< spirv::UMulExtendedOp >, mlir::detail::OpOrInterfaceRewritePatternBase< T >, mlir::detail::OpOrInterfaceRewritePatternBase< tensor::ExtractSliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tensor::PadOp >, mlir::detail::OpOrInterfaceRewritePatternBase< ToElementsOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::ClampOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::ConcatOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::MaxPool2dOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::SliceOp >, mlir::detail::OpOrInterfaceRewritePatternBase< tosa::TransposeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< UnPackOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::ContractionOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::OuterProductOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::ReductionOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::TransferReadOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::TransferWriteOp >, mlir::detail::OpOrInterfaceRewritePatternBase< vector::TransposeOp >, mlir::detail::OpOrInterfaceRewritePatternBase< WarpExecuteOnLane0Op >, mlir::detail::OpOrInterfaceRewritePatternBase< WhileOp >, mlir::detail::OpOrInterfaceRewritePatternBase< xegpu::ConvertLayoutOp >, mlir::ExternalRewritePattern, mlir::HomomorphismSimplification< GetHomomorphismOpOperandFn, GetHomomorphismOpResultFn, GetSourceAlgebraicOpOperandsFn, GetSourceAlgebraicOpResultFn, GetTargetAlgebraicOpResultFn, IsHomomorphismOpFn, IsSourceAlgebraicOpFn, CreateTargetAlgebraicOpFn >, mlir::HomomorphismSimplification< GetEndomorphismOpOperandFn, GetEndomorphismOpResultFn, GetAlgebraicOpOperandsFn, GetAlgebraicOpResultFn, GetAlgebraicOpResultFn, IsEndomorphismOpFn, IsAlgebraicOpFn, detail::CreateAlgebraicOpForEndomorphismSimplification >, and SortCommutativeOperands.
|
protected |
Inherit the base constructors from Pattern.
Definition at line 180 of file PatternMatch.cpp.
|
protected |
Inherit the base constructors from Pattern.
Definition at line 188 of file PatternMatch.cpp.
|
protected |
Inherit the base constructors from Pattern.
Definition at line 197 of file PatternMatch.cpp.
References b, mlir::RewriterBase::eraseBlock(), and mlir::ReverseIterator::makeIterable().
|
protected |
Inherit the base constructors from Pattern.
Definition at line 173 of file PatternMatch.cpp.
Referenced by mlir::OpTraitRewritePattern< TraitType >::OpTraitRewritePattern().