MLIR 22.0.0git
mlir::DialectReductionPatternInterface Class Referenceabstract

This is used to report the reduction patterns for a Dialect. More...

#include "mlir/Reducer/ReductionPatternInterface.h"

Inheritance diagram for mlir::DialectReductionPatternInterface:

Public Member Functions

virtual void populateReductionPatterns (RewritePatternSet &patterns) const =0
 Patterns provided here are intended to transform operations from a complex form to a simpler form, without breaking the semantics of the program being reduced.
virtual void populateReductionPatternsWithTester (RewritePatternSet &patterns, Tester &tester) const
 This method extends populateReductionPatterns by allowing reduction patterns to use a Tester instance.
Public Member Functions inherited from mlir::DialectInterface
virtual ~DialectInterface ()
DialectgetDialect () const
 Return the dialect that this interface represents.
MLIRContextgetContext () const
 Return the context that holds the parent dialect of this interface.
TypeID getID () const
 Return the derived interface id.

Protected Member Functions

 DialectReductionPatternInterface (Dialect *dialect)
Protected Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
 DialectInterfaceBase (Dialect *dialect)
Protected Member Functions inherited from mlir::DialectInterface
 DialectInterface (Dialect *dialect, TypeID id)

Additional Inherited Members

Public Types inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
using Base
Public Types inherited from mlir::DialectInterface
template<typename ConcreteType>
using Base = detail::DialectInterfaceBase<ConcreteType, DialectInterface>
 The base class used for all derived interface types.
Static Public Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
static TypeID getInterfaceID ()
 Get a unique id for the derived interface type.

Detailed Description

This is used to report the reduction patterns for a Dialect.

While using mlir-reduce to reduce a module, we may want to transform certain cases into simpler forms by applying certain rewrite patterns. Implement the populateReductionPatterns to report those patterns by adding them to the RewritePatternSet.

Example: MyDialectReductionPattern::populateReductionPatterns( RewritePatternSet &patterns) { patterns.add<TensorOpReduction>(patterns.getContext()); }

For DRR, mlir-tblgen will generate a helper function populateWithGenerated which has the same signature therefore you can delegate to the helper function as well.

Example: MyDialectReductionPattern::populateReductionPatterns( RewritePatternSet &patterns) { // Include the autogen file somewhere above. populateWithGenerated(patterns); }

Definition at line 41 of file ReductionPatternInterface.h.

Constructor & Destructor Documentation

◆ DialectReductionPatternInterface()

mlir::DialectReductionPatternInterface::DialectReductionPatternInterface ( Dialect * dialect)
inlineprotected

Definition at line 60 of file ReductionPatternInterface.h.

Member Function Documentation

◆ populateReductionPatterns()

virtual void mlir::DialectReductionPatternInterface::populateReductionPatterns ( RewritePatternSet & patterns) const
pure virtual

Patterns provided here are intended to transform operations from a complex form to a simpler form, without breaking the semantics of the program being reduced.

For example, you may want to replace the tensor<?xindex> with a known rank and type, e.g. tensor<1xi32>, or replacing an operation with a constant.

References mlir::patterns.

Referenced by mlir::impl::ReductionTreePassBase< DerivedT >::getDependentDialects().

◆ populateReductionPatternsWithTester()

virtual void mlir::DialectReductionPatternInterface::populateReductionPatternsWithTester ( RewritePatternSet & patterns,
Tester & tester ) const
inlinevirtual

This method extends populateReductionPatterns by allowing reduction patterns to use a Tester instance.

Some reduction patterns may need to run tester to determine whether certain transformations preserve the "interesting" behavior of the program. This is mostly useful when pattern should choose between multiple modifications.

Definition at line 56 of file ReductionPatternInterface.h.

References mlir::patterns.


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