MLIR  19.0.0git
Public Member Functions | Protected Member Functions | List of all members
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. More...
 

Protected Member Functions

 DialectReductionPatternInterface (Dialect *dialect)
 
- Protected Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
 DialectInterfaceBase (Dialect *dialect)
 

Additional Inherited Members

- Public Types inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
using Base = DialectInterfaceBase< ConcreteType, BaseT >
 
- Static Public Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
static TypeID getInterfaceID ()
 Get a unique id for the derived interface type. More...
 

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 40 of file ReductionPatternInterface.h.

Constructor & Destructor Documentation

◆ DialectReductionPatternInterface()

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

Definition at line 51 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.


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