[mlir][spirv] Add a pass to deduce version/extension/capability
authorLei Zhang <antiagainst@google.com>
Wed, 11 Mar 2020 20:03:20 +0000 (16:03 -0400)
committerLei Zhang <antiagainst@google.com>
Thu, 12 Mar 2020 23:37:45 +0000 (19:37 -0400)
commit9414db10906a845e8e485a22102440833d131e48
tree4ec5a6429128208db7490972b9b27110a4e2a421
parent66c378d66e93b67c71aaf99974577f2bd72f336e
[mlir][spirv] Add a pass to deduce version/extension/capability

Creates an operation pass that deduces and attaches the minimal version/
capabilities/extensions requirements for spv.module ops.

For each spv.module op, this pass requires a `spv.target_env` attribute on
it or an enclosing module-like op to drive the deduction. The reason is
that an op can be enabled by multiple extensions/capabilities. So we need
to know which one to pick. `spv.target_env` gives the hard limit as for
what the target environment can support; this pass deduces what are
actually needed for a specific spv.module op.

Differential Revision: https://reviews.llvm.org/D75870
mlir/include/mlir/Dialect/SPIRV/Passes.h
mlir/include/mlir/Dialect/SPIRV/TargetAndABI.h
mlir/include/mlir/InitAllPasses.h
mlir/lib/Dialect/SPIRV/TargetAndABI.cpp
mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp [new file with mode: 0644]
mlir/test/Dialect/SPIRV/Transforms/vce-deduction.mlir [new file with mode: 0644]