[Mlir-commits] [mlir] [mlir][vector] add result type to vector.extract assembly format (PR #66499)

Cullen Rhodes llvmlistbot at llvm.org
Fri Sep 15 05:54:07 PDT 2023


c-rhodes wrote:

> Hmm ..
> 
> ```
> %1 = vector.extract %0[1] : vector<3x7x8xf32>
> 
> it's not immediately obvious if this is the source or result type.
> ```
> 
> it should be quite natural to see this can only be the source type, otherwise information is missing there is no way to determine the source type.

That didn't register for me when I first saw it but it's a fair point. It is still necessary to look at the number of indices however and I think this helps there. It also feels more in keeping with `vector.insert` which has `: $source_type into $dest_type`, but perhaps that's also consistent with LLVM as you mention, and I didn't give that any consideration.

>
> I am sympathetic to improving the syntax and making things more obvious / not require to infer the above. In this case, the syntax is meant to follow LLVM's (https://llvm.org/docs/LangRef.html#extractvalue-instruction).
> 
> I'd be wary of departing from being less consistent with LLVM where it makes sense, OTOH I can also see that this is a purely MLIR concern as it only appears with (N>1)-D vectors which do not exist in LLVM.
> 
> I'm a very soft +1 on this change but would like to also hear others opinions before moving ahead.

No worries, appreciate the speedy review.

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


More information about the Mlir-commits mailing list