[all-commits] [llvm/llvm-project] 267483: [mlir][spirv] Support implied extensions and capab...

Lei Zhang via All-commits all-commits at lists.llvm.org
Fri Jan 17 05:11:12 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 267483ac709b85906e223c3cac447538a115b4c4
      https://github.com/llvm/llvm-project/commit/267483ac709b85906e223c3cac447538a115b4c4
  Author: Lei Zhang <antiagainst at google.com>
  Date:   2020-01-17 (Fri, 17 Jan 2020)

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

  Log Message:
  -----------
  [mlir][spirv] Support implied extensions and capabilities

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.

Differential Revision: https://reviews.llvm.org/D72765




More information about the All-commits mailing list