xref: /aosp_15_r20/external/angle/third_party/spirv-tools/src/README.md (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# SPIR-V Tools
2*8975f5c5SAndroid Build Coastguard Worker[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/KhronosGroup/SPIRV-Tools/badge)](https://securityscorecards.dev/viewer/?uri=github.com/KhronosGroup/SPIRV-Tools)
3*8975f5c5SAndroid Build Coastguard Worker
4*8975f5c5SAndroid Build Coastguard WorkerNEWS 2023-01-11: Development occurs on the `main` branch.
5*8975f5c5SAndroid Build Coastguard Worker
6*8975f5c5SAndroid Build Coastguard Worker## Overview
7*8975f5c5SAndroid Build Coastguard Worker
8*8975f5c5SAndroid Build Coastguard WorkerThe SPIR-V Tools project provides an API and commands for processing SPIR-V
9*8975f5c5SAndroid Build Coastguard Workermodules.
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard WorkerThe project includes an assembler, binary module parser, disassembler,
12*8975f5c5SAndroid Build Coastguard Workervalidator, and optimizer for SPIR-V. Except for the optimizer, all are based
13*8975f5c5SAndroid Build Coastguard Workeron a common static library.  The library contains all of the implementation
14*8975f5c5SAndroid Build Coastguard Workerdetails, and is used in the standalone tools whilst also enabling integration
15*8975f5c5SAndroid Build Coastguard Workerinto other code bases directly. The optimizer implementation resides in its
16*8975f5c5SAndroid Build Coastguard Workerown library, which depends on the core library.
17*8975f5c5SAndroid Build Coastguard Worker
18*8975f5c5SAndroid Build Coastguard WorkerThe interfaces have stabilized:
19*8975f5c5SAndroid Build Coastguard WorkerWe don't anticipate making a breaking change for existing features.
20*8975f5c5SAndroid Build Coastguard Worker
21*8975f5c5SAndroid Build Coastguard WorkerSPIR-V is defined by the Khronos Group Inc.
22*8975f5c5SAndroid Build Coastguard WorkerSee the [SPIR-V Registry][spirv-registry] for the SPIR-V specification,
23*8975f5c5SAndroid Build Coastguard Workerheaders, and XML registry.
24*8975f5c5SAndroid Build Coastguard Worker
25*8975f5c5SAndroid Build Coastguard Worker## Downloads
26*8975f5c5SAndroid Build Coastguard Worker
27*8975f5c5SAndroid Build Coastguard WorkerThe official releases for SPIRV-Tools can be found on LunarG's
28*8975f5c5SAndroid Build Coastguard Worker[SDK download page](https://vulkan.lunarg.com/sdk/home).
29*8975f5c5SAndroid Build Coastguard Worker
30*8975f5c5SAndroid Build Coastguard WorkerFor convenience, here are also links to the latest builds (HEAD).
31*8975f5c5SAndroid Build Coastguard WorkerThose are untested automated builds. Those are not official releases, nor
32*8975f5c5SAndroid Build Coastguard Workerare guaranteed to work. Official releases builds are in the Vulkan SDK.
33*8975f5c5SAndroid Build Coastguard Worker
34*8975f5c5SAndroid Build Coastguard Worker<img alt="Linux" src="kokoro/img/linux.png" width="20px" height="20px" hspace="2px"/>[![Linux Build Status](https://storage.googleapis.com/spirv-tools/badges/build_status_linux_clang_release.svg)](https://storage.googleapis.com/spirv-tools/badges/build_link_linux_clang_release.html)
35*8975f5c5SAndroid Build Coastguard Worker<img alt="MacOS" src="kokoro/img/macos.png" width="20px" height="20px" hspace="2px"/>[![MacOS Build Status](https://storage.googleapis.com/spirv-tools/badges/build_status_macos_clang_release.svg)](https://storage.googleapis.com/spirv-tools/badges/build_link_macos_clang_release.html)
36*8975f5c5SAndroid Build Coastguard Worker<img alt="Windows" src="kokoro/img/windows.png" width="20px" height="20px" hspace="2px"/>[![Windows Build Status](https://storage.googleapis.com/spirv-tools/badges/build_status_windows_release.svg)](https://storage.googleapis.com/spirv-tools/badges/build_link_windows_vs2019_release.html)
37*8975f5c5SAndroid Build Coastguard Worker
38*8975f5c5SAndroid Build Coastguard Worker[More downloads](docs/downloads.md)
39*8975f5c5SAndroid Build Coastguard Worker
40*8975f5c5SAndroid Build Coastguard Worker## Versioning SPIRV-Tools
41*8975f5c5SAndroid Build Coastguard Worker
42*8975f5c5SAndroid Build Coastguard WorkerSee [`CHANGES`](CHANGES) for a high level summary of recent changes, by version.
43*8975f5c5SAndroid Build Coastguard Worker
44*8975f5c5SAndroid Build Coastguard WorkerSPIRV-Tools project version numbers are of the form `v`*year*`.`*index* and with
45*8975f5c5SAndroid Build Coastguard Workeran optional `-dev` suffix to indicate work in progress.  For example, the
46*8975f5c5SAndroid Build Coastguard Workerfollowing versions are ordered from oldest to newest:
47*8975f5c5SAndroid Build Coastguard Worker
48*8975f5c5SAndroid Build Coastguard Worker* `v2016.0`
49*8975f5c5SAndroid Build Coastguard Worker* `v2016.1-dev`
50*8975f5c5SAndroid Build Coastguard Worker* `v2016.1`
51*8975f5c5SAndroid Build Coastguard Worker* `v2016.2-dev`
52*8975f5c5SAndroid Build Coastguard Worker* `v2016.2`
53*8975f5c5SAndroid Build Coastguard Worker
54*8975f5c5SAndroid Build Coastguard WorkerUse the `--version` option on each command line tool to see the software
55*8975f5c5SAndroid Build Coastguard Workerversion.  An API call reports the software version as a C-style string.
56*8975f5c5SAndroid Build Coastguard Worker
57*8975f5c5SAndroid Build Coastguard Worker## Releases
58*8975f5c5SAndroid Build Coastguard Worker
59*8975f5c5SAndroid Build Coastguard WorkerThe official releases for SPIRV-Tools can be found on LunarG's
60*8975f5c5SAndroid Build Coastguard Worker[SDK download page](https://vulkan.lunarg.com/sdk/home).
61*8975f5c5SAndroid Build Coastguard Worker
62*8975f5c5SAndroid Build Coastguard WorkerYou can find either the prebuilt, and QA tested binaries, or download the
63*8975f5c5SAndroid Build Coastguard WorkerSDK Config, which lists the commits to use to build the release from scratch.
64*8975f5c5SAndroid Build Coastguard Worker
65*8975f5c5SAndroid Build Coastguard WorkerGitHub releases are deprecated, and we will not publish new releases until
66*8975f5c5SAndroid Build Coastguard Workerfurther notice.
67*8975f5c5SAndroid Build Coastguard Worker
68*8975f5c5SAndroid Build Coastguard Worker## Supported features
69*8975f5c5SAndroid Build Coastguard Worker
70*8975f5c5SAndroid Build Coastguard Worker### Assembler, binary parser, and disassembler
71*8975f5c5SAndroid Build Coastguard Worker
72*8975f5c5SAndroid Build Coastguard Worker* Support for SPIR-V 1.0, through 1.5
73*8975f5c5SAndroid Build Coastguard Worker  * Based on SPIR-V syntax described by JSON grammar files in the
74*8975f5c5SAndroid Build Coastguard Worker    [SPIRV-Headers](https://github.com/KhronosGroup/SPIRV-Headers) repository.
75*8975f5c5SAndroid Build Coastguard Worker  * Usually, support for a new version of SPIR-V is ready within days after
76*8975f5c5SAndroid Build Coastguard Worker    publication.
77*8975f5c5SAndroid Build Coastguard Worker* Support for extended instruction sets:
78*8975f5c5SAndroid Build Coastguard Worker  * GLSL std450 version 1.0 Rev 3
79*8975f5c5SAndroid Build Coastguard Worker  * OpenCL version 1.0 Rev 2
80*8975f5c5SAndroid Build Coastguard Worker* Assembler only does basic syntax checking.  No cross validation of
81*8975f5c5SAndroid Build Coastguard Worker  IDs or types is performed, except to check literal arguments to
82*8975f5c5SAndroid Build Coastguard Worker  `OpConstant`, `OpSpecConstant`, and `OpSwitch`.
83*8975f5c5SAndroid Build Coastguard Worker* Where tools expect binary input, a hex stream may be provided instead.  See
84*8975f5c5SAndroid Build Coastguard Worker  `spirv-dis --help`.
85*8975f5c5SAndroid Build Coastguard Worker
86*8975f5c5SAndroid Build Coastguard WorkerSee [`docs/syntax.md`](docs/syntax.md) for the assembly language syntax.
87*8975f5c5SAndroid Build Coastguard Worker
88*8975f5c5SAndroid Build Coastguard Worker### Validator
89*8975f5c5SAndroid Build Coastguard Worker
90*8975f5c5SAndroid Build Coastguard WorkerThe validator checks validation rules described by the SPIR-V specification.
91*8975f5c5SAndroid Build Coastguard Worker
92*8975f5c5SAndroid Build Coastguard WorkerKhronos recommends that tools that create or transform SPIR-V modules use the
93*8975f5c5SAndroid Build Coastguard Workervalidator to ensure their outputs are valid, and that tools that consume SPIR-V
94*8975f5c5SAndroid Build Coastguard Workermodules optionally use the validator to protect themselves from bad inputs.
95*8975f5c5SAndroid Build Coastguard WorkerThis is especially encouraged for debug and development scenarios.
96*8975f5c5SAndroid Build Coastguard Worker
97*8975f5c5SAndroid Build Coastguard WorkerThe validator has one-sided error: it will only return an error when it has
98*8975f5c5SAndroid Build Coastguard Workerimplemented a rule check and the module violates that rule.
99*8975f5c5SAndroid Build Coastguard Worker
100*8975f5c5SAndroid Build Coastguard WorkerThe validator is incomplete.
101*8975f5c5SAndroid Build Coastguard WorkerSee the [CHANGES](CHANGES) file for reports on completed work, and
102*8975f5c5SAndroid Build Coastguard Workerthe [Validator
103*8975f5c5SAndroid Build Coastguard Workersub-project](https://github.com/KhronosGroup/SPIRV-Tools/projects/1) for planned
104*8975f5c5SAndroid Build Coastguard Workerand in-progress work.
105*8975f5c5SAndroid Build Coastguard Worker
106*8975f5c5SAndroid Build Coastguard Worker*Note*: The validator checks some Universal Limits, from section 2.17 of the SPIR-V spec.
107*8975f5c5SAndroid Build Coastguard WorkerThe validator will fail on a module that exceeds those minimum upper bound limits.
108*8975f5c5SAndroid Build Coastguard WorkerThe validator has been parameterized to allow larger values, for use when targeting
109*8975f5c5SAndroid Build Coastguard Workera more-than-minimally-capable SPIR-V consumer.
110*8975f5c5SAndroid Build Coastguard Worker
111*8975f5c5SAndroid Build Coastguard WorkerSee [`tools/val/val.cpp`](tools/val/val.cpp) or run `spirv-val --help` for the command-line help.
112*8975f5c5SAndroid Build Coastguard Worker
113*8975f5c5SAndroid Build Coastguard Worker### Optimizer
114*8975f5c5SAndroid Build Coastguard Worker
115*8975f5c5SAndroid Build Coastguard WorkerThe optimizer is a collection of code transforms, or "passes".
116*8975f5c5SAndroid Build Coastguard WorkerTransforms are written for a diverse set of reasons:
117*8975f5c5SAndroid Build Coastguard Worker
118*8975f5c5SAndroid Build Coastguard Worker* To restructure, simplify, or normalize the code for further processing.
119*8975f5c5SAndroid Build Coastguard Worker* To eliminate undesirable code.
120*8975f5c5SAndroid Build Coastguard Worker* To improve code quality in some metric such as size or performance.
121*8975f5c5SAndroid Build Coastguard Worker  **Note**: These transforms are not guaranteed to actually improve any
122*8975f5c5SAndroid Build Coastguard Worker  given metric. Users should always measure results for their own situation.
123*8975f5c5SAndroid Build Coastguard Worker
124*8975f5c5SAndroid Build Coastguard WorkerAs of this writing, there are 67 transforms including examples such as:
125*8975f5c5SAndroid Build Coastguard Worker* Simplification
126*8975f5c5SAndroid Build Coastguard Worker  * Strip debug info
127*8975f5c5SAndroid Build Coastguard Worker  * Strip reflection info
128*8975f5c5SAndroid Build Coastguard Worker* Specialization Constants
129*8975f5c5SAndroid Build Coastguard Worker  * Set spec constant default value
130*8975f5c5SAndroid Build Coastguard Worker  * Freeze spec constant to default value
131*8975f5c5SAndroid Build Coastguard Worker  * Fold `OpSpecConstantOp` and `OpSpecConstantComposite`
132*8975f5c5SAndroid Build Coastguard Worker  * Unify constants
133*8975f5c5SAndroid Build Coastguard Worker  * Eliminate dead constant
134*8975f5c5SAndroid Build Coastguard Worker* Code Reduction
135*8975f5c5SAndroid Build Coastguard Worker  * Inline all function calls exhaustively
136*8975f5c5SAndroid Build Coastguard Worker  * Convert local access chains to inserts/extracts
137*8975f5c5SAndroid Build Coastguard Worker  * Eliminate local load/store in single block
138*8975f5c5SAndroid Build Coastguard Worker  * Eliminate local load/store with single store
139*8975f5c5SAndroid Build Coastguard Worker  * Eliminate local load/store with multiple stores
140*8975f5c5SAndroid Build Coastguard Worker  * Eliminate local extract from insert
141*8975f5c5SAndroid Build Coastguard Worker  * Eliminate dead instructions (aggressive)
142*8975f5c5SAndroid Build Coastguard Worker  * Eliminate dead branches
143*8975f5c5SAndroid Build Coastguard Worker  * Merge single successor / single predecessor block pairs
144*8975f5c5SAndroid Build Coastguard Worker  * Eliminate common uniform loads
145*8975f5c5SAndroid Build Coastguard Worker  * Remove duplicates: Capabilities, extended instruction imports, types, and
146*8975f5c5SAndroid Build Coastguard Worker    decorations.
147*8975f5c5SAndroid Build Coastguard Worker* Normalization
148*8975f5c5SAndroid Build Coastguard Worker  * Compact IDs
149*8975f5c5SAndroid Build Coastguard Worker  * CFG cleanup
150*8975f5c5SAndroid Build Coastguard Worker  * Flatten decorations
151*8975f5c5SAndroid Build Coastguard Worker  * Merge returns
152*8975f5c5SAndroid Build Coastguard Worker  * Convert AMD-specific instructions to KHR instructions
153*8975f5c5SAndroid Build Coastguard Worker* Code improvement
154*8975f5c5SAndroid Build Coastguard Worker  * Conditional constant propagation
155*8975f5c5SAndroid Build Coastguard Worker  * If-conversion
156*8975f5c5SAndroid Build Coastguard Worker  * Loop fission
157*8975f5c5SAndroid Build Coastguard Worker  * Loop fusion
158*8975f5c5SAndroid Build Coastguard Worker  * Loop-invariant code motion
159*8975f5c5SAndroid Build Coastguard Worker  * Loop unroll
160*8975f5c5SAndroid Build Coastguard Worker* Other
161*8975f5c5SAndroid Build Coastguard Worker  * Graphics robust access
162*8975f5c5SAndroid Build Coastguard Worker  * Upgrade memory model to VulkanKHR
163*8975f5c5SAndroid Build Coastguard Worker
164*8975f5c5SAndroid Build Coastguard WorkerAdditionally, certain sets of transformations have been packaged into
165*8975f5c5SAndroid Build Coastguard Workerhigher-level recipes.  These include:
166*8975f5c5SAndroid Build Coastguard Worker
167*8975f5c5SAndroid Build Coastguard Worker* Optimization for size (`spirv-opt -Os`)
168*8975f5c5SAndroid Build Coastguard Worker* Optimization for performance (`spirv-opt -O`)
169*8975f5c5SAndroid Build Coastguard Worker
170*8975f5c5SAndroid Build Coastguard WorkerFor the latest list with detailed documentation, please refer to
171*8975f5c5SAndroid Build Coastguard Worker[`include/spirv-tools/optimizer.hpp`](include/spirv-tools/optimizer.hpp).
172*8975f5c5SAndroid Build Coastguard Worker
173*8975f5c5SAndroid Build Coastguard WorkerFor suggestions on using the code reduction options, please refer to this [white paper](https://www.lunarg.com/shader-compiler-technologies/white-paper-spirv-opt/).
174*8975f5c5SAndroid Build Coastguard Worker
175*8975f5c5SAndroid Build Coastguard Worker
176*8975f5c5SAndroid Build Coastguard Worker### Linker
177*8975f5c5SAndroid Build Coastguard Worker
178*8975f5c5SAndroid Build Coastguard Worker*Note:* The linker is still under development.
179*8975f5c5SAndroid Build Coastguard Worker
180*8975f5c5SAndroid Build Coastguard WorkerCurrent features:
181*8975f5c5SAndroid Build Coastguard Worker* Combine multiple SPIR-V binary modules together.
182*8975f5c5SAndroid Build Coastguard Worker* Combine into a library (exports are retained) or an executable (no symbols
183*8975f5c5SAndroid Build Coastguard Worker  are exported).
184*8975f5c5SAndroid Build Coastguard Worker
185*8975f5c5SAndroid Build Coastguard WorkerSee the [CHANGES](CHANGES) file for reports on completed work, and the [General
186*8975f5c5SAndroid Build Coastguard Workersub-project](https://github.com/KhronosGroup/SPIRV-Tools/projects/2) for
187*8975f5c5SAndroid Build Coastguard Workerplanned and in-progress work.
188*8975f5c5SAndroid Build Coastguard Worker
189*8975f5c5SAndroid Build Coastguard Worker
190*8975f5c5SAndroid Build Coastguard Worker### Reducer
191*8975f5c5SAndroid Build Coastguard Worker
192*8975f5c5SAndroid Build Coastguard Worker*Note:* The reducer is still under development.
193*8975f5c5SAndroid Build Coastguard Worker
194*8975f5c5SAndroid Build Coastguard WorkerThe reducer simplifies and shrinks a SPIR-V module with respect to a
195*8975f5c5SAndroid Build Coastguard Workeruser-supplied *interestingness function*.  For example, given a large
196*8975f5c5SAndroid Build Coastguard WorkerSPIR-V module that cause some SPIR-V compiler to fail with a given
197*8975f5c5SAndroid Build Coastguard Workerfatal error message, the reducer could be used to look for a smaller
198*8975f5c5SAndroid Build Coastguard Workerversion of the module that causes the compiler to fail with the same
199*8975f5c5SAndroid Build Coastguard Workerfatal error message.
200*8975f5c5SAndroid Build Coastguard Worker
201*8975f5c5SAndroid Build Coastguard WorkerTo suggest an additional capability for the reducer, [file an
202*8975f5c5SAndroid Build Coastguard Workerissue](https://github.com/KhronosGroup/SPIRV-Tools/issues]) with
203*8975f5c5SAndroid Build Coastguard Worker"Reducer:" as the start of its title.
204*8975f5c5SAndroid Build Coastguard Worker
205*8975f5c5SAndroid Build Coastguard Worker
206*8975f5c5SAndroid Build Coastguard Worker### Fuzzer
207*8975f5c5SAndroid Build Coastguard Worker
208*8975f5c5SAndroid Build Coastguard Worker*Note:* The fuzzer is still under development.
209*8975f5c5SAndroid Build Coastguard Worker
210*8975f5c5SAndroid Build Coastguard WorkerThe fuzzer applies semantics-preserving transformations to a SPIR-V binary
211*8975f5c5SAndroid Build Coastguard Workermodule, to produce an equivalent module.  The original and transformed modules
212*8975f5c5SAndroid Build Coastguard Workershould produce essentially identical results when executed on identical inputs:
213*8975f5c5SAndroid Build Coastguard Workertheir results should differ only due to floating-point round-off, if at all.
214*8975f5c5SAndroid Build Coastguard WorkerSignificant differences in results can pinpoint bugs in tools that process
215*8975f5c5SAndroid Build Coastguard WorkerSPIR-V binaries, such as miscompilations.  This *metamorphic testing* approach
216*8975f5c5SAndroid Build Coastguard Workeris similar to the method used by the [GraphicsFuzz
217*8975f5c5SAndroid Build Coastguard Workerproject](https://github.com/google/graphicsfuzz) for fuzzing of GLSL shaders.
218*8975f5c5SAndroid Build Coastguard Worker
219*8975f5c5SAndroid Build Coastguard WorkerTo suggest an additional capability for the fuzzer, [file an
220*8975f5c5SAndroid Build Coastguard Workerissue](https://github.com/KhronosGroup/SPIRV-Tools/issues]) with
221*8975f5c5SAndroid Build Coastguard Worker"Fuzzer:" as the start of its title.
222*8975f5c5SAndroid Build Coastguard Worker
223*8975f5c5SAndroid Build Coastguard Worker
224*8975f5c5SAndroid Build Coastguard Worker### Diff
225*8975f5c5SAndroid Build Coastguard Worker
226*8975f5c5SAndroid Build Coastguard Worker*Note:* The diff tool is still under development.
227*8975f5c5SAndroid Build Coastguard Worker
228*8975f5c5SAndroid Build Coastguard WorkerThe diff tool takes two SPIR-V files, either in binary or text format and
229*8975f5c5SAndroid Build Coastguard Workerproduces a diff-style comparison between the two.  The instructions between the
230*8975f5c5SAndroid Build Coastguard Workersrc and dst modules are matched as best as the tool can, and output is produced
231*8975f5c5SAndroid Build Coastguard Worker(in src id-space) that shows which instructions are removed in src, added in dst
232*8975f5c5SAndroid Build Coastguard Workeror modified between them.  The order of instructions are not retained.
233*8975f5c5SAndroid Build Coastguard Worker
234*8975f5c5SAndroid Build Coastguard WorkerMatching instructions between two SPIR-V modules is not trivial, and thus a
235*8975f5c5SAndroid Build Coastguard Workernumber of heuristics are applied in this tool.  In particular, without debug
236*8975f5c5SAndroid Build Coastguard Workerinformation, match functions is nontrivial as they can be reordered.  As such,
237*8975f5c5SAndroid Build Coastguard Workerthis tool is primarily useful to produce the diff of two SPIR-V modules derived
238*8975f5c5SAndroid Build Coastguard Workerfrom the same source, for example before and after a modification to the shader,
239*8975f5c5SAndroid Build Coastguard Workerbefore and after a transformation, or SPIR-V produced from different tools.
240*8975f5c5SAndroid Build Coastguard Worker
241*8975f5c5SAndroid Build Coastguard Worker
242*8975f5c5SAndroid Build Coastguard Worker### Extras
243*8975f5c5SAndroid Build Coastguard Worker
244*8975f5c5SAndroid Build Coastguard Worker* [Utility filters](#utility-filters)
245*8975f5c5SAndroid Build Coastguard Worker* Build target `spirv-tools-vimsyntax` generates file `spvasm.vim`.
246*8975f5c5SAndroid Build Coastguard Worker  Copy that file into your `$HOME/.vim/syntax` directory to get SPIR-V assembly syntax
247*8975f5c5SAndroid Build Coastguard Worker  highlighting in Vim.  This build target is not built by default.
248*8975f5c5SAndroid Build Coastguard Worker
249*8975f5c5SAndroid Build Coastguard Worker## Contributing
250*8975f5c5SAndroid Build Coastguard Worker
251*8975f5c5SAndroid Build Coastguard WorkerThe SPIR-V Tools project is maintained by members of the The Khronos Group Inc.,
252*8975f5c5SAndroid Build Coastguard Workerand is hosted at https://github.com/KhronosGroup/SPIRV-Tools.
253*8975f5c5SAndroid Build Coastguard Worker
254*8975f5c5SAndroid Build Coastguard WorkerConsider joining the `[email protected]` mailing list, via
255*8975f5c5SAndroid Build Coastguard Worker[https://www.khronos.org/spir/spirv-tools-mailing-list/](https://www.khronos.org/spir/spirv-tools-mailing-list/).
256*8975f5c5SAndroid Build Coastguard WorkerThe mailing list is used to discuss development plans for the SPIRV-Tools as an open source project.
257*8975f5c5SAndroid Build Coastguard WorkerOnce discussion is resolved,
258*8975f5c5SAndroid Build Coastguard Workerspecific work is tracked via issues and sometimes in one of the
259*8975f5c5SAndroid Build Coastguard Worker[projects][spirv-tools-projects].
260*8975f5c5SAndroid Build Coastguard Worker
261*8975f5c5SAndroid Build Coastguard Worker(To provide feedback on the SPIR-V _specification_, file an issue on the
262*8975f5c5SAndroid Build Coastguard Worker[SPIRV-Headers][spirv-headers] GitHub repository.)
263*8975f5c5SAndroid Build Coastguard Worker
264*8975f5c5SAndroid Build Coastguard WorkerSee [`docs/projects.md`](docs/projects.md) to see how we use the
265*8975f5c5SAndroid Build Coastguard Worker[GitHub Project
266*8975f5c5SAndroid Build Coastguard Workerfeature](https://help.github.com/articles/tracking-the-progress-of-your-work-with-projects/)
267*8975f5c5SAndroid Build Coastguard Workerto organize planned and in-progress work.
268*8975f5c5SAndroid Build Coastguard Worker
269*8975f5c5SAndroid Build Coastguard WorkerContributions via merge request are welcome. Changes should:
270*8975f5c5SAndroid Build Coastguard Worker* Be provided under the [Apache 2.0](#license).
271*8975f5c5SAndroid Build Coastguard Worker* You'll be prompted with a one-time "click-through"
272*8975f5c5SAndroid Build Coastguard Worker  [Khronos Open Source Contributor License Agreement][spirv-tools-cla]
273*8975f5c5SAndroid Build Coastguard Worker  (CLA) dialog as part of submitting your pull request or
274*8975f5c5SAndroid Build Coastguard Worker  other contribution to GitHub.
275*8975f5c5SAndroid Build Coastguard Worker* Include tests to cover updated functionality.
276*8975f5c5SAndroid Build Coastguard Worker* C++ code should follow the [Google C++ Style Guide][cpp-style-guide].
277*8975f5c5SAndroid Build Coastguard Worker* Code should be formatted with `clang-format`.
278*8975f5c5SAndroid Build Coastguard Worker  [kokoro/check-format/build.sh](kokoro/check-format/build.sh)
279*8975f5c5SAndroid Build Coastguard Worker  shows how to download it. Note that we currently use
280*8975f5c5SAndroid Build Coastguard Worker  `clang-format version 5.0.0` for SPIRV-Tools. Settings are defined by
281*8975f5c5SAndroid Build Coastguard Worker  the included [.clang-format](.clang-format) file.
282*8975f5c5SAndroid Build Coastguard Worker
283*8975f5c5SAndroid Build Coastguard WorkerWe intend to maintain a linear history on the GitHub `main` branch.
284*8975f5c5SAndroid Build Coastguard Worker
285*8975f5c5SAndroid Build Coastguard Worker### Getting the source
286*8975f5c5SAndroid Build Coastguard Worker
287*8975f5c5SAndroid Build Coastguard WorkerExample of getting sources, assuming SPIRV-Tools is configured as a standalone project:
288*8975f5c5SAndroid Build Coastguard Worker
289*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/KhronosGroup/SPIRV-Tools.git   spirv-tools
290*8975f5c5SAndroid Build Coastguard Worker    cd spirv-tools
291*8975f5c5SAndroid Build Coastguard Worker
292*8975f5c5SAndroid Build Coastguard Worker    # Check out sources for dependencies, at versions known to work together,
293*8975f5c5SAndroid Build Coastguard Worker    # as listed in the DEPS file.
294*8975f5c5SAndroid Build Coastguard Worker    python3 utils/git-sync-deps
295*8975f5c5SAndroid Build Coastguard Worker
296*8975f5c5SAndroid Build Coastguard WorkerFor some kinds of development, you may need the latest sources from the third-party projects:
297*8975f5c5SAndroid Build Coastguard Worker
298*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-tools/external/spirv-headers
299*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/google/googletest.git          spirv-tools/external/googletest
300*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/google/effcee.git              spirv-tools/external/effcee
301*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/google/re2.git                 spirv-tools/external/re2
302*8975f5c5SAndroid Build Coastguard Worker    git clone https://github.com/abseil/abseil-cpp.git          spirv-tools/external/abseil_cpp
303*8975f5c5SAndroid Build Coastguard Worker
304*8975f5c5SAndroid Build Coastguard Worker#### Dependency on Effcee
305*8975f5c5SAndroid Build Coastguard Worker
306*8975f5c5SAndroid Build Coastguard WorkerSome tests depend on the [Effcee][effcee] library for stateful matching.
307*8975f5c5SAndroid Build Coastguard WorkerEffcee itself depends on [RE2][re2], and RE2 depends on [Abseil][abseil-cpp].
308*8975f5c5SAndroid Build Coastguard Worker
309*8975f5c5SAndroid Build Coastguard Worker* If SPIRV-Tools is configured as part of a larger project that already uses
310*8975f5c5SAndroid Build Coastguard Worker  Effcee, then that project should include Effcee before SPIRV-Tools.
311*8975f5c5SAndroid Build Coastguard Worker* Otherwise, SPIRV-Tools expects Effcee sources to appear in `external/effcee`,
312*8975f5c5SAndroid Build Coastguard Worker  RE2 sources to appear in `external/re2`, and Abseil sources to appear in
313*8975f5c5SAndroid Build Coastguard Worker  `external/abseil_cpp`.
314*8975f5c5SAndroid Build Coastguard Worker
315*8975f5c5SAndroid Build Coastguard Worker### Source code organization
316*8975f5c5SAndroid Build Coastguard Worker
317*8975f5c5SAndroid Build Coastguard Worker* `example`: demo code of using SPIRV-Tools APIs
318*8975f5c5SAndroid Build Coastguard Worker* `external/googletest`: Intended location for the
319*8975f5c5SAndroid Build Coastguard Worker  [googletest][googletest] sources, not provided
320*8975f5c5SAndroid Build Coastguard Worker* `external/effcee`: Location of [Effcee][effcee] sources, if the `effcee` library
321*8975f5c5SAndroid Build Coastguard Worker  is not already configured by an enclosing project.
322*8975f5c5SAndroid Build Coastguard Worker* `external/re2`: Location of [RE2][re2] sources, if the `re2` library is not already
323*8975f5c5SAndroid Build Coastguard Worker  configured by an enclosing project.
324*8975f5c5SAndroid Build Coastguard Worker  (The Effcee project already requires RE2.)
325*8975f5c5SAndroid Build Coastguard Worker* `external/abseil_cpp`: Location of [Abseil][abseil-cpp] sources, if Abseil is
326*8975f5c5SAndroid Build Coastguard Worker   not already configured by an enclosing project.
327*8975f5c5SAndroid Build Coastguard Worker  (The RE2 project already requires Abseil.)
328*8975f5c5SAndroid Build Coastguard Worker* `include/`: API clients should add this directory to the include search path
329*8975f5c5SAndroid Build Coastguard Worker* `external/spirv-headers`: Intended location for
330*8975f5c5SAndroid Build Coastguard Worker  [SPIR-V headers][spirv-headers], not provided
331*8975f5c5SAndroid Build Coastguard Worker* `include/spirv-tools/libspirv.h`: C API public interface
332*8975f5c5SAndroid Build Coastguard Worker* `source/`: API implementation
333*8975f5c5SAndroid Build Coastguard Worker* `test/`: Tests, using the [googletest][googletest] framework
334*8975f5c5SAndroid Build Coastguard Worker* `tools/`: Command line executables
335*8975f5c5SAndroid Build Coastguard Worker
336*8975f5c5SAndroid Build Coastguard Worker### Tests
337*8975f5c5SAndroid Build Coastguard Worker
338*8975f5c5SAndroid Build Coastguard WorkerThe project contains a number of tests, used to drive development
339*8975f5c5SAndroid Build Coastguard Workerand ensure correctness.  The tests are written using the
340*8975f5c5SAndroid Build Coastguard Worker[googletest][googletest] framework.  The `googletest`
341*8975f5c5SAndroid Build Coastguard Workersource is not provided with this project.  There are two ways to enable
342*8975f5c5SAndroid Build Coastguard Workertests:
343*8975f5c5SAndroid Build Coastguard Worker* If SPIR-V Tools is configured as part of an enclosing project, then the
344*8975f5c5SAndroid Build Coastguard Worker  enclosing project should configure `googletest` before configuring SPIR-V Tools.
345*8975f5c5SAndroid Build Coastguard Worker* If SPIR-V Tools is configured as a standalone project, then download the
346*8975f5c5SAndroid Build Coastguard Worker  `googletest` source into the `<spirv-dir>/external/googletest` directory before
347*8975f5c5SAndroid Build Coastguard Worker  configuring and building the project.
348*8975f5c5SAndroid Build Coastguard Worker
349*8975f5c5SAndroid Build Coastguard Worker## Build
350*8975f5c5SAndroid Build Coastguard Worker
351*8975f5c5SAndroid Build Coastguard Worker*Note*: Prebuilt binaries are available from the [downloads](docs/downloads.md) page.
352*8975f5c5SAndroid Build Coastguard Worker
353*8975f5c5SAndroid Build Coastguard WorkerFirst [get the sources](#getting-the-source).
354*8975f5c5SAndroid Build Coastguard WorkerThen build using CMake, Bazel, Android ndk-build, or the Emscripten SDK.
355*8975f5c5SAndroid Build Coastguard Worker
356*8975f5c5SAndroid Build Coastguard Worker### Build using CMake
357*8975f5c5SAndroid Build Coastguard WorkerYou can build the project using [CMake][cmake]:
358*8975f5c5SAndroid Build Coastguard Worker
359*8975f5c5SAndroid Build Coastguard Worker```sh
360*8975f5c5SAndroid Build Coastguard Workercd <spirv-dir>
361*8975f5c5SAndroid Build Coastguard Workermkdir build && cd build
362*8975f5c5SAndroid Build Coastguard Workercmake [-G <platform-generator>] <spirv-dir>
363*8975f5c5SAndroid Build Coastguard Worker```
364*8975f5c5SAndroid Build Coastguard Worker
365*8975f5c5SAndroid Build Coastguard WorkerOnce the build files have been generated, build using the appropriate build
366*8975f5c5SAndroid Build Coastguard Workercommand (e.g. `ninja`, `make`, `msbuild`, etc.; this depends on the platform
367*8975f5c5SAndroid Build Coastguard Workergenerator used above), or use your IDE, or use CMake to run the appropriate build
368*8975f5c5SAndroid Build Coastguard Workercommand for you:
369*8975f5c5SAndroid Build Coastguard Worker
370*8975f5c5SAndroid Build Coastguard Worker```sh
371*8975f5c5SAndroid Build Coastguard Workercmake --build . [--config Debug]  # runs `make` or `ninja` or `msbuild` etc.
372*8975f5c5SAndroid Build Coastguard Worker```
373*8975f5c5SAndroid Build Coastguard Worker
374*8975f5c5SAndroid Build Coastguard Worker#### Note about the fuzzer
375*8975f5c5SAndroid Build Coastguard Worker
376*8975f5c5SAndroid Build Coastguard WorkerThe SPIR-V fuzzer, `spirv-fuzz`, can only be built via CMake, and is disabled by
377*8975f5c5SAndroid Build Coastguard Workerdefault. To build it, clone protobuf and use the `SPIRV_BUILD_FUZZER` CMake
378*8975f5c5SAndroid Build Coastguard Workeroption, like so:
379*8975f5c5SAndroid Build Coastguard Worker
380*8975f5c5SAndroid Build Coastguard Worker```sh
381*8975f5c5SAndroid Build Coastguard Worker# In <spirv-dir> (the SPIRV-Tools repo root):
382*8975f5c5SAndroid Build Coastguard Workergit clone --depth=1 --branch v3.13.0.1 https://github.com/protocolbuffers/protobuf external/protobuf
383*8975f5c5SAndroid Build Coastguard Worker
384*8975f5c5SAndroid Build Coastguard Worker# In your build directory:
385*8975f5c5SAndroid Build Coastguard Workercmake [-G <platform-generator>] <spirv-dir> -DSPIRV_BUILD_FUZZER=ON
386*8975f5c5SAndroid Build Coastguard Workercmake --build . --config Debug
387*8975f5c5SAndroid Build Coastguard Worker```
388*8975f5c5SAndroid Build Coastguard Worker
389*8975f5c5SAndroid Build Coastguard WorkerYou can also add `-DSPIRV_ENABLE_LONG_FUZZER_TESTS=ON` to build additional
390*8975f5c5SAndroid Build Coastguard Workerfuzzer tests.
391*8975f5c5SAndroid Build Coastguard Worker
392*8975f5c5SAndroid Build Coastguard Worker
393*8975f5c5SAndroid Build Coastguard Worker### Build using Bazel
394*8975f5c5SAndroid Build Coastguard WorkerYou can also use [Bazel](https://bazel.build/) to build the project.
395*8975f5c5SAndroid Build Coastguard Worker
396*8975f5c5SAndroid Build Coastguard Worker```sh
397*8975f5c5SAndroid Build Coastguard Workerbazel build :all
398*8975f5c5SAndroid Build Coastguard Worker```
399*8975f5c5SAndroid Build Coastguard Worker
400*8975f5c5SAndroid Build Coastguard Worker### Build a node.js package using Emscripten
401*8975f5c5SAndroid Build Coastguard Worker
402*8975f5c5SAndroid Build Coastguard WorkerThe SPIRV-Tools core library can be built to a WebAssembly [node.js](https://nodejs.org)
403*8975f5c5SAndroid Build Coastguard Workermodule. The resulting `SpirvTools` WebAssembly module only exports methods to
404*8975f5c5SAndroid Build Coastguard Workerassemble and disassemble SPIR-V modules.
405*8975f5c5SAndroid Build Coastguard Worker
406*8975f5c5SAndroid Build Coastguard WorkerFirst, make sure you have the [Emscripten SDK](https://emscripten.org).
407*8975f5c5SAndroid Build Coastguard WorkerThen:
408*8975f5c5SAndroid Build Coastguard Worker
409*8975f5c5SAndroid Build Coastguard Worker```sh
410*8975f5c5SAndroid Build Coastguard Workercd <spirv-dir>
411*8975f5c5SAndroid Build Coastguard Worker./source/wasm/build.sh
412*8975f5c5SAndroid Build Coastguard Worker```
413*8975f5c5SAndroid Build Coastguard Worker
414*8975f5c5SAndroid Build Coastguard WorkerThe resulting node package, with JavaScript and TypeScript bindings, is
415*8975f5c5SAndroid Build Coastguard Workerwritten to `<spirv-dir>/out/web`.
416*8975f5c5SAndroid Build Coastguard Worker
417*8975f5c5SAndroid Build Coastguard WorkerNote: This builds the package locally. It does *not* publish it to [npm](https://npmjs.org).
418*8975f5c5SAndroid Build Coastguard Worker
419*8975f5c5SAndroid Build Coastguard WorkerTo test the result:
420*8975f5c5SAndroid Build Coastguard Worker
421*8975f5c5SAndroid Build Coastguard Worker```sh
422*8975f5c5SAndroid Build Coastguard Workernode ./test/wasm/test.js
423*8975f5c5SAndroid Build Coastguard Worker```
424*8975f5c5SAndroid Build Coastguard Worker
425*8975f5c5SAndroid Build Coastguard Worker### Tools you'll need
426*8975f5c5SAndroid Build Coastguard Worker
427*8975f5c5SAndroid Build Coastguard WorkerFor building and testing SPIRV-Tools, the following tools should be
428*8975f5c5SAndroid Build Coastguard Workerinstalled regardless of your OS:
429*8975f5c5SAndroid Build Coastguard Worker
430*8975f5c5SAndroid Build Coastguard Worker- [CMake](http://www.cmake.org/): if using CMake for generating compilation
431*8975f5c5SAndroid Build Coastguard Workertargets, you need to install CMake Version 2.8.12 or later.
432*8975f5c5SAndroid Build Coastguard Worker- [Python 3](http://www.python.org/): for utility scripts and running the test
433*8975f5c5SAndroid Build Coastguard Workersuite.
434*8975f5c5SAndroid Build Coastguard Worker- [Bazel](https://bazel.build/) (optional): if building the source with Bazel,
435*8975f5c5SAndroid Build Coastguard Workeryou need to install Bazel Version 7.0.2 on your machine. Other versions may
436*8975f5c5SAndroid Build Coastguard Workeralso work, but are not verified.
437*8975f5c5SAndroid Build Coastguard Worker- [Emscripten SDK](https://emscripten.org) (optional): if building the
438*8975f5c5SAndroid Build Coastguard Worker  WebAssembly module.
439*8975f5c5SAndroid Build Coastguard Worker
440*8975f5c5SAndroid Build Coastguard WorkerSPIRV-Tools is regularly tested with the following compilers:
441*8975f5c5SAndroid Build Coastguard Worker
442*8975f5c5SAndroid Build Coastguard WorkerOn Linux
443*8975f5c5SAndroid Build Coastguard Worker- GCC version 9.3
444*8975f5c5SAndroid Build Coastguard Worker- Clang version 10.0
445*8975f5c5SAndroid Build Coastguard Worker
446*8975f5c5SAndroid Build Coastguard WorkerOn MacOS
447*8975f5c5SAndroid Build Coastguard Worker- AppleClang 11.0
448*8975f5c5SAndroid Build Coastguard Worker
449*8975f5c5SAndroid Build Coastguard WorkerOn Windows
450*8975f5c5SAndroid Build Coastguard Worker- Visual Studio 2017
451*8975f5c5SAndroid Build Coastguard Worker- Visual Studio 2019
452*8975f5c5SAndroid Build Coastguard Worker- Visual Studio 2022
453*8975f5c5SAndroid Build Coastguard Worker
454*8975f5c5SAndroid Build Coastguard WorkerNote: Visual Studio 2017 has incomplete c++17 support. We might stop
455*8975f5c5SAndroid Build Coastguard Workertesting it soon. Other compilers or later versions may work, but they are not
456*8975f5c5SAndroid Build Coastguard Workertested.
457*8975f5c5SAndroid Build Coastguard Worker
458*8975f5c5SAndroid Build Coastguard Worker### CMake options
459*8975f5c5SAndroid Build Coastguard Worker
460*8975f5c5SAndroid Build Coastguard WorkerThe following CMake options are supported:
461*8975f5c5SAndroid Build Coastguard Worker
462*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_BUILD_FUZZER={ON|OFF}`, default `OFF` - Build the spirv-fuzz tool.
463*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_COLOR_TERMINAL={ON|OFF}`, default `ON` - Enables color console output.
464*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_SKIP_TESTS={ON|OFF}`, default `OFF`- Build only the library and
465*8975f5c5SAndroid Build Coastguard Worker  the command line tools.  This will prevent the tests from being built.
466*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_SKIP_EXECUTABLES={ON|OFF}`, default `OFF`- Build only the library, not
467*8975f5c5SAndroid Build Coastguard Worker  the command line tools and tests.
468*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_USE_SANITIZER=<sanitizer>`, default is no sanitizing - On UNIX
469*8975f5c5SAndroid Build Coastguard Worker  platforms with an appropriate version of `clang` this option enables the use
470*8975f5c5SAndroid Build Coastguard Worker  of the sanitizers documented [here][clang-sanitizers].
471*8975f5c5SAndroid Build Coastguard Worker  This should only be used with a debug build.
472*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_WARN_EVERYTHING={ON|OFF}`, default `OFF` - On UNIX platforms enable
473*8975f5c5SAndroid Build Coastguard Worker  more strict warnings.  The code might not compile with this option enabled.
474*8975f5c5SAndroid Build Coastguard Worker  For Clang, enables `-Weverything`.  For GCC, enables `-Wpedantic`.
475*8975f5c5SAndroid Build Coastguard Worker  See [`CMakeLists.txt`](CMakeLists.txt) for details.
476*8975f5c5SAndroid Build Coastguard Worker* `SPIRV_WERROR={ON|OFF}`, default `ON` - Forces a compilation error on any
477*8975f5c5SAndroid Build Coastguard Worker  warnings encountered by enabling the compiler-specific compiler front-end
478*8975f5c5SAndroid Build Coastguard Worker  option.  No compiler front-end options are enabled when this option is OFF.
479*8975f5c5SAndroid Build Coastguard Worker
480*8975f5c5SAndroid Build Coastguard WorkerAdditionally, you can pass additional C preprocessor definitions to SPIRV-Tools
481*8975f5c5SAndroid Build Coastguard Workervia setting `SPIRV_TOOLS_EXTRA_DEFINITIONS`. For example, by setting it to
482*8975f5c5SAndroid Build Coastguard Worker`/D_ITERATOR_DEBUG_LEVEL=0` on Windows, you can disable checked iterators and
483*8975f5c5SAndroid Build Coastguard Workeriterator debugging.
484*8975f5c5SAndroid Build Coastguard Worker
485*8975f5c5SAndroid Build Coastguard Worker### Android ndk-build
486*8975f5c5SAndroid Build Coastguard Worker
487*8975f5c5SAndroid Build Coastguard WorkerSPIR-V Tools supports building static libraries `libSPIRV-Tools.a` and
488*8975f5c5SAndroid Build Coastguard Worker`libSPIRV-Tools-opt.a` for Android.  Using the Android NDK r25c or later:
489*8975f5c5SAndroid Build Coastguard Worker
490*8975f5c5SAndroid Build Coastguard Worker```
491*8975f5c5SAndroid Build Coastguard Workercd <spirv-dir>
492*8975f5c5SAndroid Build Coastguard Worker
493*8975f5c5SAndroid Build Coastguard Workerexport ANDROID_NDK=/path/to/your/ndk   # NDK r25c or later
494*8975f5c5SAndroid Build Coastguard Worker
495*8975f5c5SAndroid Build Coastguard Workermkdir build && cd build
496*8975f5c5SAndroid Build Coastguard Workermkdir libs
497*8975f5c5SAndroid Build Coastguard Workermkdir app
498*8975f5c5SAndroid Build Coastguard Worker
499*8975f5c5SAndroid Build Coastguard Worker$ANDROID_NDK/ndk-build -C ../android_test     \
500*8975f5c5SAndroid Build Coastguard Worker                      NDK_PROJECT_PATH=.      \
501*8975f5c5SAndroid Build Coastguard Worker                      NDK_LIBS_OUT=`pwd`/libs \
502*8975f5c5SAndroid Build Coastguard Worker                      NDK_APP_OUT=`pwd`/app
503*8975f5c5SAndroid Build Coastguard Worker```
504*8975f5c5SAndroid Build Coastguard Worker
505*8975f5c5SAndroid Build Coastguard Worker### Updating DEPS
506*8975f5c5SAndroid Build Coastguard Worker
507*8975f5c5SAndroid Build Coastguard WorkerOccasionally the entries in [DEPS](DEPS) will need to be updated. This is done on
508*8975f5c5SAndroid Build Coastguard Workerdemand when there is a request to do this, often due to downstream breakages.
509*8975f5c5SAndroid Build Coastguard WorkerTo update `DEPS`, run `utils/roll_deps.sh` and confirm that tests pass.
510*8975f5c5SAndroid Build Coastguard WorkerThe script requires Chromium's
511*8975f5c5SAndroid Build Coastguard Worker[`depot_tools`](https://chromium.googlesource.com/chromium/tools/depot_tools).
512*8975f5c5SAndroid Build Coastguard Worker
513*8975f5c5SAndroid Build Coastguard Worker## Library
514*8975f5c5SAndroid Build Coastguard Worker
515*8975f5c5SAndroid Build Coastguard Worker### Usage
516*8975f5c5SAndroid Build Coastguard Worker
517*8975f5c5SAndroid Build Coastguard WorkerThe internals of the library use C++17 features, and are exposed via both a C
518*8975f5c5SAndroid Build Coastguard Workerand C++ API.
519*8975f5c5SAndroid Build Coastguard Worker
520*8975f5c5SAndroid Build Coastguard WorkerIn order to use the library from an application, the include path should point
521*8975f5c5SAndroid Build Coastguard Workerto `<spirv-dir>/include`, which will enable the application to include the
522*8975f5c5SAndroid Build Coastguard Workerheader `<spirv-dir>/include/spirv-tools/libspirv.h{|pp}` then linking against
523*8975f5c5SAndroid Build Coastguard Workerthe static library in `<spirv-build-dir>/source/libSPIRV-Tools.a` or
524*8975f5c5SAndroid Build Coastguard Worker`<spirv-build-dir>/source/SPIRV-Tools.lib`.
525*8975f5c5SAndroid Build Coastguard WorkerFor optimization, the header file is
526*8975f5c5SAndroid Build Coastguard Worker`<spirv-dir>/include/spirv-tools/optimizer.hpp`, and the static library is
527*8975f5c5SAndroid Build Coastguard Worker`<spirv-build-dir>/source/libSPIRV-Tools-opt.a` or
528*8975f5c5SAndroid Build Coastguard Worker`<spirv-build-dir>/source/SPIRV-Tools-opt.lib`.
529*8975f5c5SAndroid Build Coastguard Worker
530*8975f5c5SAndroid Build Coastguard Worker* `SPIRV-Tools` CMake target: Creates the static library:
531*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-build-dir>/source/libSPIRV-Tools.a` on Linux and OS X.
532*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-build-dir>/source/libSPIRV-Tools.lib` on Windows.
533*8975f5c5SAndroid Build Coastguard Worker* `SPIRV-Tools-opt` CMake target: Creates the static library:
534*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-build-dir>/source/libSPIRV-Tools-opt.a` on Linux and OS X.
535*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-build-dir>/source/libSPIRV-Tools-opt.lib` on Windows.
536*8975f5c5SAndroid Build Coastguard Worker
537*8975f5c5SAndroid Build Coastguard Worker#### Entry points
538*8975f5c5SAndroid Build Coastguard Worker
539*8975f5c5SAndroid Build Coastguard WorkerThe interfaces are still under development, and are expected to change.
540*8975f5c5SAndroid Build Coastguard Worker
541*8975f5c5SAndroid Build Coastguard WorkerThere are five main entry points into the library in the C interface:
542*8975f5c5SAndroid Build Coastguard Worker
543*8975f5c5SAndroid Build Coastguard Worker* `spvTextToBinary`: An assembler, translating text to a binary SPIR-V module.
544*8975f5c5SAndroid Build Coastguard Worker* `spvBinaryToText`: A disassembler, translating a binary SPIR-V module to
545*8975f5c5SAndroid Build Coastguard Worker  text.
546*8975f5c5SAndroid Build Coastguard Worker* `spvBinaryParse`: The entry point to a binary parser API.  It issues callbacks
547*8975f5c5SAndroid Build Coastguard Worker  for the header and each parsed instruction.  The disassembler is implemented
548*8975f5c5SAndroid Build Coastguard Worker  as a client of `spvBinaryParse`.
549*8975f5c5SAndroid Build Coastguard Worker* `spvValidate` implements the validator functionality. *Incomplete*
550*8975f5c5SAndroid Build Coastguard Worker* `spvValidateBinary` implements the validator functionality. *Incomplete*
551*8975f5c5SAndroid Build Coastguard Worker
552*8975f5c5SAndroid Build Coastguard WorkerThe C++ interface is comprised of three classes, `SpirvTools`, `Optimizer` and
553*8975f5c5SAndroid Build Coastguard Worker`Linker`, all in the `spvtools` namespace.
554*8975f5c5SAndroid Build Coastguard Worker* `SpirvTools` provides `Assemble`, `Disassemble`, and `Validate` methods.
555*8975f5c5SAndroid Build Coastguard Worker* `Optimizer` provides methods for registering and running optimization passes.
556*8975f5c5SAndroid Build Coastguard Worker* `Linker` provides methods for combining together multiple binaries.
557*8975f5c5SAndroid Build Coastguard Worker
558*8975f5c5SAndroid Build Coastguard Worker## Command line tools
559*8975f5c5SAndroid Build Coastguard Worker
560*8975f5c5SAndroid Build Coastguard WorkerCommand line tools, which wrap the above library functions, are provided to
561*8975f5c5SAndroid Build Coastguard Workerassemble or disassemble shader files.  It's a convention to name SPIR-V
562*8975f5c5SAndroid Build Coastguard Workerassembly and binary files with suffix `.spvasm` and `.spv`, respectively.
563*8975f5c5SAndroid Build Coastguard Worker
564*8975f5c5SAndroid Build Coastguard Worker### Assembler tool
565*8975f5c5SAndroid Build Coastguard Worker
566*8975f5c5SAndroid Build Coastguard WorkerThe assembler reads the assembly language text, and emits the binary form.
567*8975f5c5SAndroid Build Coastguard Worker
568*8975f5c5SAndroid Build Coastguard WorkerThe standalone assembler is the executable called `spirv-as`, and is located in
569*8975f5c5SAndroid Build Coastguard Worker`<spirv-build-dir>/tools/spirv-as`.  The functionality of the assembler is implemented
570*8975f5c5SAndroid Build Coastguard Workerby the `spvTextToBinary` library function.
571*8975f5c5SAndroid Build Coastguard Worker
572*8975f5c5SAndroid Build Coastguard Worker* `spirv-as` - the standalone assembler
573*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/as`
574*8975f5c5SAndroid Build Coastguard Worker
575*8975f5c5SAndroid Build Coastguard WorkerUse option `-h` to print help.
576*8975f5c5SAndroid Build Coastguard Worker
577*8975f5c5SAndroid Build Coastguard Worker### Disassembler tool
578*8975f5c5SAndroid Build Coastguard Worker
579*8975f5c5SAndroid Build Coastguard WorkerThe disassembler reads the binary form, and emits assembly language text.
580*8975f5c5SAndroid Build Coastguard Worker
581*8975f5c5SAndroid Build Coastguard WorkerThe standalone disassembler is the executable called `spirv-dis`, and is located in
582*8975f5c5SAndroid Build Coastguard Worker`<spirv-build-dir>/tools/spirv-dis`. The functionality of the disassembler is implemented
583*8975f5c5SAndroid Build Coastguard Workerby the `spvBinaryToText` library function.
584*8975f5c5SAndroid Build Coastguard Worker
585*8975f5c5SAndroid Build Coastguard Worker* `spirv-dis` - the standalone disassembler
586*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/dis`
587*8975f5c5SAndroid Build Coastguard Worker
588*8975f5c5SAndroid Build Coastguard WorkerUse option `-h` to print help.
589*8975f5c5SAndroid Build Coastguard Worker
590*8975f5c5SAndroid Build Coastguard WorkerThe output includes syntax colouring when printing to the standard output stream,
591*8975f5c5SAndroid Build Coastguard Workeron Linux, Windows, and OS X.
592*8975f5c5SAndroid Build Coastguard Worker
593*8975f5c5SAndroid Build Coastguard Worker### Linker tool
594*8975f5c5SAndroid Build Coastguard Worker
595*8975f5c5SAndroid Build Coastguard WorkerThe linker combines multiple SPIR-V binary modules together, resulting in a single
596*8975f5c5SAndroid Build Coastguard Workerbinary module as output.
597*8975f5c5SAndroid Build Coastguard Worker
598*8975f5c5SAndroid Build Coastguard WorkerThis is a work in progress.
599*8975f5c5SAndroid Build Coastguard WorkerThe linker does not support OpenCL program linking options related to math
600*8975f5c5SAndroid Build Coastguard Workerflags. (See section 5.6.5.2 in OpenCL 1.2)
601*8975f5c5SAndroid Build Coastguard Worker
602*8975f5c5SAndroid Build Coastguard Worker* `spirv-link` - the standalone linker
603*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/link`
604*8975f5c5SAndroid Build Coastguard Worker
605*8975f5c5SAndroid Build Coastguard Worker### Optimizer tool
606*8975f5c5SAndroid Build Coastguard Worker
607*8975f5c5SAndroid Build Coastguard WorkerThe optimizer processes a SPIR-V binary module, applying transformations
608*8975f5c5SAndroid Build Coastguard Workerin the specified order.
609*8975f5c5SAndroid Build Coastguard Worker
610*8975f5c5SAndroid Build Coastguard WorkerThis is a work in progress, with initially only few available transformations.
611*8975f5c5SAndroid Build Coastguard Worker
612*8975f5c5SAndroid Build Coastguard Worker* `spirv-opt` - the standalone optimizer
613*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/opt`
614*8975f5c5SAndroid Build Coastguard Worker
615*8975f5c5SAndroid Build Coastguard Worker### Validator tool
616*8975f5c5SAndroid Build Coastguard Worker
617*8975f5c5SAndroid Build Coastguard Worker*Warning:* This functionality is under development, and is incomplete.
618*8975f5c5SAndroid Build Coastguard Worker
619*8975f5c5SAndroid Build Coastguard WorkerThe standalone validator is the executable called `spirv-val`, and is located in
620*8975f5c5SAndroid Build Coastguard Worker`<spirv-build-dir>/tools/spirv-val`. The functionality of the validator is implemented
621*8975f5c5SAndroid Build Coastguard Workerby the `spvValidate` library function.
622*8975f5c5SAndroid Build Coastguard Worker
623*8975f5c5SAndroid Build Coastguard WorkerThe validator operates on the binary form.
624*8975f5c5SAndroid Build Coastguard Worker
625*8975f5c5SAndroid Build Coastguard Worker* `spirv-val` - the standalone validator
626*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/val`
627*8975f5c5SAndroid Build Coastguard Worker
628*8975f5c5SAndroid Build Coastguard Worker### Reducer tool
629*8975f5c5SAndroid Build Coastguard Worker
630*8975f5c5SAndroid Build Coastguard WorkerThe reducer shrinks a SPIR-V binary module, guided by a user-supplied
631*8975f5c5SAndroid Build Coastguard Worker*interestingness test*.
632*8975f5c5SAndroid Build Coastguard Worker
633*8975f5c5SAndroid Build Coastguard WorkerThis is a work in progress, with initially only shrinks a module in a few ways.
634*8975f5c5SAndroid Build Coastguard Worker
635*8975f5c5SAndroid Build Coastguard Worker* `spirv-reduce` - the standalone reducer
636*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/reduce`
637*8975f5c5SAndroid Build Coastguard Worker
638*8975f5c5SAndroid Build Coastguard WorkerRun `spirv-reduce --help` to see how to specify interestingness.
639*8975f5c5SAndroid Build Coastguard Worker
640*8975f5c5SAndroid Build Coastguard Worker### Fuzzer tool
641*8975f5c5SAndroid Build Coastguard Worker
642*8975f5c5SAndroid Build Coastguard WorkerThe fuzzer transforms a SPIR-V binary module into a semantically-equivalent
643*8975f5c5SAndroid Build Coastguard WorkerSPIR-V binary module by applying transformations in a randomized fashion.
644*8975f5c5SAndroid Build Coastguard Worker
645*8975f5c5SAndroid Build Coastguard WorkerThis is a work in progress, with initially only a few semantics-preserving
646*8975f5c5SAndroid Build Coastguard Workertransformations.
647*8975f5c5SAndroid Build Coastguard Worker
648*8975f5c5SAndroid Build Coastguard Worker* `spirv-fuzz` - the standalone fuzzer
649*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/fuzz`
650*8975f5c5SAndroid Build Coastguard Worker
651*8975f5c5SAndroid Build Coastguard WorkerRun `spirv-fuzz --help` for a detailed list of options.
652*8975f5c5SAndroid Build Coastguard Worker
653*8975f5c5SAndroid Build Coastguard Worker### Control flow dumper tool
654*8975f5c5SAndroid Build Coastguard Worker
655*8975f5c5SAndroid Build Coastguard WorkerThe control flow dumper prints the control flow graph for a SPIR-V module as a
656*8975f5c5SAndroid Build Coastguard Worker[GraphViz](http://www.graphviz.org/) graph.
657*8975f5c5SAndroid Build Coastguard Worker
658*8975f5c5SAndroid Build Coastguard WorkerThis is experimental.
659*8975f5c5SAndroid Build Coastguard Worker
660*8975f5c5SAndroid Build Coastguard Worker* `spirv-cfg` - the control flow graph dumper
661*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>/tools/cfg`
662*8975f5c5SAndroid Build Coastguard Worker
663*8975f5c5SAndroid Build Coastguard Worker### Diff tool
664*8975f5c5SAndroid Build Coastguard Worker
665*8975f5c5SAndroid Build Coastguard Worker*Warning:* This functionality is under development, and is incomplete.
666*8975f5c5SAndroid Build Coastguard Worker
667*8975f5c5SAndroid Build Coastguard WorkerThe diff tool produces a diff-style comparison between two SPIR-V modules.
668*8975f5c5SAndroid Build Coastguard Worker
669*8975f5c5SAndroid Build Coastguard Worker* `spirv-diff` - the standalone diff tool
670*8975f5c5SAndroid Build Coastguard Worker  * `<spirv-dir>`/tools/diff`
671*8975f5c5SAndroid Build Coastguard Worker
672*8975f5c5SAndroid Build Coastguard Worker### Utility filters
673*8975f5c5SAndroid Build Coastguard Worker
674*8975f5c5SAndroid Build Coastguard Worker* `spirv-lesspipe.sh` - Automatically disassembles `.spv` binary files for the
675*8975f5c5SAndroid Build Coastguard Worker  `less` program, on compatible systems.  For example, set the `LESSOPEN`
676*8975f5c5SAndroid Build Coastguard Worker  environment variable as follows, assuming both `spirv-lesspipe.sh` and
677*8975f5c5SAndroid Build Coastguard Worker  `spirv-dis` are on your executable search path:
678*8975f5c5SAndroid Build Coastguard Worker  ```
679*8975f5c5SAndroid Build Coastguard Worker   export LESSOPEN='| spirv-lesspipe.sh "%s"'
680*8975f5c5SAndroid Build Coastguard Worker  ```
681*8975f5c5SAndroid Build Coastguard Worker  Then you page through a disassembled module as follows:
682*8975f5c5SAndroid Build Coastguard Worker  ```
683*8975f5c5SAndroid Build Coastguard Worker  less foo.spv
684*8975f5c5SAndroid Build Coastguard Worker  ```
685*8975f5c5SAndroid Build Coastguard Worker  * The `spirv-lesspipe.sh` script will pass through any extra arguments to
686*8975f5c5SAndroid Build Coastguard Worker    `spirv-dis`.  So, for example, you can turn off colours and friendly ID
687*8975f5c5SAndroid Build Coastguard Worker    naming as follows:
688*8975f5c5SAndroid Build Coastguard Worker    ```
689*8975f5c5SAndroid Build Coastguard Worker    export LESSOPEN='| spirv-lesspipe.sh "%s" --no-color --raw-id'
690*8975f5c5SAndroid Build Coastguard Worker    ```
691*8975f5c5SAndroid Build Coastguard Worker
692*8975f5c5SAndroid Build Coastguard Worker* [vim-spirv](https://github.com/kbenzie/vim-spirv) - A vim plugin which
693*8975f5c5SAndroid Build Coastguard Worker  supports automatic disassembly of `.spv` files using the `:edit` command and
694*8975f5c5SAndroid Build Coastguard Worker  assembly using the `:write` command. The plugin also provides additional
695*8975f5c5SAndroid Build Coastguard Worker  features which include; syntax highlighting; highlighting of all ID's matching
696*8975f5c5SAndroid Build Coastguard Worker  the ID under the cursor; and highlighting errors where the `Instruction`
697*8975f5c5SAndroid Build Coastguard Worker  operand of `OpExtInst` is used without an appropriate `OpExtInstImport`.
698*8975f5c5SAndroid Build Coastguard Worker
699*8975f5c5SAndroid Build Coastguard Worker* `50spirv-tools.el` - Automatically disassembles '.spv' binary files when
700*8975f5c5SAndroid Build Coastguard Worker  loaded into the emacs text editor, and re-assembles them when saved,
701*8975f5c5SAndroid Build Coastguard Worker  provided any modifications to the file are valid.  This functionality
702*8975f5c5SAndroid Build Coastguard Worker  must be explicitly requested by defining the symbol
703*8975f5c5SAndroid Build Coastguard Worker  SPIRV_TOOLS_INSTALL_EMACS_HELPERS as follows:
704*8975f5c5SAndroid Build Coastguard Worker  ```
705*8975f5c5SAndroid Build Coastguard Worker  cmake -DSPIRV_TOOLS_INSTALL_EMACS_HELPERS=true ...
706*8975f5c5SAndroid Build Coastguard Worker  ```
707*8975f5c5SAndroid Build Coastguard Worker
708*8975f5c5SAndroid Build Coastguard Worker  In addition, this helper is only installed if the directory /etc/emacs/site-start.d
709*8975f5c5SAndroid Build Coastguard Worker  exists, which is typically true if emacs is installed on the system.
710*8975f5c5SAndroid Build Coastguard Worker
711*8975f5c5SAndroid Build Coastguard Worker  Note that symbol IDs are not currently preserved through a load/edit/save operation.
712*8975f5c5SAndroid Build Coastguard Worker  This may change if the ability is added to spirv-as.
713*8975f5c5SAndroid Build Coastguard Worker
714*8975f5c5SAndroid Build Coastguard Worker
715*8975f5c5SAndroid Build Coastguard Worker### Tests
716*8975f5c5SAndroid Build Coastguard Worker
717*8975f5c5SAndroid Build Coastguard WorkerTests are only built when googletest is found.
718*8975f5c5SAndroid Build Coastguard Worker
719*8975f5c5SAndroid Build Coastguard Worker#### Running test with CMake
720*8975f5c5SAndroid Build Coastguard Worker
721*8975f5c5SAndroid Build Coastguard WorkerUse `ctest -j <num threads>` to run all the tests. To run tests using all threads:
722*8975f5c5SAndroid Build Coastguard Worker```shell
723*8975f5c5SAndroid Build Coastguard Workerctest -j$(nproc)
724*8975f5c5SAndroid Build Coastguard Worker```
725*8975f5c5SAndroid Build Coastguard Worker
726*8975f5c5SAndroid Build Coastguard WorkerTo run a single test target, use `ctest [-j <N>] -R <test regex>`. For example,
727*8975f5c5SAndroid Build Coastguard Workeryou can run all `opt` tests with:
728*8975f5c5SAndroid Build Coastguard Worker```shell
729*8975f5c5SAndroid Build Coastguard Workerctest -R 'spirv-tools-test_opt'
730*8975f5c5SAndroid Build Coastguard Worker```
731*8975f5c5SAndroid Build Coastguard Worker
732*8975f5c5SAndroid Build Coastguard Worker#### Running test with Bazel
733*8975f5c5SAndroid Build Coastguard Worker
734*8975f5c5SAndroid Build Coastguard WorkerUse `bazel test :all` to run all tests. This will run tests in parallel by default.
735*8975f5c5SAndroid Build Coastguard Worker
736*8975f5c5SAndroid Build Coastguard WorkerTo run a single test target, specify `:my_test_target` instead of `:all`. Test target
737*8975f5c5SAndroid Build Coastguard Workernames get printed when you run `bazel test :all`. For example, you can run
738*8975f5c5SAndroid Build Coastguard Worker`opt_def_use_test` with:
739*8975f5c5SAndroid Build Coastguard Worker
740*8975f5c5SAndroid Build Coastguard Workeron linux:
741*8975f5c5SAndroid Build Coastguard Worker```shell
742*8975f5c5SAndroid Build Coastguard Workerbazel test --cxxopt=-std=c++17 :opt_def_use_test
743*8975f5c5SAndroid Build Coastguard Worker```
744*8975f5c5SAndroid Build Coastguard Worker
745*8975f5c5SAndroid Build Coastguard Workeron windows:
746*8975f5c5SAndroid Build Coastguard Worker```shell
747*8975f5c5SAndroid Build Coastguard Workerbazel test --cxxopt=/std:c++17 :opt_def_use_test
748*8975f5c5SAndroid Build Coastguard Worker```
749*8975f5c5SAndroid Build Coastguard Worker
750*8975f5c5SAndroid Build Coastguard Worker## Future Work
751*8975f5c5SAndroid Build Coastguard Worker<a name="future"></a>
752*8975f5c5SAndroid Build Coastguard Worker
753*8975f5c5SAndroid Build Coastguard Worker_See the [projects pages](https://github.com/KhronosGroup/SPIRV-Tools/projects)
754*8975f5c5SAndroid Build Coastguard Workerfor more information._
755*8975f5c5SAndroid Build Coastguard Worker
756*8975f5c5SAndroid Build Coastguard Worker### Assembler and disassembler
757*8975f5c5SAndroid Build Coastguard Worker
758*8975f5c5SAndroid Build Coastguard Worker* The disassembler could emit helpful annotations in comments.  For example:
759*8975f5c5SAndroid Build Coastguard Worker  * Use variable name information from debug instructions to annotate
760*8975f5c5SAndroid Build Coastguard Worker    key operations on variables.
761*8975f5c5SAndroid Build Coastguard Worker  * Show control flow information by annotating `OpLabel` instructions with
762*8975f5c5SAndroid Build Coastguard Worker    that basic block's predecessors.
763*8975f5c5SAndroid Build Coastguard Worker* Error messages could be improved.
764*8975f5c5SAndroid Build Coastguard Worker
765*8975f5c5SAndroid Build Coastguard Worker### Validator
766*8975f5c5SAndroid Build Coastguard Worker
767*8975f5c5SAndroid Build Coastguard WorkerThis is a work in progress.
768*8975f5c5SAndroid Build Coastguard Worker
769*8975f5c5SAndroid Build Coastguard Worker### Linker
770*8975f5c5SAndroid Build Coastguard Worker
771*8975f5c5SAndroid Build Coastguard Worker* The linker could accept math transformations such as allowing MADs, or other
772*8975f5c5SAndroid Build Coastguard Worker  math flags passed at linking-time in OpenCL.
773*8975f5c5SAndroid Build Coastguard Worker* Linkage attributes can not be applied through a group.
774*8975f5c5SAndroid Build Coastguard Worker* Check decorations of linked functions attributes.
775*8975f5c5SAndroid Build Coastguard Worker* Remove dead instructions, such as OpName targeting imported symbols.
776*8975f5c5SAndroid Build Coastguard Worker
777*8975f5c5SAndroid Build Coastguard Worker## Licence
778*8975f5c5SAndroid Build Coastguard Worker<a name="license"></a>
779*8975f5c5SAndroid Build Coastguard WorkerFull license terms are in [LICENSE](LICENSE)
780*8975f5c5SAndroid Build Coastguard Worker```
781*8975f5c5SAndroid Build Coastguard WorkerCopyright (c) 2015-2016 The Khronos Group Inc.
782*8975f5c5SAndroid Build Coastguard Worker
783*8975f5c5SAndroid Build Coastguard WorkerLicensed under the Apache License, Version 2.0 (the "License");
784*8975f5c5SAndroid Build Coastguard Workeryou may not use this file except in compliance with the License.
785*8975f5c5SAndroid Build Coastguard WorkerYou may obtain a copy of the License at
786*8975f5c5SAndroid Build Coastguard Worker
787*8975f5c5SAndroid Build Coastguard Worker    http://www.apache.org/licenses/LICENSE-2.0
788*8975f5c5SAndroid Build Coastguard Worker
789*8975f5c5SAndroid Build Coastguard WorkerUnless required by applicable law or agreed to in writing, software
790*8975f5c5SAndroid Build Coastguard Workerdistributed under the License is distributed on an "AS IS" BASIS,
791*8975f5c5SAndroid Build Coastguard WorkerWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
792*8975f5c5SAndroid Build Coastguard WorkerSee the License for the specific language governing permissions and
793*8975f5c5SAndroid Build Coastguard Workerlimitations under the License.
794*8975f5c5SAndroid Build Coastguard Worker```
795*8975f5c5SAndroid Build Coastguard Worker
796*8975f5c5SAndroid Build Coastguard Worker[spirv-tools-cla]: https://cla-assistant.io/KhronosGroup/SPIRV-Tools
797*8975f5c5SAndroid Build Coastguard Worker[spirv-tools-projects]: https://github.com/KhronosGroup/SPIRV-Tools/projects
798*8975f5c5SAndroid Build Coastguard Worker[spirv-tools-mailing-list]: https://www.khronos.org/spir/spirv-tools-mailing-list
799*8975f5c5SAndroid Build Coastguard Worker[spirv-registry]: https://www.khronos.org/registry/spir-v/
800*8975f5c5SAndroid Build Coastguard Worker[spirv-headers]: https://github.com/KhronosGroup/SPIRV-Headers
801*8975f5c5SAndroid Build Coastguard Worker[googletest]: https://github.com/google/googletest
802*8975f5c5SAndroid Build Coastguard Worker[googletest-pull-612]: https://github.com/google/googletest/pull/612
803*8975f5c5SAndroid Build Coastguard Worker[googletest-issue-610]: https://github.com/google/googletest/issues/610
804*8975f5c5SAndroid Build Coastguard Worker[effcee]: https://github.com/google/effcee
805*8975f5c5SAndroid Build Coastguard Worker[re2]: https://github.com/google/re2
806*8975f5c5SAndroid Build Coastguard Worker[abseil-cpp]: https://github.com/abseil/abseil-cpp
807*8975f5c5SAndroid Build Coastguard Worker[CMake]: https://cmake.org/
808*8975f5c5SAndroid Build Coastguard Worker[cpp-style-guide]: https://google.github.io/styleguide/cppguide.html
809*8975f5c5SAndroid Build Coastguard Worker[clang-sanitizers]: http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
810