diff options
| author | Lei Zhang <antiagainst@google.com> | 2019-12-27 16:24:33 -0500 |
|---|---|---|
| committer | Lei Zhang <antiagainst@google.com> | 2019-12-27 16:25:09 -0500 |
| commit | b30d87a90ba983d76f8a6cd334ac38244bbf9ded (patch) | |
| tree | 1de94d9458e552ff6c90dadb621f66521659ca1d /mlir/lib/Dialect | |
| parent | c3dbd782f1e0578c7ebc342f2e92f54d9644cff7 (diff) | |
| download | bcm5719-llvm-b30d87a90ba983d76f8a6cd334ac38244bbf9ded.tar.gz bcm5719-llvm-b30d87a90ba983d76f8a6cd334ac38244bbf9ded.zip | |
[mlir][spirv] Add basic definitions for supporting availability
SPIR-V has a few mechanisms to control op availability: version,
extension, and capabilities. These mechanisms are considered as
different availability classes.
This commit introduces basic definitions for modelling SPIR-V
availability classes. Specifically, an `Availability` class is
added to SPIRVBase.td, along with two subclasses: MinVersion
and MaxVersion for versioning. SPV_Op is extended to take a
list of `Availability`. Each `Availability` instance carries
information for generating op interfaces for the corresponding
availability class and also the concrete availability
requirements.
With the availability spec on ops, we can now auto-generate the
op interfaces of all SPIR-V availability classes and also
synthesize the op's implementations of these interfaces. The
interface generation is done via new TableGen backends
-gen-avail-interface-{decls|defs}. The op's implementation is
done via -gen-spirv-avail-impls.
Differential Revision: https://reviews.llvm.org/D71930
Diffstat (limited to 'mlir/lib/Dialect')
| -rw-r--r-- | mlir/lib/Dialect/SPIRV/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | mlir/lib/Dialect/SPIRV/SPIRVOps.cpp | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/mlir/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/CMakeLists.txt index 2c3b1b95a68..d3af53e3aaa 100644 --- a/mlir/lib/Dialect/SPIRV/CMakeLists.txt +++ b/mlir/lib/Dialect/SPIRV/CMakeLists.txt @@ -15,6 +15,7 @@ add_llvm_library(MLIRSPIRV ) add_dependencies(MLIRSPIRV + MLIRSPIRVAvailabilityIncGen MLIRSPIRVCanonicalizationIncGen MLIRSPIRVEnumsIncGen MLIRSPIRVLoweringStructGen diff --git a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp index f42c077f77e..1de7bceaf23 100644 --- a/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVOps.cpp @@ -3063,8 +3063,16 @@ static LogicalResult verify(spirv::VariableOp varOp) { namespace mlir { namespace spirv { +// TableGen'erated operation interfaces for querying versions, extensions, and +// capabilities. +#include "mlir/Dialect/SPIRV/SPIRVAvailability.cpp.inc" + +// TablenGen'erated operation definitions. #define GET_OP_CLASSES #include "mlir/Dialect/SPIRV/SPIRVOps.cpp.inc" +// TableGen'erated operation availability interface implementations. +#include "mlir/Dialect/SPIRV/SPIRVOpAvailabilityImpl.inc" + } // namespace spirv } // namespace mlir |

