[Mlir-commits] [mlir] [MLIR][Python] Impl XOpInterface(s) from Python, with X=Transform and X=MemoryEffects (PR #176920)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jan 27 23:04:42 PST 2026


================
@@ -451,21 +459,20 @@ def _emit_module(cls) -> ir.Module:
         return m
 
     @classmethod
-    def load(cls) -> None:
-        if hasattr(cls, "_mlir_module"):
-            raise RuntimeError(f"Dialect {cls.name} is already loaded.")
-
-        mlir_module = cls._emit_module()
+    def load(cls, register=True, reload=False) -> None:
+        if hasattr(cls, "_mlir_module") and not reload:
+            return
 
+        cls._mlir_module = cls._emit_module()
         pm = PassManager()
         pm.add("canonicalize, cse")
-        pm.run(mlir_module.operation)
-
-        irdl.load_dialects(mlir_module)
+        pm.run(cls._mlir_module.operation)
 
-        _cext.register_dialect(cls)
+        irdl.load_dialects(cls._mlir_module)
 
-        for op in cls.operations:
-            _cext.register_operation(cls)(op)
+        if register:
----------------
PragmaTwice wrote:

I'm actually thinking about making register=False by default. WDYT?

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


More information about the Mlir-commits mailing list