[PATCH] D72765: [mlir][spirv] Support implied extensions and capabilities

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 06:20:50 PST 2020


antiagainst created this revision.
antiagainst added reviewers: benvanik, denis13.
Herald added subscribers: llvm-commits, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, shauheen, burmako, jpienaar, rriddle, mehdi_amini, jfb, mgorny.
Herald added a reviewer: mravishankar.
Herald added a project: LLVM.
antiagainst added a parent revision: D72764: [mlir][spirv] Fix SPV_MM_Vulkan extension reqirements.

In SPIR-V, when a new version is introduced, it is possible some
existing extensions will be incorporated into it so that it becomes
implicitly declared if targeting the new version. This affects
conversion target specification because we need to take this into
account when allowing what extensions to use.

For a capability, it may also implies some other capabilities,
for example, the `Shader` capability implies `Matrix` the capability.
This should also be taken into consideration when preparing the
conversion target: when we specify an capability is allowed, all
its recursively implied capabilities are also allowed.

This commit adds utility functions to query implied extensions for
a given version and implied capabilities for a given capability
and updated SPIRVConversionTarget to use them.

This commit also fixes a bug in availability spec. When a symbol
(op or enum case) can be enabled by an extension, we should drop
it's minimal version requirement. Being enabled by an extension
naturally means the symbol can be used by *any* SPIR-V version
as long as the extension is supported. The grammar still encodes
the 'version' field for such cases, but it should be interpreted
as a different way: rather than meaning a minimal version
requirement, it says the symbol becomes core at that specific
version.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72765

Files:
  mlir/include/mlir/Dialect/SPIRV/CMakeLists.txt
  mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
  mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h
  mlir/include/mlir/TableGen/Attribute.h
  mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
  mlir/lib/Dialect/SPIRV/SPIRVTypes.cpp
  mlir/lib/TableGen/Attribute.cpp
  mlir/test/Dialect/SPIRV/TestAvailability.cpp
  mlir/test/Dialect/SPIRV/availability.mlir
  mlir/test/Dialect/SPIRV/target-env.mlir
  mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
  mlir/utils/spirv/gen_spirv_dialect.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72765.238233.patch
Type: text/x-patch
Size: 29696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200115/9c014929/attachment-0001.bin>


More information about the llvm-commits mailing list