[Mlir-commits] [mlir] [mlir][python] remove eager loading of dialect module (for type and value casting) (PR #72338)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Nov 15 20:08:43 PST 2023


rkayaith wrote:

> I don't remember who it was that asked for that kind of safety but IMHO if you want type casting to your own dialect's types, it's not unreasonable to ask you to first register those type casters - whether that be by importing a python module that performs the registration using the decorator syntax, or importing the C extension module that implements `mlir_type_subclass`. I don't think an explicit import if you want to avail yourself of type casting to a type in your dialect is an excessive complexity/boilerplate burden.

Doesn't this apply to `OpView`s as well? If we're removing the auto-import stuff for type/attribute downcasting, why not go all the way and remove it everywhere? I still don't think having to explicitly do side-effecting imports is great UX for end users who don't really care how all the downcasting works behind the scenes (I'm not sure how they'd even know that the import is the thing they have to do to enable downcasting), but I won't die on that hill; I _do_ think the behaviour should at least be consistent between all these downcasting features.



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


More information about the Mlir-commits mailing list