Add support for (de)serialization of SPIR-V Op Decorations
authorMahesh Ravishankar <ravishankarm@google.com>
Tue, 30 Jul 2019 21:14:28 +0000 (14:14 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 30 Jul 2019 21:15:03 +0000 (14:15 -0700)
commit1de519a753bd5d8dea3fab95cebbbf2ea60fb34f
tree104c681c327b611bb473e34bec18a618e08825e7
parent3b207d3691a61184d7159604effbf5d70dd62efd
Add support for (de)serialization of SPIR-V Op Decorations

All non-argument attributes specified for an operation are treated as
decorations on the result value and (de)serialized using OpDecorate
instruction. An error is generated if an attribute is not an argument,
and the name doesn't correspond to a Decoration enum. Name of the
attributes that represent decoerations are to be the snake-case-ified
version of the Decoration name.
Add utility methods to convert to snake-case and camel-case.

PiperOrigin-RevId: 260792638
mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
mlir/include/mlir/Support/StringExtras.h [new file with mode: 0644]
mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp
mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
mlir/test/Dialect/SPIRV/Serialization/variables.mlir
mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
mlir/unittests/IR/CMakeLists.txt
mlir/unittests/IR/StringExtrasTest.cpp [new file with mode: 0644]
mlir/utils/spirv/gen_spirv_dialect.py