mlir._mlir_libs._mlir.rewrite ============================= .. py:module:: mlir._mlir_libs._mlir.rewrite Classes ------- .. autoapisummary:: mlir._mlir_libs._mlir.rewrite.PatternRewriter mlir._mlir_libs._mlir.rewrite.RewritePatternSet mlir._mlir_libs._mlir.rewrite.PDLResultList mlir._mlir_libs._mlir.rewrite.PDLModule mlir._mlir_libs._mlir.rewrite.FrozenRewritePatternSet Functions --------- .. autoapisummary:: mlir._mlir_libs._mlir.rewrite.apply_patterns_and_fold_greedily Module Contents --------------- .. py:class:: PatternRewriter .. py:property:: ip :type: _mlir.ir.InsertionPoint The current insertion point of the PatternRewriter. .. py:method:: replace_op(op: mlir.ir.Operation, new_op: mlir.ir.Operation) -> None replace_op(op: mlir.ir.Operation, values: list[mlir.ir.Value]) -> None Replace an operation with a list of values. .. py:method:: erase_op(op: mlir.ir.Operation) -> None Erase an operation. .. py:class:: RewritePatternSet(context: Context | None = None) .. py:method:: add(root: object, fn: collections.abc.Callable, benefit: int = 1) -> None Add a new rewrite pattern on the given root operation with the callable as the matching and rewriting function and the given benefit. .. py:method:: freeze() -> FrozenRewritePatternSet Freeze the pattern set into a frozen one. .. py:class:: PDLResultList .. py:method:: append(value: mlir.ir.Value) append(op: mlir.ir.Operation) append(type: mlir.ir.Type) append(attr: mlir.ir.Attribute) .. py:class:: PDLModule(module: mlir.ir.Module) PDLModule(module: mlir.ir.Module) .. py:method:: freeze() -> FrozenRewritePatternSet .. py:method:: register_rewrite_function(arg0: str, arg1: collections.abc.Callable, /) -> None .. py:method:: register_constraint_function(arg0: str, arg1: collections.abc.Callable, /) -> None .. py:class:: FrozenRewritePatternSet .. py:property:: _CAPIPtr :type: object .. py:method:: _CAPICreate() -> object .. py:function:: apply_patterns_and_fold_greedily(module: mlir.ir.Module, set: FrozenRewritePatternSet) -> None apply_patterns_and_fold_greedily(module: mlir.ir.Module, set: FrozenRewritePatternSet) -> None apply_patterns_and_fold_greedily(op: mlir.ir._OperationBase, set: FrozenRewritePatternSet) -> None apply_patterns_and_fold_greedily(op: mlir.ir._OperationBase, set: FrozenRewritePatternSet) -> None Applys the given patterns to the given op greedily while folding results.