summaryrefslogtreecommitdiffstats
path: root/mlir/utils/spirv
Commit message (Collapse)AuthorAgeFilesLines
* [mlir][spirv] Update SPIR-V enums and ops with availability specLei Zhang2020-01-021-21/+149
| | | | | | | | | | This commit updates gen_spirv_dialect.py to query the grammar and generate availability spec for various enum attribute definitions and all defined ops. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D72095
* Update SPIR-V.mdLei Zhang2019-12-231-14/+12
| | | | | | | | | This CL updates SPIR-V.md to reflect recent developments in the SPIR-V dialect and its conversions. Along the way, also updates the doc for define_inst.sh. PiperOrigin-RevId: 286933546
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-234-52/+12
| | | | PiperOrigin-RevId: 286906740
* Add atomic operations to SPIR-V dialect.Mahesh Ravishankar2019-12-162-5/+6
| | | | | | | Some changes to the dialect generation script to allow specification of different base class to derive from in ODS. PiperOrigin-RevId: 285859230
* Drop Markdown style annotationsAlex Zinenko2019-12-101-1/+1
| | | | | | | These come from a non-standard extenion that is not available on Github, so it only clutters the documentation source with {.mlir} or {.ebnf} tags. PiperOrigin-RevId: 284733003
* [spirv] Add spv.SubgroupBallotKHROpLei Zhang2019-12-031-1/+5
| | | | PiperOrigin-RevId: 283522284
* [spirv] NFC: reorder sections in SPIRVBase.tdLei Zhang2019-12-021-1/+4
| | | | | | | Put extensions and capabilities at the very beginning because they will be referenced later by other definitions. PiperOrigin-RevId: 283416972
* De-duplicate EnumAttr overrides by defining defaultsLei Zhang2019-11-251-6/+0
| | | | | | | EnumAttr should provide meaningful defaults so concrete instances do not need to duplicate the fields. PiperOrigin-RevId: 282398431
* Fix gen_spirv_dialect.py regarding 1D/2D/3D Dim symbol nameLei Zhang2019-11-181-2/+12
| | | | PiperOrigin-RevId: 281131561
* [spirv] Add cast operationsDenis Khalikov2019-10-301-2/+2
| | | | | | | | | | | | | | | | | | | This CL added op definitions for a few cast operations: * OpConvertFToU * OpConvertFToS * OpConvertSToF * OpConvertUToF * OpUConvert * OpSConvert * OpFConvert Also moved the definition of spv.Bitcast to the new file. Closes tensorflow/mlir#208 and tensorflow/mlir#174 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/208 from denis0x0D:sandbox/cast_ops 79bc9b37398aafddee6cf6beb301807988fe67f9 PiperOrigin-RevId: 277587891
* [spirv] Fix gen_spirv_dialect.py and add spv.UnreachableLei Zhang2019-10-301-6/+48
| | | | | | | | | This CL fixed gen_spirv_dialect.py to support nested delimiters when chunking existing ODS entries in .td files and to allow ops without correspondence in the spec. This is needed to pull in the definition of OpUnreachable. PiperOrigin-RevId: 277486465
* Fix minor spelling tweaks (NFC)Kazuaki Ishizaki2019-10-201-2/+2
| | | | | | Closes tensorflow/mlir#175 PiperOrigin-RevId: 275726876
* Update the usage and comments in define_inst.sh.MLIR Team2019-10-091-3/+6
| | | | PiperOrigin-RevId: 273723108
* Add spv.Undef op to support OpUndef instruction in SPIR-V.Mahesh Ravishankar2019-10-041-3/+3
| | | | | | | | Adding support for OpUndef instruction. Updating the dialect generation script to fix a few bugs in the instruction spec generation. PiperOrigin-RevId: 272975685
* [spirv] Change enum case uniquing in gen_spirv_dialect.pyLei Zhang2019-10-011-16/+27
| | | | | | | | | | | | | | | In SPIR-V we can have multiple symbols corresponding to the same enum value. This is because when an extension is introduced into the core spec, its suffix is typically removed, e.g., 'VulkanKHR' memory model becomes 'Vulkan' memory model in SPIR-V 1.5. Previously we just keep the first symbol for an enum value. That symbol is not necessarily a better one. This CL changes to sort symbols, grouped by enum values, alphabetically and then keep the first one, which is typically shorter and without the extension suffix. We also fix up certain ones like HlslSemanticGOOGLE. PiperOrigin-RevId: 272290363
* Add support for Logical Ops in SPIR-V dialectMahesh Ravishankar2019-09-302-22/+49
| | | | | | | | | | | | | | | | | | Add operations corresponding to OpLogicalAnd, OpLogicalNot, OpLogicalEqual, OpLogicalNotEqual and OpLogicalOr instructions in SPIR-V dialect. This needs changes to class hierarchy in SPIR-V TableGen files to split SPIRVLogicalOp into SPIRVLogicalUnaryOp and SPIRVLogicalBinaryOp. All derived classes of SPIRVLogicalOp are updated accordingly. Update the spirv dialect generation script to 1) Allow specifying base class to use for instruction spec generation and file name to generate the specification in separately. 2) Use the existing descriptions for operations. 3) Update define_inst.sh to also invoke define_opcode.sh to also define the corresponding SPIR-V instruction opcode enum. PiperOrigin-RevId: 272014876
* [spirv] Add SPV_UnaryOp and spv.FNegateLei Zhang2019-09-251-3/+3
| | | | | | | This CL also moves common parsers and printers to the same section in SPIRVOps.cpp. PiperOrigin-RevId: 271233546
* [spirv] Add support for BitEnumAttrLei Zhang2019-09-161-5/+9
| | | | | | | | | | | | | | | | | | | | Certain enum classes in SPIR-V, like function/loop control and memory access, are bitmasks. This CL introduces a BitEnumAttr to properly model this and drive auto-generation of verification code and utility functions. We still store the attribute using an 32-bit IntegerAttr for minimal memory footprint and easy (de)serialization. But utility conversion functions are adjusted to inspect each bit and generate "|"-concatenated strings for the bits; vice versa. Each such enum class has a "None" case that means no bit is set. We need special handling for "None". Because of this, the logic is not general anymore. So right now the definition is placed in the SPIR-V dialect. If later this turns out to be useful for other dialects, then we can see how to properly adjust it and move to OpBase.td. Added tests for SPV_MemoryAccess to check and demonstrate. PiperOrigin-RevId: 269350620
* Update SPIR-V symbols and use GLSL450 instead of VulkanKHRLei Zhang2019-09-131-1/+1
| | | | | | | | | | | | | | SPIR-V recently publishes v1.5, which brings a bunch of symbols into core. So the suffix "KHR"/"EXT"/etc. is removed from the symbols. We use a script to pull information from the spec directly. Also changed conversion and tests to use GLSL450 instead of VulkanKHR memory model. GLSL450 is still the main memory model supported by Vulkan shaders and it does not require extra capability to enable. PiperOrigin-RevId: 268992661
* Add floating-point comparison operations to SPIR-V dialect.Mahesh Ravishankar2019-08-312-43/+92
| | | | | | | | | | | | | Use the existing SPV_LogicalOp specification to add the floating-point comparison operations (both ordered and unordered versions). To make it easier to import the op-definitions automatically modify the dialect generation script to update the different .td files based on whether the operation is an arithmetic op, logical op, etc. Also allow specification of multiple opcodes with define_inst.sh. Since this reuses the SPV_LogicalOp framework, no tests specific to the floating point comparison ops are added with this CL. PiperOrigin-RevId: 266561634
* Add spv.Branch and spv.BranchConditionalLei Zhang2019-08-301-2/+2
| | | | | | | | This CL just covers the op definition, its parsing, printing, and verification. (De)serialization is to be implemented in a subsequent CL. PiperOrigin-RevId: 266431077
* Add BuiltIn EnumAttr to SPIR-V dialectMahesh Ravishankar2019-08-151-1/+1
| | | | | | | | | | Generate the EnumAttr to represent BuiltIns in SPIR-V dialect. The builtIn can be specified as a StringAttr with value being the name of the builtin. Extend Decoration (de)serialization to handle BuiltIns. Also fix an error in the SPIR-V dialect generator script. PiperOrigin-RevId: 263596624
* Add support for (de)serialization of SPIR-V Op DecorationsMahesh Ravishankar2019-07-301-0/+23
| | | | | | | | | | | | 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
* Fix script relative path after moving SPIR-V dialectLei Zhang2019-07-193-3/+3
| | | | PiperOrigin-RevId: 258786729
* Add serialization and deserialization of FuncOps. To support this theMahesh Ravishankar2019-07-121-1/+0
| | | | | | | | | | | | following SPIRV Instructions serializaiton/deserialization are added as well OpFunction OpFunctionParameter OpFunctionEnd OpReturn PiperOrigin-RevId: 257869806
* [spirv] Add script to auto-generate SPIR-V op template from specLei Zhang2019-07-122-36/+403
| | | | | | | | | | | | | | | | | | | SPIR-V has a JSON grammar file that defines the syntax of SPIR-V instructions. However, its lacks fine-grained constraints on instruction operands; those information is only available as natural language sentences in the SPIR-V spec, which also contains the detailed documentation for each SPIR-V instruction. This CL pulls information from both the JSON grammar and HTML spec. It right now uses the former to deduce the arguments and results (with coarse-grained constraints) and the latter for documentation. In the future we can add the functionality to match certain natural language sentences for more fine-grained constraints, but right now the developer is expected to update the generated op definition. This should serve as a nice bootstrap step to save efforts. PiperOrigin-RevId: 257821205
* Update the gen_spirv_dialect.py script to add opcodes from the SPIR-VMahesh Ravishankar2019-07-122-2/+121
| | | | | | | | JSON spec into the SPIRBase.td file. This is done incrementally to only import those opcodes that are needed, through use of the script define_opcode.sh added. PiperOrigin-RevId: 257517343
* [spirv] Use I32EnumAttr for enum attributesLei Zhang2019-07-021-6/+8
| | | | | | | | | | | | This saves us the excessive string conversions and comparisons in verification and transformation and scopes them only to parsing and printing, which are meant for I/O so string conversions should be fine. In order to do this, changed the custom assembly format of spv.module regarding addressing model and memory model. PiperOrigin-RevId: 256149856
* [spirv] Add SPV_StorageClassAttr and PointerTypeLei Zhang2019-06-191-1/+1
| | | | | | | | | Pointer types need to specify the storage class. We use the utility functions generated from SPV_StorageClassAttr to parse and print the storage classes. Also improved the case that no element type is provided for (runtime) array. PiperOrigin-RevId: 252935599
* [spirv] Add values for enum cases and generate the enum utilitiesLei Zhang2019-06-111-5/+12
| | | | PiperOrigin-RevId: 252494957
* [spirv] NFC: use two spaces for indentation in gen_spirv_dialect.pyLei Zhang2019-06-111-87/+87
| | | | PiperOrigin-RevId: 252469663
* [spirv] Add a script to update SPIRVBase.td with new enum attributesLei Zhang2019-06-012-0/+209
This script parses the SPIR-V JSON grammar to extract operand kinds that are enums and generate TableGen definitions for them. Also added a shell script to point to the correct relative file location to simplify command invocation. -- PiperOrigin-RevId: 251041084
OpenPOWER on IntegriCloud