[Mlir-commits] [mlir] [mlir][python] Add normalforms to capture preconditions of transforms (PR #79449)

Maksim Levental llvmlistbot at llvm.org
Thu Jan 25 11:48:10 PST 2024


================
@@ -192,6 +234,45 @@ def constant_param(value: Union[ir.Attribute, int]) -> ParamHandle:
     return op.param
 
 
+class Normalform:
+    """
+    Represents the weakest normalform and is the base class for all normalforms.
+    A normalform is defined as a sequence of transforms to be applied to a
+    handle to reach this normalform.
+
+    `propagate_up`: Propagate this normalform up to parent handles.
+    `propagate_down`: Propagate this normalform down to all child handles
+    """
+
+    propagate_up: bool = True
+    propagate_down: bool = True
+
+    def __init__(self):
+        raise TypeError(
+            "Normalform cannot be instantiated directly. Use Type[Normalform]"
+            "instead."
+        )
+
+    @classmethod
+    def _impl(cls, handle: "HandleT") -> "HandleT":
----------------
makslevental wrote:

`HandleT`

https://github.com/llvm/llvm-project/pull/79449


More information about the Mlir-commits mailing list