Issue 74245
Summary [mlir:python] Add a mechanism to register upstream dialects from Python
Labels mlir
Assignees
Reporter hawkinsp
    Currently there seem to be two ways to register the upstream dialects in a build of MLIR Python:
a) use `mlirRegisterEverything`, which works, but links in many dialects and transforms that might not be necessary.
b) define a `_site_initialize` module, which works, but requires that you write a custom pybind11 module.

Wouldn't it be nice if one could do neither (a) nor (b), and instead just explicitly register dialects like `arith` with a `ir.Context` from Python, without having write a C++ Python extension to do so?

I'm imagining adding an API along the lines of:

```
arith.register_dialect(context)
```

to the generated code for a dialect, but I don't much mind exactly what the API is, so long as it exists. That appears to be the pattern often used by out-of-tree dialects.

@stellaraccident 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to