Squashed 'third_party/SPIRV-Headers/' changes from 268a06176..5e3ad389e

5e3ad389e VkspReflection non-sematic: add dispatchId in configuration (#425)
4f7b471f1 Update bit reservations for loop controsl and memory operands (#424)
7d500c4d7 Register LLVM SPIR-V Backend as SPIR-V generator (#423)
04db24d69 Register spq tools for SPIR-V (#399)
8b246ff75 Add SPV_NV_raw_access_chains (#417)
b73e168ca Headers support for SPV_INTEL_maximum_registers extension (#416)
05cc48658 Add SPV_NV_shader_atomic_fp16_vector (#420)
69597bee0 SPV_QCOM_image_processing2 (#419)
3b11b0209 cmake: Allow external control of test and install options (#418)
d3c2a6fa9 remove Kernel from Image Channel Order and Channel Data Type enums (#413)
e77d03080 Update FPFastMath token reservation (#414)
1c9115b56 List all licenses in the root LICENSE file. (#410)
5aa1dd8a1 Support SPV_KHR_quad_control (with fixed line endings) (#412)
ae6a8b397 SPV_KHR_float_controls2 (#409)
2b9ba211f Add SPV_KHR_maximal_reconvergence (#407)
23d4a398c update copyright dates to 2024 (#404)
7b0309708 Register Zig Compiler tool (#405)
eb36f6c60 Add a Source Language for Zig (#403)
bdd1b2ab1 Reserve an FPFastMathMode bit (#401)
c4a13e774 Bump the github-actions group with 1 update (#400)
2e3dc2e17 Publish the header for the vulkan-shader-profiler embedded reflection… (#398)
1bfd27101 Upstream tokens for SPV_INTEL_masked_gather_scatter (#391)
e11db4d69 feat: Create dependabot.yml (#397)
1c6bb2743 Add a few missing calls to std::exit on error (#395)
d5301a8d3 Headers support for FPGAClusterAttributesV2INTEL (#393)
f1e0d8b51 Add Type-Declaration for extended types (#392)
d5acd42cb Update SPV_INTEL_long_composites tokens (#375)
cca08c63c Change token IDs for global_variable_fpga_decorations and global_variable_host_access (#389)
be3c81e3f It seems d790ced752b5bfc06b6988baadef6eb2d16bdf96 add tabs. (#390)
38f39dae5 Fix SPV_KHR_workgroup_memory_explicit_layout implicit declare (#388)
88bc5e321 Headers support for new FPGAMemoryAttributesINTEL (#384)
4183b260f ClspvReflection non-sematic: add NormalizedSamplerMaskPushConstant (#377)
e867c0663 Add a Source Language for Slang (#383)
f62c82d6b Register Slang Compiler for SPIR-V (#382)
79743b899 Add LiteralFloat to operand_kinds (#380)
f8a4f5d87 Add headers for SPV_NV_displacement_micromap. (#374)
d741b924e remove additional version "1.0" from SecondaryViewportRelativeNV (#379)
fc7d24627 Remove Kernel from ConstantSampler enum values (#378)
a8af2ce34 Add SPV_INTEL_cache_controls extension support (#376)
d790ced75 Validate enums have sensible versions and are visible (#369)
b8b9eb864 Headers support for two Intel extensions (#356)
45fc02a6c Merge pull request #366 from KonstantinSeurer/main
b730938c0 Merge pull request #371 from dneto0/cooperative-matrix-enums-fewer-deps
c43effd54 Revert "Merge pull request #367 from dneto0/coop-matrix-enums-deps"
124a9665e Merge pull request #367 from dneto0/coop-matrix-enums-deps
b846bb75c Cooperative matrix enums depend on the extension
c6e625d2c Add SPV_AMDX_shader_enqueue
f14a663c8 Merge pull request #361 from kpet/coop-matrix-capabilities-alignment
ae89923fa Merge pull request #364 from kpet/coopmatrix-khr-suffix
272be321a Add KHR suffix to Cooperative Matrix Operands
51b106461 Recommit PR #348 - Add fp-max-error support (#363)
14914db17 Merge pull request #360 from kpet/make-headers-error-reporting
0e7d41e27 Report failures in makeHeaders
66e500034 Merge pull request #362 from KhronosGroup/revert-348-asudarsa/add_fp_max_error_support
5c9c56177 Revert "Add support for fp_max_error extension"
ac3b50f84 Remove capabilities on cooperative matrix enums to align with specification
88d56db61 Merge pull request #348 from asudarsa/asudarsa/add_fp_max_error_support
f1ba373ef Merge pull request #358 from alan-baker/wgsl-source-language
5928a8dc7 Merge pull request #353 from joycebrum/main
7d8a844df Add WGSL source language
d0006a393 Merge pull request #357 from SirLynix/patch-1
fb116d7ba Regenerate headers
d90fd3429 Add NZSL as a source language
abca639b3 Add NZSLc as a generator
3469b164e Merge pull request #355 from kpet/spv-khr-cooperative-matrix
6b5af05fb fix operand names
3ca8d522a Change kind of FPMaxErrorDecorationINTEL to LiteralFloat
9b527c0fb Add definitions for SPV_KHR_cooperative_matrix
10db9d4e1 Merge pull request #354 from kpet/spv-ext-image-raw10-raw12
72e4c7e8c Add definitions for SVP_EXT_image_raw10_raw12
0d21d5612 Create SECURITY.md
6e09e44cd Merge pull request #350 from facebook/meta_enums
eb2506428 Reserve SPIR-V enums for Meta
33ec2e8a5 Interchange capability and decoration
866d16777 Merge remote-tracking branch 'real-origin/main' into asudarsa/add_fp_max_error_support
8e2ad2748 Merge pull request #338 from heroseh/main
f48f8eed1 Merge branch 'main' of https://github.com/KhronosGroup/SPIRV-Headers
730800f6d regenerate headers & correct order of TileImage*ReadAccessEXT Capability enum
30e0e73ab add HERO_C to the source language enumeration
69155b22b Merge pull request #347 from jjfumero/update-spirv-tool
ae96002ae Name and url for the TornadoVM SPIR-V Library Tool updated
bdbfd019b Merge pull request #346 from kpet/constexpr-maskall
d8c780f48 Make the generated operators for masks constexpr
fc2395fd2 Add Hero C Compiler to the vendor list & add C source language to the Source Language enum
9bebe8674 Add parameters
d9d7078e3 Merge remote-tracking branch 'real-origin/main' into asudarsa/add_fp_max_error_support
f46e295b2 Header files changes to support SPV_INTEL_fp_max_error spec extension

git-subtree-dir: third_party/SPIRV-Headers
git-subtree-split: 5e3ad389ee56fca27c9705d093ae5387ce404df4
Change-Id: I83c1ec2c33368a910a27d2c296ae2ba4384ac8a8
49 files changed
tree: c0a02c226ed53e5dac51ffdc45c08bd3a814e928
  1. .github/
  2. cmake/
  3. include/
  4. tests/
  5. tools/
  6. .gitattributes
  7. .gitignore
  8. BUILD.bazel
  9. BUILD.gn
  10. CMakeLists.txt
  11. CODE_OF_CONDUCT.md
  12. LICENSE
  13. README.md
  14. SECURITY.md
  15. WORKSPACE
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
  • register a new magic number for a SPIR-V generator
  • reserve specific tokens in the JSON grammar

Registering a SPIR-V Generator Magic Number

Tools that generate SPIR-V should use a magic number in the SPIR-V to help identify the generator.

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

  • keeping generator numbers in numeric order
  • filling out all the existing fields

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

Using CMake

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.

Using Bazel

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

  1. Add SPIRV-Headers as a submodule of your project, and add a local_repository to your WORKSPACE file. For example, if you place SPIRV-Headers under external/spirv-headers, then add the following to your WORKSPACE file:
local_repository(
    name = "spirv_headers",
    path = "external/spirv-headers",
)
  1. Add one of the following to the deps attribute of your build target based on your needs:
@spirv_headers//:spirv_c_headers
@spirv_headers//:spirv_cpp_headers
@spirv_headers//:spirv_cpp11_headers

For example:

cc_library(
  name = "project",
  srcs = [
    # Path to project sources
  ],
  hdrs = [
    # Path to project headers
  ],
  deps = [
    "@spirv_tools//:spirv_c_headers",
    # Other dependencies,
  ],
)
  1. 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"

Generating headers from the JSON grammar for the SPIR-V core instruction set

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 and install 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.) Here's a complete example:

cd tools/buildHeaders
mkdir build
cd build
cmake ..
cmake --build . --target install
cd ..
./bin/makeHeaders

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

Generating C headers for extended instruction sets

The GLSL.std.450.h and OpenCL.std.h extended instruction set headers are maintained manually.

The C/C++ header for each of the other extended instruction sets is generated from the corresponding JSON grammar file. For example, the OpenCLDebugInfo100.h header is generated from the extinst.opencl.debuginfo.100.grammar.json grammar file.

To generate these C/C++ headers, first make sure python3 is in your PATH, then invoke the build script as follows:

cd tools/buildHeaders
python3 bin/makeExtinstHeaders.py

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-2024 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.