[mlir][spirv] Consider target when converting one-element vector
authorLei Zhang <antiagainst@google.com>
Wed, 19 Oct 2022 05:49:08 +0000 (05:49 +0000)
committerLei Zhang <antiagainst@google.com>
Wed, 19 Oct 2022 05:49:32 +0000 (05:49 +0000)
commitfce33e1140bbf5ddf2afa5c3be89433ed2a70e4d
treeecd3aadb10752486693a6f273a5b9ffa6d4eb94d
parent3ee58e2f355f8fdb8e0fe29dc366c8833fafa7d3
[mlir][spirv] Consider target when converting one-element vector

Vectors with just one element will be converted into scalars.
However, we cannot just return the element types and assume it
is supported in the target environment; we need to conver the
element type again factoring in those considerations.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D136226
mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
mlir/test/Conversion/FuncToSPIRV/types-to-spirv.mlir