[Mlir-commits] [mlir] [mlir][python] value casting (PR #69644)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Wed Oct 25 01:43:09 PDT 2023


https://github.com/ftynse requested changes to this pull request.

Looks interesting. 

The change request: all this should also work on `BlockArgument`, which is a another class of values that we can see in addition to `OpResult`. Also please add tests covering `_maybe_cast` for non-trivial cases where there is more than one op result or block argument, and an for an op with no results if that makes sense.

And a question: have you considered a finer-grain type identification with, e.g., user-provided `isa` functions? It could be a second stage check after typeid so we don't go over a list of callbacks every time we return a value, or may be embedded into the child class of the Value somehow... The use case I have in mind is defining `__add__` for values of vector type where I'd want `arith.addi` for vectors of integers and `arith.addf` for vectors of floats, but both have the same typeid on the outside.

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


More information about the Mlir-commits mailing list