[Mlir-commits] [mlir] [mlir][python] allow upstream dialect registration (PR #74252)
Nicolas Vasilache
llvmlistbot at llvm.org
Wed Dec 20 04:37:39 PST 2023
nicolasvasilache wrote:
I've been studying this a bit and digging deeper I find the current situation unfortunate and inconsistent.
Atm it seems we have a :
1. there is a `@_ods_cext.register_dialect` that seems to be a registration decorator, it seems related to https://github.com/llvm/llvm-project/blob/main/mlir/lib/Bindings/Python/MainModule.cpp#L59 (?) but I am not sure what to do with it
1. the current register the world and/or link the world does not seem appealing.
1. context.get_dialect_descriptor is wrapping `getOrLoadDialect` (why the name change btw?) and requires pre-registration.
1. context.allow_unregistered_dialects, I am sure many people are using this blanket solution ..
I also see that only a tiny subset of dialects have a dedicated module (in mlir/lib/Bindings/Python/DialectXXX.cpp) making things inconsistent.
Could we just add a module per dialect with a single `register_dialect(bool load = false)` function ?
This would also provide a location for grounding all future dialect module things and all per-dialect pybind things.
I imagine this could be tablegen'd but a low-tech solution can already improve things significantly.
https://github.com/llvm/llvm-project/pull/74252
More information about the Mlir-commits
mailing list