[all-commits] [llvm/llvm-project] 3b2c1d: [MLIR][Python] Support type definitions in Python-...

Twice via All-commits all-commits at lists.llvm.org
Mon Feb 23 18:35:19 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b2c1db8709766e8c2252e9fb19fcff493869c16
      https://github.com/llvm/llvm-project/commit/3b2c1db8709766e8c2252e9fb19fcff493869c16
  Author: Twice <twice at apache.org>
  Date:   2026-02-24 (Tue, 24 Feb 2026)

  Changed paths:
    M mlir/python/mlir/dialects/ext.py
    M mlir/test/python/dialects/ext.py

  Log Message:
  -----------
  [MLIR][Python] Support type definitions in Python-defined dialects (#182805)

In this PR, we added basic support of type definitions in Python-defined
dialects, including:
- IRDL codegen for type definitions
- Type builders like `MyType.get(..)` and type parameter accessors (e.g.
`my_type.param1`)
- Use Python-defined types in Python-defined oeprations

```python
class TestType(Dialect, name="ext_type"):
    pass

class Array(TestType.Type, name="array"):
    elem_type: IntegerType[32] | IntegerType[64]
    length: IntegerAttr

class MakeArrayOp(TestType.Operation, name="make_array"):
    arr: Result[Array]

class MakeArray3Op(TestType.Operation, name="make_array3"):
    arr: Result[Array[IntegerType[32], IntegerAttr[IntegerType[32], 3]]]
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list