[mlir][spirv] Support querying type extension/capability requirements
authorLei Zhang <antiagainst@google.com>
Wed, 11 Mar 2020 20:06:07 +0000 (16:06 -0400)
committerLei Zhang <antiagainst@google.com>
Thu, 12 Mar 2020 23:37:45 +0000 (19:37 -0400)
commite5c85a5a4ffaa0ff55f6d1d80a4e47f96ec0b9de
tree20c05d2e3e4f9822af3242d98a06c5c05cee7175
parent2ae5e472e6427795ce0efc727f3dc616c912856b
[mlir][spirv] Support querying type extension/capability requirements

Previously we only consider the version/capability/extension requirements
on ops themselves. Some types in SPIR-V also require special extensions
or capabilities to be used. For example, non-32-bit integers/floats
will require different capabilities and/or extensions depending on
where they are used because it may mean special hardware abilities.

This commit adds query methods to SPIR-V type class hierarchy to support
querying extensions and capabilities. We don't go through ODS for
auto-generating such information given that we don't have them in
SPIR-V machine readable grammar and there are just a few types.

Differential Revision: https://reviews.llvm.org/D75875
mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h
mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp
mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
mlir/test/Dialect/SPIRV/Transforms/vce-deduction.mlir