|
MLIR 22.0.0git
|
This is used to report the reduction patterns for a Dialect. More...
#include "mlir/Reducer/ReductionPatternInterface.h"
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 () |
| Dialect * | getDialect () const |
| Return the dialect that this interface represents. | |
| MLIRContext * | getContext () 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. | |
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.
|
inlineprotected |
Definition at line 60 of file ReductionPatternInterface.h.
|
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().
|
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.