[Mlir-commits] [mlir] [mlir][vector] Add vector.transpose with unit-dim to vector.shape_cast pattern (PR #72105)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Nov 20 13:50:31 PST 2023


MaheshRavishankar wrote:

> > This PR broke downstream on conversion to SPIR-V. Also looking at this again, I am not sure lowering this to a `vector.shape_cast` is a good idea (sorry I didnt review it as I saw it go by). AFAIK, `shape_casts` are meant to be only for n-D to 1D/ 1D to N-D conversion. So lowering the transpose to a shape-cast here seems to violate that and is causing issues when lowering to SPIR-V specifically. This might need more discussion, but in the meantime can I suggest we revert this (and the follow up that moved it into a canonicalization, which is a bit more problematic in my view cause that is done without any user control).
> 
> Sorry to hear it's causing issues. Just looking at the docs for `vector.shape_cast` and although it only mentions rank-reducing / rank-expanding, there's no mention that shape casting between same rank vectors is not allowed?
> 
> Please could you provide any more info? There's nothing here that explains what the problem with the lowering is.

In general `shape_casts` cannot be handled on SPIR-V backends (you cannot lower it to SPIR-V). We've discussed previously making it explicitly illegal to introduce shape_casts that arent strictly linearizing or all delinearizing. At any rate it would be appreciated if we could move it out of `VectorLowering` by default and make this opt-in. I am sorry for the inconvenience, but this is not a "downstream" issue. It is really something that cannot be handled in SPIR-V and as such should not be on the default path.

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


More information about the Mlir-commits mailing list