Squashed 'third_party/SPIRV-Headers/' changes from 79b6681aa..e4322e3be

e4322e3be Merge pull request #123 from AaronHaganAMD/master
5bc5041bd Add SPV_KHR_shader_clock to spirv-headers
45c2cc372 Merge pull request #122 from mkinsner/array_init_loop_control_bit
7971055a8 Reserve additional loop control bit for upcoming update to SPV_INTEL_fpga_loop_controls extension
29c11140b Merge pull request #120 from antiagainst/mlir-serializer
123dc278f Merge pull request #121 from jeffbolznv/demote_to_helper_invocation
dcce859e3 add SPV_EXT_demote_to_helper_invocation
739546b1c Reserve ID 23 for MLIR SPIR-V Serializer
de99d4d83 Merge pull request #119 from dneto0/spirv-issue-476
9baa9e099 Add Volatile to Memory Semantics, for SPV_KHR_vulkan_memory_model
9cf7c3a7d Merge pull request #117 from ehsannas/UserTypeGOOGLE
b1344c0d1 Add grammar and symbols for UserTypeGOOGLE extension to unified1.
9242862c8 Merge pull request #105 from mchiasson/cmake_install_config
a7741727e Add missing "version" : "None" to a bunch of reserved enumerants.
d5d33167d Add more detail about reserving tokens to the README.
e88e050b2 Restore numerical order in enumerants.
8b911bd2b Merge pull request #114 from jeffbolznv/fsi
326779e4b Add SPV_EXT_fragment_shader_interlock
9280c0b4f Merge pull request #115 from dgkoch/SPV_NV_sm_shader_builts
630d06236 Add support for SPV_NV_sm_shader_builtins
903d447d9 OpenCL ext. inst. header: Support C in addition to C++.
7ac42f80c Merge pull request #112 from mkinsner/master
d6936f933 Proposed LoopControl bitfield allocation mechanism in spir-v.xml
7f4277e21 Merge pull request #111 from Naghasan/codeplay-range
1edd6c43a Reserve token range for Codeplay
ed8674d22 Update CMakeLists.txt
9674a1a54 Merge pull request #102 from ianromanick/INTEL_shader_integer_functions2
a08d4f0aa Merge pull request #107 from jeffbolznv/duplicate_enum_switch
9f50e659a Update HasResultAndType code generation to skip duplicate enum values. There weren't any until SPIR-V 1.4 release, now there are two.
f7b06c277 updated as per code review
4b0985f29 Merge pull request #106 from alankemp/fix_json_writer
823750b56 Compare enum names rather than values to determine last element
c5a291f7a cmake development configuration package Fixes #104
30ebd2f19 Merge pull request #103 from amdrexu/bugfix
30c51d36e Enable Groups capability by the extension SPV_AMD_shader_ballot
40798610d Add INTEL_shader_integer_functions2
c4f8f6579 Move to version 1.4 of SPIR-V.
a5d33a253 Rationalize opcode ordering and a few spaces.
7af56c133 Merge pull request #101 from dneto0/clspv-generator
92d10249b Reserve generator 21 for Clspv
2434b8934 Merge pull request #100 from jeffbolznv/hasresult
9f7761857 Add a function that returns whether an opcode has a result and/or result type. Currently only implemented in C-based printers.
111a25e4a Merge pull request #99 from Naghasan/contact-update
0e0d1765e Update Codeplay's contact details
3beb2a037 Add ability to skip ranges of instructions; no impact to public headers
2d08d12d8 Sync to rev. 7 of headers from Khronos.
f25b91a61 Merge pull request #98 from jeffbolznv/partitioned
d20b78c77 Add GroupNonUniformPartitionedNV capability to all the GroupNonUniform instructions
a946e7319 Header build for previous grammar update.
8f1cce947 Merge pull request #92 from PawelJurek/SPV_INTEL_device_side_avc_motion_estimation
03a081524 Make all "IdScope" be either Execution or Memory.
dc3db3a5a Fix #96: Don't include a comment after #endif for the C header.
d3752ea20 Merge pull request #95 from mkinsner/fpga_enum_block
2b3bbbc28 Reserve double SPIR-V enum block for upcoming Intel FPGA extension
e74c389f8 Merge pull request #94 from jeffbolznv/cooperative_matrix
56decd41b Add SPV_NV_cooperative_matrix
d0cc5acdf Grammar for SPV_INTEL_device_side_avc_motion_estimation extension.
8bea0a266 Update headers from previous SPV_INTEL_media_block_io grammar addition.
21f0d0744 Merge pull request #93 from PawelJurek/SPV_INTEL_media_block_io
f2aef5d04 Grammar for SPV_INTEL_media_block_io extension
f3abb280c Merge pull request #91 from LukasBanana/master
b6a6dc041 Added '.DS_Store' (MacOS specific file) to gitignore.

git-subtree-dir: third_party/SPIRV-Headers
git-subtree-split: e4322e3be589e1ddd44afb20ea842a977c1319b8
19 files changed
tree: 28f81ab9625d8397a8c82d4dd4ffbaf69f6b0ce9
  1. cmake/
  2. example/
  3. include/
  4. tools/
  5. .gitattributes
  6. .gitignore
  7. CMakeLists.txt
  8. CODE_OF_CONDUCT.md
  9. LICENSE
  10. README.md
README.md

SPIR-V Headers

This repository contains machine-readable files for the SPIR-V Registry. This includes:

  • Header files for various languages.
  • JSON files describing the grammar for the SPIR-V core instruction set and the extended instruction sets.
  • The XML registry file.
  • A tool to build the headers from the JSON grammar.

Headers are provided in the include directory, with up-to-date headers in the unified1 subdirectory. Older headers are provided according to their version.

In contrast, the XML registry file has a linear history, so it is not tied to SPIR-V specification versions.

How is this repository updated?

When a new version or revision of the SPIR-V specification is published, the SPIR-V Working Group will push new commits onto master, updating the files under include.

The SPIR-V XML registry file is updated by Khronos whenever a new enum range is allocated.

Pull requests can be made to

  • request allocation of new enum ranges in the XML registry file
  • reserve specific tokens in the JSON grammar

Reserving tokens in the JSON grammar

Care should be taken to follow existing precedent in populating the details of reserved tokens. This includes:

  • pointing to what extension has more information, when possible
  • keeping enumerants in numeric order
  • when there are aliases, listing the preferred spelling first
  • adding the statement "version" : "None"

How to install the headers

mkdir build
cd build
cmake ..
cmake --build . --target install

Then, for example, you will have /usr/local/include/spirv/unified1/spirv.h

If you want to install them somewhere else, then use -DCMAKE_INSTALL_PREFIX=/other/path on the first cmake command.

Using the headers without installing

A CMake-based project can use the headers without installing, as follows:

  1. Add an add_subdirectory directive to include this source tree.
  2. Use ${SPIRV-Headers_SOURCE_DIR}/include} in a target_include_directories directive.
  3. In your C or C++ source code use #include directives that explicitly mention the spirv path component.
#include "spirv/unified1/GLSL.std.450.h"
#include "spirv/unified1/OpenCL.std.h"
#include "spirv/unified1/spirv.hpp"

See also the example subdirectory. But since that example is inside this repostory, it doesn't use and add_subdirectory directive.

Generating the headers from the JSON grammar

This will generally be done by Khronos, for a change to the JSON grammar. However, the project for the tool to do this is included in this repository, and can be used to test a PR, or even to include the results in the PR. This is not required though.

The header-generation project is under the tools/buildHeaders directory. Use CMake to build the project, in a build subdirectory (under tools/buildHeaders). There is then a bash script at bin/makeHeaders that shows how to use the built header-generator binary to generate the headers from the JSON grammar. (Execute bin/makeHeaders from the tools/buildHeaders directory.)

Notes:

  • this generator is used in a broader context within Khronos to generate the specification, and that influences the languages used, for legacy reasons
  • the C++ structures built may similarly include more than strictly necessary, for the same reason

FAQ

  • How are different versions published?

    The multiple versions of the headers have been simplified into a single unified1 view. The JSON grammar has a “version” field saying what version things first showed up in.

  • How do you handle the evolution of extended instruction sets?

    Extended instruction sets evolve asynchronously from the core spec. Right now there is only a single version of both the GLSL and OpenCL headers. So we don't yet have a problematic example to resolve.

License

Copyright (c) 2015-2018 The Khronos Group Inc.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.

MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
   https://www.khronos.org/registry/

THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.