[Mlir-commits] [mlir] [MLIR] [Python] Added a way to extend MLIR->Python type mappings (PR #189368)
Maksim Levental
llvmlistbot at llvm.org
Mon Mar 30 09:52:14 PDT 2026
================
@@ -15,6 +16,15 @@ def Test_Dialect : Dialect {
class TestOp<string mnemonic, list<Trait> traits = []> :
Op<Test_Dialect, mnemonic, traits>;
+def TestCustomAttr
+ : DialectAttr<Test_Dialect,
+ CPred<"::llvm::isa<::test::CustomAttr>($_self)">,
+ "custom attribute"> {
+ let storageType = "::test::CustomAttr";
+}
+
+def : PythonAttrType<"TestCustomAttr", "object">;
----------------
makslevental wrote:
nit: make this something a little less generic than `object` just so it's easy to spot in the lines below. these defs aren't actually used to emit any code anywhere so you can make it anything even if that thing doesn't exist.
https://github.com/llvm/llvm-project/pull/189368
More information about the Mlir-commits
mailing list