[Mlir-commits] [mlir] [mlir][python] allow upstream dialect registration (PR #74252)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Dec 4 03:39:21 PST 2023


https://github.com/ftynse commented:

I'm not sure about the intent here, seems to be the usual confusion with dialect [registration and loading](https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management). Does this intend to _register_ the dialects, i.e. make them available to the parser? Does this rather intend to _load_ the dialects into the context, i.e. allow one to construct objects from these dialects? For the latter, I'd look at what downstreams already do with various `load_<downstream>_dialects(context)` functions and reuse that, modulo some homogenization, for upstream dialects.

As a vague design suggestion, I would find it convenient to have `from mlir.dialects import foo` to have `foo` loaded in whatever context I create afterwards and `from mlir.dialects.foo import parser` to have `foo` registered (but not loaded) in whatever context I create afterwards + have a mechanism to override this behavior should we need a clean context for some reason. But maybe it's too magic for other folks.

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


More information about the Mlir-commits mailing list