Android NDK r20 Beta 3 (build 5471264)
Merge remote-tracking branch 'aosp/upstream-master' into update-shaderc

Includes:
ad0232de Unify memory instruction validation style (#1934)
d3738be3 Update CHANGES
4b4bd4c5 Validator: Validate OpImageTexelPointer (#487)
a78fa097 Set the C++ version to C++11 (#1933)
80564a56 Keep analyses live in unrolling (#1929)
1225324a VK_KHR_shader_atomic_int64 covers OpAtomic{Load|Store}
45784eb2 Remove use of SetContextMessageConsumer from binary_parse_test (#1925)
026309ab Validator: OpGroupNonUniformBallotBitCount validation (#1486)
bfcdc913 [ci] Checkout a specific Google Test commit (#1931)
b07993eb Remove SetContextMessageConsumer from markv_codec_test (#1926)
7249506b Remove stats use of internal API (#1924)
0e5fc7d7 Allow 0 as argument to scalar replacement. (#1917)
903514f9 Roll DEPS for spirv-headers (#1920)
b85fb4a3 Get KillNameAndDecorates to handle group decorations. (#1919)
90a12b3d Decoration validation for Vulkan memory model
14921113 Validate vulkan mem model capabilty
575af7ec [kokoro] Add test job for disabling effcee (#1911)
9bfe0eb2 Wrap tests needing effcee inside SPIRV_EFFCEE
6e2dab2f Add support for Nvidia Turing extensions
9fbcce4c Add unrolling to the legalization passes (#1903)
9e99d8b6 Specified clang-format version in README.md
0cd3e599 Validator: correct out of bound check for OpMemberDecorate (#1881)
7f0a8877 Move the registration of decorations. (#1895)
7075c499 Add dummy loop in merge-return. (#1896)
5f599e70 Fix infinite loop in dead-branch-elimination (#1891)
4a463226 Add IR dumping functions to use during debugging.
63265097 Add support for VK_KHR_shader_atomic_int64 in validator
6d5f1bc2 Allow merge blocks to merge two header blocks in some cases. (#1890)
0f4c772e Respect --skip-validation in spirv-opt (#1887)
324be76b Fixup BUILD.gn file (#1886)
2c2fee79 Validator: check OpTypeBool inside Blocks (#1405)
75c1bf28 Add option for the max id bound. (#1870)
f62d7978 Add validation check for arrays of void type. (#1880)
40a68547 Roll spirv-headers in DEPS (#1884)
3e38c99f Start SPIRV-Toosl v2018.6-dev
b4cb01c7 Finalize SPIRV-Tools v2018.5
03896b05 Update CHANGES
7600fc0e Update Dim capabilities
571251c8 Support SPV_KHR_vulkan_memory_model rev2
21bcb9d8 BUILD.gn: Make a better interface with dependents. (#1877)
b27d084b Revert "BUILD.gn: Make a better interface with dependents. (#1875)" (#1876)
3cddf913 BUILD.gn: Make a better interface with dependents. (#1875)
58e53ea8 Fix sign mismatch warning
cb0f1f56 Remove struct member offset monotonicity check
482b1744 Validate all type ids. (#1868)
06b42949 Validate uses of OpTypeFunction. (#1867)
d94a2077 Remove idUsage
416b1ab4 Have the constant manager take ownership of constants. (#1866)
47ee776a Revert "Have the constant manager take ownership of constants."
b938b74b Have the constant manager take ownership of constants.
d746681f Copy decorations when creating new ids. (#1843)
6d27a835 Fixing instances of iteration over unordered containers
b4d3618f Don't "break" from selection constructs. (#1862)
6c73b1fb Update the order when predicating blocks. (#1859)
7f4e09ab spirv-as: Fix error in help text.
c5b38062 Moving constant opcode validation into a new file
8bed4462 [kokoro] Stop building and running tests for VS2013 (#1852)
d91d34e1 Fix VS2013 build break. (#1853)
19264ef4 Have PredicateBlocks jump the existing merge blocks. (#1849)
197b4597 Fix EvalInt32IfConst to fail on type instructions.
d693a83e Handle breaks from structured-ifs in DCE. (#1848)
45c235d4 Have dead-branch-elim handle conditional exits from selections. (#1850)
87f36363 Ignore *.pyc files in git commands.
03000a3a Add testing framework for tools.
1bdade77 Add GN rules to build spriv-as (#1842)
36d675a4 Change when instruction is registered in validator. (#1840)
e065cc20 Keep decorations when replacing loads in access-chain-convert. (#1829)
ef678672 Remove source/message.h (#1838)
1963a2db Use MakeUnique. (#1837)
1553025f Move make_unique to source/util. (#1836)
bf24d9b4 Don't copy decorations twice when rebuilding a type. (#1835)
8cb949ad Validate correct opcode uses of OpFunction
5fc011b4 Move bit_stream, move_to_front and huffman_codec. (#1833)
ce4547bd Disallow void types in structs (#1832)
e7fdcdba Split function opcode validation into new files.
967bfa2d Remove unused stats maps and parameters (#1828)
397e0244 Fixing heap overflow in validation.
bcb0b693 Reenable --skip-validation. (#1820)
da0f1dcc Move spirv_stats into tools/stats. (#1826)
6cd4441c Move cfg opcode validation to another file.
70de4a35 Remove codegen related code. (#1819)
b6319c3a Split MarkV into multiple files (#1809)
714bf84e Split mode setting opcode validation into new file.
7d4b0464 Split annotation opcode validation into new file.
983f8f02 Replace asserts with returns
ca7278cf Split debug opcode validation into new file
f2a99002 Move type instruction validation into separate file
5c8b4f5a Validate the input to Optimizer::Run (#1799)
3a20879f Unify validation of OpCopyMemory*
2896b8f0 Refactor where opcodes are validated
6fea4023 When clang is used as a MSVC frontend (clang-cl.exe) it does not behave exactly as GCC would. I.e. -Wall translates to /Wall, which is an alias for -Weverything. This causes massive C++98 compat warnings logspam. (#1808)
508df9a3 Remove unused bit stream methods. (#1807)
e3ea909e Simplify MoveToFront (#1806)
05057c98 Fixup readabilty/inheritance warnings (#1805)
9991d661 Fix readbility/braces warnings (#1804)
eda2cfbe Cleanup includes. (#1795)
2d9a3252 Refactor BUILD.gn so can easily be embedded in other projects
c8e7bb1d Fixup Wno-self-assign warning (#1796)
7861df9b Remove using namespace commands. (#1794)
58a6876c Rewrite include guards (#1793)
aa53271b Script to fixup fuzzer results (#1792)
d38a0a3b Validation within function body when doing a FunctionCall. (#1790)
6aa8a594 Simplify validation ProcessInstruction (#1786)
de9496e9 Add more fuzzers for Optimizer. (#1788)
e323529d Register passes in the spirv-opt fuzzer. (#1785)
1946fb4d Remove ValidateInstructionAndUpdateValidationState (#1784)
ce644d4a Update OpPhi instructions after splitting block. (#1783)
53afb3b7 Combine ordered_instruction loops in validation. (#1782)
c9cd73b3  Remove instruction_counter from ValidationState. (#1781)
d49bedca Move memory class instructions to new pass
a5a5ea0e Remove using std::<foo> statements. (#1756)
ebd6c75a Remove diag() overloads. (#1776)
a97c1d91 Fixup BUILD.gn to use a group for SPIRV-Tools (#1779)
aa81e62c Update diag() calls in validate_capability. (#1759)
c8c724cb Don't change decorations and names in merge return. (#1777)
ab061afc Update diag() calls in validate_type_unique. (#1775)
78335c92 Update diag() calls in validate_primitives. (#1774)
6bb9ab48 Update diag() calls in validate_non_uniform. (#1773)
7c9a73fc Update diag() calls in validate_logicals. (#1772)
72766d9e Update diag() calls in validate_literals. (#1771)
e1e20f1a Update diag() calls in validate_layout. (#1770)
f37e8d74 Update diag() call in validate_interface. (#1769)
d792ccd1 Update diag() calls in validate_instruction. (#1768)
176cb5e5 Update diag() calls in validate_image. (#1767)
c64bad70 Update diag() calls in validate_ext_inst. (#1766)
441c0190 Update diag() calls in validate_derivatives. (#1765)
83b7f2b6 Update diag() calls in validate_decorations. (#1764)
a504656d Remove std::deque in favour of std::vector. (#1755)
fae987b4 Update diag() calls in validate_datarules. (#1763)
0d8156ac Update CHANGES
5a59a06e Update diag() calls in validate_conversion. (#1762)
eb03b152 Update diag() calls in validate_composites. (#1761)
2c5f1b01 Update diag() calls in validate_cfg. (#1760)
3619de9a Update diag() use in validate_builtin. (#1758)
12c1f2b6 Update diag() usage in validate_bitwise. (#1757)
11193353 Update diag() in validate_barriers (#1754)
32ccf0d0 Update diag() in validate_atomics (#1753)
a4fe771d Pass the instruction to diag in arithmetic validation (#1752)
dfb53f9f Fix disassembly line for adjacency validations. (#1751)
b7afe4e7 Switch validate to use explicit diag() method. (#1750)
a9d8fcee Change ValidationState::diag to accept an Instruction. (#1749)
755e5c94 Transform to combine consecutive access chains
8a0ec22f Fix bug determining next arg
89901a8a Wrap entire timer.cpp in SPIRV_TIMER_ENABLED.
f28ed82f Make sure all instructions are in the ordered list.
dcea11fa Update error messages in validate_composites. (#1743)
dcb0dc21 Split ImagePass into individual methods. (#1742)
673483d6 Move OpVectorShuffle check into validate_composites (#1741)
ee22928b Move CompositePass code into methods. (#1740)
fc2a719c Wrap bin group in conditional for BUILD.gn (#1738)
99fe61e7 Add API to create passes out of a list of command-line flags.
a114e1f3 Add support for Chromium GN build
b49f76fd Handle undef literal value in vector shuffle
effafedc Replace opt::Instruction type and result cache with flags. (#1718)
3c196517 Add variable pointer support to IsValidBasePointer
28199b80 Fix block ordering in dead branch elim
ba40400c Don't check exports on Darwin
85d37157 Update CHANGES
8c7dab5c Fixup line number for OpVectorShuffle ID error.
208921ef Fix finding constant with particular type. (#1724)
95b4d47e Fix infinite loop while folding OpVectorShuffle (#1722)
63c1d8fb Fix size error when folding vector shuffle. (#1721)
7603944a Remove dead code (#1720)
c7da51a0 Cleanup extraneous namespace qualifies in source/opt. (#1716)
e477e757 Remove the module from opt::Function. (#1717)
3ded745f Cleanup CFG header. (#1715)
6803e42b Cleanup some pass code to get context directly. (#1714)
a5e4a532 Remove context() method from opt::Function (#1700)
4cc6cd18 Pass the IRContext into the folding rules. (#1709)
f96b7f1c use Pass::Run to set the context on each pass. (#1708)
4db9c789 Add option to skip verifying block layout
aee809d5 Update the check-format bot. (#1710)
e63551de Add folding rule to merge a vector shuffle feeding another one.
4470ff49 Update CHANGES
2c6185e6 Enforce block layout rules even when relaxed
c02d2166 Update docs to reflect new bot status.
e70a4126 Move validation files to val/ directory (#1692)
2cce2c5b Move tests into namespaces (#1689)
7d6c90c9 Reopen stdin for binary as needed
fec6315f Vulkan permits non-monotonic offsets for block members
eb48263c Description for Android build
ead54bbd Use spv_result_t instead of bool
6e550f41 Disable Travis bots, and Appveyor Release bots.
cbdbbe9a Fix up code to make ClangTidy happy.
84846b7e Cleanup whitespace lint warnings. (#1690)
9532aede Fix unused param errors when Effcee not present
a3e38695 Convert validation to use libspriv::Instruction where possible. (#1663)
43144e36 Move the validation code into the val:: namespace (#1682)
48326d44 Move link/ code to anonymous namespace (#1679)
e6b95336 Move the ir namespace to opt. (#1680)
50312ca1 Start SPIRV-Tools v2018.5-dev
f508896d Finalize SPIRV-Tools v2018.4
9de00c95 Update CHANGES
3dad1cda Change libspirv to spvtools namespace (#1678)
76e0bde1 Move utils/ to spvtools::utils
9836b05a Move comp code into comp namespace
5e0276bd validator: use RowMajor, ArrayStride, MatrixStride
1a283f41 Layout validation: Permit {vec3; float} tight packing
9795137c Enable Kokoro buildbots. (#1625)
c460f44f Add a check for invalid exits from case construct.
fa78d3be Update SPIRV-Headers
a0694990 Fix layout checks for StorageBuffer and PushConstant storage classes
a45d4cac Move folding routines into a class
9ecbcf5f Make sure the constant folder get the correct type.
101a9bcb Add private to local to optimization and size passes.
4926f295 Let symbol export tests respect SPIRV_SKIP_TESTS
30a9cefa Support SPV_KHR_8bit_storage
51091045 Produce better error diagnostics in the CFG validation. (#1660)
465f2815 Revert change and stop running remove duplicates.
2eb9bfb5 Remove stores of undef.
b67beca7 GLSL.std.450 Refract Eta can be any float scalar
7cc9f362 Add test for CFG alteration by compact IDs
4717d24e Fix assert during compact IDs pass (#1649)
878b3b40 check_symbol_exports on Python3, Mac
f393b0e4 Don't merge types of resources
c2e3e67c validator: Fix storage buffer layout message
8ecd833d Block-decorated structs must list members in offset-order
29923409 Add validation for structs decorated as Block or BufferBlock.
0d43e10b Use type id when looking up vector type
4d99fcba Validator test: artificially lower limit on local var limit
18540643 Setup gclient and presubmit file.
ba602c90 Add a WIP WebGPU environment. It disallows OpUndef
e7ace1b2 Add Vulkan 1.1 capability sets
8d65c896 Instruction lookup succeeds if it's enabled by a capability
f80696ea [val] Add extra context to error messages. (#1600)
356193ea Reland "Disallow array-of-arrays with DescriptorSets when validating. (#1586)" (#1621)
c4304ea0 Reland "Disallow array-of-arrays with DescriptorSets when validating. (#1586)"
d3ed9982 Validate Ids before DataRules. (#1622)
ea7239fa Structured switch checks
4f866abf Validate static uses of interfaces
b49cbf09 Fix buffer read overrun in linker
1f7b1f1b Small vector optimization for operands.
700ebd34 Make fewer test executables
363bfca2 Operand lookup succeeds if it's enabled by a capability
06de8686 Check for invalid branches into construct body.
035afb89 Update CHANGES
63c9bba5 [val] Output id names along with numbers in validate_id (#1601)
f2c93c6e Revert "Disallow array-of-arrays with DescriptorSets when validating. (#1586)" (#1607)
e3f1f3bd Disallow array-of-arrays with DescriptorSets when validating. (#1586)
a1f9e134 Preserve inst-to-block and def-use in passes.
fe2fbee2 Delete the insert-extract-elim pass.
9a008835 Add store for var initializer in inlining.
badcf73d Allow duplicate pointer types
93c4c184 Handle types with self references.
6b83643c Start v2018.4-dev
545d6ca2 Finalize v2018.3
6a986d02 Update CHANGES
745dd00a Fold FMix feeding Extract, and use the simplification pass.
f765d16b Add external interface for creating a pass token
0a14a1f7 Validate that only a single OpMemoryModel is provided.
3b87dac5 Validate presence of OpMemoryModel.
a579e720 Remove the limit on struct size in SROA.
f1f7cc87 Get ADCE to handle OpCopyMemory
b09e3ce8 Allow ViewportIndex & Layer to be used in VS/DS with extension
9b1a938e SROA: Only create symbols that are loaded.
0e1b7e5a Fix getting operand without checking opcode.
efcc33e8 Support SpvOpExecutionModeId in SPIR-V logical layout
18ad1be7 Fixing MacOS compiler error
f46f2d3e Remove redundant stores.
af430ec8 Add pass to fold a load feeding an extract.
804e8884 Fold fclamp feeding compare.
e9cda702 Adjust tests according to grammar change
9ec3f81e Remove dead Workgroup variables in ADCE.
0856997d Allow ADCE to remove more instructions.
7d016431 Allow hoisting code in if-conversion.
1c2cbaf5 Add GetContinueBlock to loop class.
70bb3c1c Fold divide and multiply by same value.
98434847 Fix build.
1dc24580 Add a loop fusion pass.
9a5dd6fe Support loop fission.
9ba0879d Improve Vector DCE
a00a0a09 Revert "Improvements to vector dce."
4246abdc Fixes handling of kill and unreachable ops in inlining.
e1bcd2b2 Fold OpVectorTimesScalar and OpPhi better.
28137229 Improvements to vector dce.
72524db2 Fixes #1521: PadToWord() should use std::move() in && variant
268be614 LocalSingleBlockElim: Add store-store elimination
ee8cd5c8 Add Dead insert elmination back in.
2c0ce872 Vector DCE (#1512)
7a592835 Another fix for old XCode: std::set explicit ctor in test code
efc50619 Dominator analysis interface clean.
48802bad Constant folding for OpVectorTimesScalar
0ec08c28 Add register liveness analysis.
09c206b6 Fixes #1480. Validate group non-uniform scopes.
e7c2e91d Fix for old XCode: std::set has explicit ctor
1c89da46 Test/DependencyAnalysis: Fix uninitialized variables
df7f00f6 DeadInsertElim: Don't revisit select phi nodes during MarkInsertChain
430a2933 Fix broken pointer of CommonUniformElimPass
c20a718e Rewrite local-single-store-elim to not create large data structures.
0fa42996 Merge pull request #1461 from jaebaek/fnegate
3c5bd266 Typo
0f335cf8 Add support for MIV and Delta test dependence analysis.
ff92339f Format
d8b9306a Add more unit tests
79491259 Add constant folding for FNegate
38359ba8 Fixes #1483. Validating Vulkan 1.1 barrier execution scopes
152b9a68 ADCE: Remove OpDecorateStringGOOGLE
0e80b86d Fixes #1472. Per-vertex variable validation fixes.
7fe18647 Fix validation issues relevant to SPV_AMD_gpu_shader_int16.
a3bb7827 Travis CI: change to use the default email notification behavior
e8814be7 Add validator test for OpBranch
d42f65e7 Use a bit vector in ADCE
8190c262 Change parameter to Mempass::RemovePhiOperands
e805d1f8 Fixes #1469. Allow subgroup memory scope for Vulkan 1.1
c3ee2105 Fixes #1471. Adds missing environments to spriv-val help
c522b697 Fixes #1470. Don't restrict WGS storage class
bc648fd7 Delete unused code in MemPass
c584ac4f Don't allow an instance of a pass to be run multiple times.
10e5d7cf Add a loop peeling pass.
61b50b3b ZIV and SIV loop dependence analysis.
53bc1623 Fold OpDot
3020104f Adding tests for OpenCL 1.2 and embedded profiles
42840d15 Fixes #1433. Validate binary version
26a698c3 Fix PrimitiveId builtin check for Vulkan
5f53c42a Update CHANGES
a91cbfbf Optimizer: update extension whitelists
6fbfe1c0 Fix SSA rewrite for nested loops.
e025145c Test asm/dis support for SPV_EXT_descriptor_indexing
6f80608b Test asm/dis support for SPV_NV_shader_subgroup_partitioned
e66e305b Re-enabled checks for UConvert
caf7da87 linker: Properly remove FuncParamAttr from imported symbols
082b8b08 More automatic extension support
43ca2112 Stop asking for extensions if feature avaiable in core SPIR-V
d7fff408 Fix bug validate_builtins (additional def checks)
691eed92 Fix major bug in validate_builtins
da332cf3 Execution mode/model available in validation state
74245496 OpName and decorations should not stop array copy prop.
7c5d49bf Teach ADCE about OpImageTexelPointer
c33af632 Teach array copy propagation about OpImageTexelPointer.
e64a4656 Teach the private to local about OpImageTexelPointer.
efb41541 Add SPV_NV_shader_subgroup_partitioned to EXTENSIONS_FROM_SPIRV_REGISTRY
57a24417 hex_float: Use max_digits10 for the float precision
6dd5e955 Add missing function parameters in libspirv.h
fc9f621e Add missing <iterator> header for std::back_inserter
ddbaf324 Use standard SPIR-V version scheme for version requirement
cbceecea In copy-prop-arrays, indentify copies via OpCompositeInsert
d8ca0982 Handle non-constant accesses in memory objects (copy prop arrays)
ad7e4b84 Initial patch for scalar evolution analysis
c26866ee Preserve analyses after copy propagate arrays
0a2ee65f Fixes #1403.
97c8fdcc Adding OpPhi validation rules.
95843d7b New spirv-1.3 rules for control barrier
5e07ab13 Handle more cases in copy propagate arrays.
c4dc0463 Copy propagate arrays
0a8b6a96 Replace an undefined double->float cast with infinity.
9cf87ecb Add Vulkan specific atomic result type restriction
fe9121f7 Add Vulkan validation rules for BuiltIn variables
045cc8f7 Fixes compile errors generated with -Wpedantic
dbb35c42 Fixed remaining review comments from #1380
2e644e45 Fix VS2013 build failures.
3b594e16 Add --time-report to spirv-opt
735d8a57 SSA rewrite pass.
bdf421cf Add loop peeling utility
b3daa93b Change merge return pass to handle structured cfg.
1ef6b192 Migrate to use unified grammar tables
844e186c Add --strip-reflect pass
2e3aec23 Add recent Google extensions to optimizer whitelists
9f3a1c85 NFC: Speed up dead insert phi traversal on Windows.
88493336 Teach DecorationManager about OpDecorateStringGOOGLE
7e03e76a Fixes #1402. Don't merge non-branch terminators into loop header.
43d16091 Fixes #1407. Removing assertion against void pointer
4065adf0 Fixes #1404. Don't DCE workgroup size
077249b6 Fix InsertFeedingExtract rule when extract remains.
5bd55f10 Reimplement the DecorationManager
340370ed Remove extension whitelist from some transforms
314cfa29 Add missing SPV extension strings
ac434668 Start v2018.3 development
8d8a7127 Finalize v2018.2
a0da44ef Update CHANGES
bc9cfee6 Fixes #1385. Grab correct input to calculate indices.
03b8a3fe AMD_gpu_shader_half_float enables float16
01f32ee0 Update README for SPIR-V 1.3
00fa3931 Support SPIR-V 1.3 and Vulkan 1.1
5f50e620 Fixes #1376. Don't handle half folding gracefully.
5f69f751 Support SPV_GOOGLE_decorate_string and SPV_GOOGLE_hlsl_functionality1
9ba50e34 Avoid generating duplicate names when merging types
6cd6e5eb Define Disassemble only when Effcee is used in fold_test
a942ff40 Android.mk: Generate enum mappings from unified1 grammar
fe219216 Start v2018.2 development
6432a129 Finalize v2018.1
52bceb35 Handles more cases of redundant selects
a7cec784 Update CHANGES
82462576 Fixes #1361. Mark all non-constant global values as varying in CCP
8b27ba83 Vulkan BuiltIn variables can't have Location/Component decorations
ce5941a6 Fixes #1357. Support null constants better in folding
bdaf8d56 Opt: Add constant folding for FToI and IToF
9457cabb Fixes #1354. Do not merge integer division.
588f4fcc Add more folding rules for vector shuffle.
90e1637c Remove Function::GetBlocks pushed by accident
2cb589cc Remove uses DCEInst and call ADCE
0c134671 Consistently include latest spirv.h header file.
802cf053 Merge arithmetic with non-trivial constant operands
20b8cdb7 Make IR builder use the type manager for constants
9394272c linker: merge debug annotations from category c)
bdd6617f linker: Allow modules to be partially linked
64298bfd tools/linker: Allow setting --verify-ids on the command line
b08b94ec Update CHANGES
3497a944 Add loop unswitch pass.
e354984b Unroller support for multiple induction variables
94af58a3 Clean up variables before sroa
3f19c203 Preserve analysies in the simplification pass
432dc404 Appveyor: remove VS2015 configuration to reduce build time
46a9ec9d Opt: Check for side-effects in DCEInst()
01760d2f Fixes #1338. Handle OpConstantNull in branch/switch conditions
51ecc731 Reduce instruction create and deletion during inlining.
c1b93663 Add Insert-extract elimination back into legalization passes.
309be423 Add folding for redundant add/sub/mul/div/mix operations
fa3ac3cc Revert "Preserve analysies in the simplification pass"
ec3bbf09 Preserve analysies in the simplification pass
6c750501 Speed up Phi insertion.
ac9ab0da Travis: require MacOS to build and test again
9d95a91a Fix folding insert feeding extract
c3f34d8b Fixes #1300. Adding checks for bad CCP transitions and unsettled values
e543b195 Removed warnings from hex_float.h
04cd63e5 Make better use of simplification pass
10544136 Add constant folding rules for floating-point comparison
27d23a92 Remove constants from constant manager in KillInst
50f307f8 Simplify OpPhi instructions referencing unreachable continues
3756b387 Get CCP to use the constant floating point rules.
efe286cd SubgroupBallotKHR can enable SubgroupSize & SubgroupLocalInvocationId
5d442fad fix typo
d2c0fce3 Invoke cmake via CMAKE_COMMAND variable
f3a10470 Avoid using static unordered_map (#1304)
32a8e04c Add folding of redundant OpSelect insns
0e9f2f94 Add id to name map
6669d816 Fold binary floating point operators.
dd8400e1 Initial support for loop unrolling.
229ebc06 Fixes #1295. Mark undef values as varying in ccp.
08699920 Cleanup.  Use proper #include guard.  NFC.
06b437de Avoid using the def-use manager during inlining.
70bf3514 Fix spirv.h include to rely on include paths
1d7b1423 Add folding of OpCompositeExtract and OpConstantComposite constant instructions.
88685915 Fix generation of Vim syntax file
4e4a254b Do not hardcode libdir and includedir in pkg config files
1a849ffb Add header files missing from CMakeLists.txt
84ccd0b9 Loop invariant code motion initial implementation
ca4457b4 SROA: Do replacement on structs with no partial references.
06cdb969 Make use of the instruction folder.
a61e4c13 Disable check which fails Vulkan CTS
2f0c3aaa Add Vulkan-specific validation rules for atomics
30138975 Build SPIRV-Tools as shared library
b1c9c4e8 Enable Visual Studio 2013 again
e7fafdaa Fix test inclusion when Effcee is absent
c452bfd0 Update CHANGES
87102277 Registering a type now rebuilds it out of memory owned by the manager.
860b2ee5 ADCE: Fix combinator initialization
9e19fc0f VS2013: LoopDescriptor LoopContainerType can't contain unique_ptr
12e6860d Add barrier instructions validation pass
3ef4bb60 Avoid vector copies in range-for loops in opt/types.cpp
87f9cfab Disambiguate between const and nonconst ForEachSuccessorLabel
bc1ec941 Add general folding infrastructure.
1c0056c3 Start v2018.1-dev
c430a41a Finalize v2018.0
bcd4f239 Update CHANGES
abe11321 Reordering performance passes ordering to produce better opts
50e85c86 Add LoopUtils class to gather some loop transformation support.
61d8c038 Add pass to reaplce invalid opcodes
d37869c8 Added OpenCL ExtInst validation rules
cd68f2b1 Add adjacency validation pass
905536c5 Fixed harmless uninit var warning
ac537c71 Use SPIR-V headers from "unified1" directory
2735e085 Remove constexpr from Analysis operators
0aa0ac52 Opt: Add ScalarReplacement to RegisterSizePasses
44d88c8d Add memory semantics checks to validate atomics
38f297c1 Update CHANGES
16949236 Prevent unnecessary changes to the IR in dead branch elim
c86cb76a Improved error message in val capabilities
e661da79 Enhancements to block merging
6704233d Fix dereference of possibly nullptr
f28b1061 InsertExtractElim: Split out DeadInsertElim as separate pass
1b46f7ec Fixes in CCP for #1228
6018de81 Add LoopDescriptor as an IRContext analysis.
684997eb DeadInsertElim: Detect and DCE dead Inserts
2e93e806 Initial implementation of if conversion
b2eb8404 Validator: restricted some atomic ops for shaders
bdc78377 Added Vulkan-specifc checks to image validation
c4835e1b Use id_map in Fold*ToConstant
6c409e30 Add generic folding function and use in CCP
3b780db7 Fixes infinite loop in ADCE
cf3b2a58 Introduce an instruction builder helper class.
73940aba Simplifying code for adding instructions to worklist
34d4294c Create a pass to work around a driver bug related to OpUnreachable.
18618061 Adding testcase for #1210
0b1372a8 CFG: force the creation of a predecessor entry for all basic block.
3604c0b7 spirv-dis: Add --color option to force color disassembly
5e70d20d Fixing missing early exit from break identification
80b743a5 Adding support for switch removal in ADCE
3a0eb44d Capturing value table by reference in local redundancy elim
ae6daeed Update CHANGES
5ffe862f Fixes missing increment in common uniform elim
6cc772c3 Skip SpecConstants in CCP.
ba017f79 Update CHANGES
c2aadb02 Add MatrixConstant
8cb0aec7 Remove redundant passes from legalization passes
6587d3f8 Adding early exit versions of several ForEach* methods
24f99470 Move initialization of the const mgr to the constructor.
86dec646 Start v2018.0-dev
902ed46f Finalize v2017.3
672494da Adding ostream operators for IR structures
eb0c73da Maintain instruction to block mapping in phi insertion
5eafc00a InsertExtractElim: Optimize through VectorShuffle, Mix
1ebd860d Add generic folding function and use in CCP
3a054e1d Adding additional functionality to ADCE.
d54a286c Fix validation rules for GLSL pack/unpack 2x32
1b6cfd34 Rewriting dead branch elimination.
e5560d64 Fix constant propagation of induction variables.
a82a0ea8 Fix method comment for BasicBlock::MegeBlockIdIfAny
44f27f92 Allow relaxing validation of pointers in logical addressing mode
e8ad02f3 Add loop descriptors and some required dominator tree extensions.
6e9ea2e5 AnalyzeInstUse: Reuse the instruction lookup
3fbbd3c7 Remove CCP from size and performance recipes, pending bugfixes
7183ad52 Linker code cleanups
ccb921dd Allow getting the base pointer of an image load/store.
716718a5 Fix infinite simulation cycles in SSA propagator.
120ddffb Ignore clang-format-diff.py from copyrights check
ac9a828e dead branch elim: Track killed backedges
c32e79ee Add --print-all optimizer option
702852bd Opt: Make DecorationManager::HaveTheSameDecorations symmetric
a376b197 Validator checks out of bounds composite access
5b52626e Address review comments from https://github.com/KhronosGroup/SPIRV-Tools/pull/985.
7834beea Update legalization passes
e8f2890c Replace calls to `ToNop` by `KillInst`.
5f100789 Handle execution termination instructions when building edges.
135150a1 Do not insert Phi nodes in CCP propagator.
25d396b4 Add ExtInst validation pass (GLSL only for now)
226f263c Test: Fix linux/gcc defined-but-not-used warnings/errors
b185a3d8 utils/generate_grammar_tables.py: use spaces for indentation
1acce992 Fix https://github.com/KhronosGroup/SPIRV-Tools/issues/1130
a91aa538 Disallow Dim=SubpassData for OpImageSparseRead
59de6100 Add asm, dis support for DebugInfo extended instruction set
a27d673c CONTRIBUTING: If you fixed a bug, say so
4ba9dcc8 Implement SSA CCP (SSA Conditional Constant Propagation).
756b277f Store all enabled capabilities in the feature manger.
8e0051c7 Update CHANGES
1ab8ad65 Fixing bugs in type manager memory management
7505d242 Update the legalization passes.
c9a881ec Make a string parameter const ref
88409b72 Fix CHANGES: there is no OpImageSparseWrite
2e5672dc Update CHANGES for recent changes
424f744d Opt: Fix implementation and comment of AreDecorationsTheSame Target should not be ignored when comparing decorations in RemoveDuplicates Opt: Remove unused code in RemoveDuplicateDecorations
79a00649 Allow pointers to pointers in logical addressing mode.
b86eb684 Convert private variables to function scope.
8135dd63 More validation on primitive instructions
4dbcef62 validate & test of literal's upper bits
f3596358 Opt: Remove commented out duplicated type_id function
0d8ea486 Fix comment in primitives validation
dbc3a662 Image Operand Sample allows sparse image opcodes
8c050125 Export a config file for pkg-config
0dbe184d Remove concept of FIRST_CONCRETE_* operand types
61690850 Improving the usability of the type manager. The type manager hashes types. This allows the lookup of type declaration ids from arbitrarily constructed types. Users should be cautious when dealing with non-unique types (structs and potentially pointers) to get the exact id if necessary.
73610340 Start v2017.3-dev
1ccfb580 Finalize v2017.2
0f804063 ADCE: Only mark true breaks and continues of live loops
cdfbf26c Add primitive instruction validation pass
af7d5799 Refactor include of latest spir-v header versions
532b327d Add validation rules for atomic instructions
853a3d6c Fix uninitialized warning at -Os.
22faa2b0 ADCE: Empty Loop Elimination
07ce16d1 Set the parent for basic blocks during inlining.
2fc1221c Appveyor: stop testing on VS 2013
c520d436 Add validator checks for sparse image opcodes
12447d84 Support OpenCL 1.2 and 2.0 target environments
059fe082 AppVeyor: Put VS 2017 first
7ba59ac8 Force gtest to expose ::testing::Combine
dbd8d0e7 Reenable OpCopyObject validation rules
867451f4 Add scalar replacement
78c025ab MultiStore: Support OpVariable Initialization
70f88f52 Add external/SPIRV-Headers to .gitignore
c6fdf68c SingleStore: Support OpVariable Initialization
a05ad01e Add option to spirv-opt to skip the validator.
241dcacc Add a new constant manager class.
5d602abd Add global redundancy elimination
851e1ad9 Kill names and decoration in inlining.
731d1899 Add depth first iterator for trees
0c2396d2 Revert extraneous changes from commit 8ec62deb2.
8ba68fa9 Dominator Tree Analysis (#3)
692a22c5 Sort flags in help message - NFC.
b93c066b CMake: allow both SPIRV-Headers and spirv-headers
94e3e7b8 Add composite instruction validation pass
3b6c4f15 Do not zip and deploy for check formatting
adb93965 Go back to root directory
235ef345 Travis CI: add clang-format check
1af6c4ad Update .appveyor.yml
bf184310 Fix some of the known issues in image validation
fd3a2204 DCEInst kill the same instruction twice.
726573a0 Change Release builds to Release with debug info on Linux
e9ecc0cb Remove cfg_ field from SSAPropagator class - NFC.
65046eca Change IRContext::KillInst to delete instructions.
b35b52f9 Compute value number when the value table is constructed.
b98254b2 Fixed typo that leaked to the binary
9996173f Add simplified instructions for pushing a reviewed PR.
22582faf Travis: mark MacOS builds as optional
2885c65d Re-format CONTRIBUTING.md - NFC.
0dd4ee27 Fix Dref type check in validator
b8aeab82 Appveyor: use ninja instead of MSBuild
69043963 Opt: Remove unused lambda captures
13795353 Support outputting ANSI color escape sequences in library
188cd378 Erase decorations removed from internal collections
3c2e4c7d Fix validation of group ops in SPV_AMD_shader_ballot
8cfa0c40 Fix #1034 - Give Edge::operator<() weak ordering semantics.
e1ceff9f Validate OpTypeImage and OpTypeSampleImage
4c58086c Linker: Fix incorrect exit status.
d78e11cc Create CONTRIBUTING.md
8dd3d93c AggressiveDCE: Add merge and continue branches for live loop.
5f2589fd Update README about the automatic master-tot relase
9f20799f Convert the CFG to an on-demand analysis - NFC.
8ffed974 Fix windows build. unsigned vs signed comparison in EXPECT_EQ.
74327845 Generic value propagation engine.
491b112f Fix windows build.
83228137 Re-format source tree - NFC.
d8b2013e Derivative opcodes require Fragment exec model
c170afd9 Relaxed OpImageWrite texel type check
e1a6f8d1 Update CHANGES to mention fixes for 1007 and 1009
f84f2669 Relaxed OpImageRead validation rules
0cae89e7 Notify the context of instructions that are being erased.
3e08a3f7 Add validation checks for Execution Model
d9129f00 Test for pollution of the global namespace
0b1cb27f Remove derivative instructions from the list of combinators.
b0a70378 Start v2017.2-dev
493c0883 Finalize 2017.1
aec60b81 Add RegisterLegalizationPasses() into the interface
746bfd21 Adding new def -> use mapping container
b02c9a58 Allow derived access chain without uses in access chain conversion
ab892f7b Add derivatives validation pass
c2999273 Move SetContextMessageConsumer into libspirv namespace
28c41550 Create a local value numbering pass
f407ae2b Validator pass for image instructions
e28edd45 Optimize loads/stores on nested structs
b1429158 Fix move semantics in iterator make_range
250a235a Add new compression algorithm and models
a771713e Adding an unique id to Instruction generated by IRContext
3214c3b0 Add dead function elimination to -O and -Os
4019bcfd Fix hard-coded header path
dbf9b376 Git should ignore external repos
eb4653a6 Add the decoration manager to the IRContext.
a92d69b4 Initial implementation of merge return pass.
0126ad97 Appveyor: skip building tags
919c990c Appveyor: Stop testing VS 2013/2015 Debug
98281ed4 Add analysis to compute mappings between instructions and basic blocks.
a76d0977 Fix decorations of inlined functions.
76555bd4 Tests: Add optional dependency on Effcee stateful matcher
efe12ff5 Have all MemPasses preserve the def-use manager.
039c12f0 Travis: auto deploy build artifacts to GitHub Releases
651ba75f Appveyor: auto deploy build artifacts to GitHub Releases
d2938e48 Re-format files in source, source/opt, source/util, source/val and tools.
f32d11f7 Add the IRContext (part 2): Add def-use manager
ac04b2fa Opt: Fix HasLoads to not report decoration as load.
d86c7ce8 Opt: Remove CommonUniformElimination from -O and -Os (for now)
1affe5a3 Describe public_spirv_tools_dev@khronos.org mailing list
2dddb819 Validate storage class of target pointer for OpStore
9d6cc262 Move class CFG from namespace opt to namespace ir.
fef669f3 Add a new class opt::CFG to represent the CFG for the module.
476cae6f Add the IRContext (part 1)
d861ceff Add validation for OpBranchConditional
7299fb5b Lowered initial capacity of move-to-front sequence
b1b49483 Fix copyright check when the build directory is in the source directory.
94bec26a ADCE: Dead if elimination
632e2068 More re-factoring to simplify pass initialization.
716138ee Add option to relax validation of store types.
6724c272 Compression: removed 'presumed index' feature
f063f91d Use std::lower_bound for opcode lookup
1040a95b Re-factor Phi insertion code out of LocalMultiStoreElimPass
94dc66b7 Change the sections in the module to use the InstructionList class.
063dbea0 Turn all function static non-POD variables into global POD variables
90862fe4 Validate SpvOpVectorShuffle
13e65989 restrict opcodes targeting OpDecorationGroup
97990dc9 Fixed --eliminate-common-uniform so that it does not eliminate loads of volatile variables.
98072b74 Optimizer: Line and NoLine are not debug1 or debug2
cfd95f3d Refactored compression debugger
8d6e4dbc Run dead variable elimination when using -O and -Os
e3a72093 DeadBranchElim: Fix dead block elimination
5834719f Add pass to remove dead variables at the module level.
24367947 Optimizer: OpModuleProcessed is in its own layout section
89b6af90 Add Android.mk build to Travis CI
cfb711a6 Added dummy android test application
d819f513 Fix cfg_cleanup.cpp.  My bad.
e6f34166 Remove coding redundancy in cfg_cleanup_pass.cpp
a743c476 Add instruction_list to Android.mk
39e25fd8 Add validation pass for conversion instructions
bb7802b1 Change BasicBlock to use InstructionList to hold instructions.
ea9d1d02 Removed todos from validate_id.cpp
863578a3 DeadBranchElim: Slightly more defensive coding
8ec62deb The reviewed cfg_cleanup optimize pass
c75704ec CFG cleanup pass - Remove unreachable blocks.
f17326c9 Android.mk: add source/opt/fold.cpp
4101cf46 Merge pull request #885 from dnovillo/const-prop
332a1f14 Re-factor generic constant folding code out of FoldSpecConstantOpAndCompositePass
1a9061a2 ADCE: Treat privates like locals in entry point with no calls
1e7994c0 Opt: Move *NextId functionality into MemPass
941a2341 Validator: Test OpReturnValue type check
8de8dd8c Reenable validate type unique pass
2401fc0a Refactored MARK-V API
b54997e6 Validator checks OpReturn called from void func
720beb16 Generic intrusive linked list class.
63064bd9 DeadBranchElim: Add dead case elimination
99f20438 Add Android.mk to SPIRV-Tools
c90d7305 Add -O, -Os and -Oconfig flags.
c26778fa Set cmake-policy CMP0048 to NEW
86627f7b Implement Linker (module combiner)
4b1577a0 Remove duplicate dead branch elim pass declaration
d7f199b5 Hack around bug in gcc-4.8.1 templates.
da04f564 AggressiveDCE: Fix to not treat parameter memory refs as local
c87e9671 Compact-ids pass should update the header ID bound
169266e9 DiagnosticStream move ctor moves output duties to new object
17a843c6 Cache end iterators for speed
6526c426 No use to check OpBitCount result width
d7ea99bc Skip checking copyright if SPIRV_SKIP_TESTS is enabled
6eaaf7b5 Update CHANGES to reflect fix for #827
77feb8dd Compact-ids pass should update instruction's result_id member
99cd25c4 Remove duplicated declaration of CreateAggressiveDCEPass().
64d5e521 Add bitwise operations validator pass
dcf42433 Add remaining opcodes to arithmetics validation
d84df946 Update CHANGES with recent news
e43c9104 Create the dead function elimination pass
976e4218 Detach MARK-V from the validator
16981f87 Avoid using global static variables
c25b5bea Add SPIRV_SPIRV_COMPRESSION option to cmake
cf6c20ee Merge pull request #829 from atgoo/fix_val_logicals
3f5e1a91 Validator: fix logicals pass for OpSelect pointers
33b879c1 elim-multi-store: only patch loop header phis that we created
cf85ad14 Add validate logicals pass to the validator
4e3cc2f5 Refactored validate_aritmetics.cpp
9b14dd0c Updated markv_autogen
8be28f75 ElimLocalMultiStore: Reset structured successors for each function
e4c7d8e7 Add strength reduction; for now replace multiply by power of 2
7be791aa ExtractInsert: Handle rudimentary CompositeConstruct and ConstantComposite
a91cecfe Recognize SPV_AMD_shader_fragment_mask
c6dfc118 Add new checks to validate arithmetics pass
44421022 Update CHANGES for OpModuleProcessed validation rule
c843ef8a validator: OpModuleProcessed allowed in layout section 7c
b36acbec Update MARK-V to version 1.01
40e9c60f spirv-as: Fail for unrecognized long option
25ddfec0 Inliner: Fix LoopMerge when inline into loop header of multi block loop
82df4bbd Add validation pass for arithmetic operations
0d3b8329 Make enums for all currently published extensions
7e2d26c7 Starge v2017.1-dev
d16403af Create v2017.0
a0977e86 Finalize v2016.7
f2413743 Update CHANGES for recent inliner fixes
32cf85dd Fix mingw build (source/print.cpp)
860c4197 Inliner: Remap callee entry block id to single-trip loop header
efff5fab Inline: Fix single-block loop caller cases
cff2cd33 BasicBlock: add ctail, GetMergeInst, GetLoopMergeInst
e6279cde Update tests for new preferred name as ShaderViewportIndexLayerEXT
d843cae4 Update CHANGES for fix to 781
725284c2 Extension allows multiple same OpTypePointer types
fc60d1e7 Update CHANGES for fix to 776
7c3de19c DeadBranchElim: Fix dead block detection to ignore backedges
b9b9a533 InlineOpaque: Remove from usage until complete Opaque policy is designed.
9090da5f Update changes for fix to issue 782
a699d1ad Inline: Fix remapping of non-label forward references in callee phi
1687bd32 Disassembler: Print colour codes only when writing to a terminal
d41a5241 Fix encode zero bits on word boundary bug
63e1e348 Show result id for CompositeInsert validation failure
cdeb6695 README: Add reference to SPIR-V size reduction white paper
01677587 Windows: Increase intensity of blue text
4fe8e389 Fix: background color was erroneously reset on Win32 platform.
851ff839 Updated capabilites for SampleMask
429ca05b Opt: Create InlineOpaquePass
c8c86a0d Opt: Have "size" passes process full entry point call tree.
768d9b42 Support supplying extra definitions via CMAKE variable
17d941af Huffman codec can serialize to text
1d477b98 Opt: Add opaque tests
78cf8615 Add id descriptor feature to SPIR-V
b0310a41 ADCE: Add support for function calls
720869bb Update CHANGE to list fix for issue 755
2a1014be Inliner: callee can have early return that isn't multi-return
f0fe601d AccessChainConvert: Add HasOnlySupportedRefs()
e28bd399 Inline: Split out InlineExhaustivePass from InlinePass
d9a45012 Mem2Reg: Allow Image and Sampler types as base target types.
95a600cd Update CHANGES with common uniform loads pass
0bd8300f Update README.md with new code-reduction passes
f4b29f3b Add CommonUniformElim pass
c1b46eed Add MemPass, move all shared functions to it.
30bee674 Add multi-sequence move-to-front implementation
15612fe0 Update CHANGES with recently added optimizations
c5c233ba Opt: Add new size-reduction passes to usage message.
55b73a03 Added C++ code generation to spirv-stats
65b180f4 Add Appveyor config that uses VS 2017
7954740d Opt: Delete names and decorations of dead instructions
9f6efc76 Opt: HasOnlySupportedRefs should consider OpCopyObject
4a539d77 Revert "Revert "Opt: LocalBlockElim: Add HasOnlySupportedRefs""
11824155 Add extension whitelists to size-reduction passes.
df96e243 Revert "Opt: LocalBlockElim: Add HasOnlySupportedRefs"
2d0f7fbc Opt: LocalBlockElim: Add HasOnlySupportedRefs
adb237f3 Fix handling of CopyObject in GetPtr and its call sites
e9e4393b Fix Visual Studio size_t cast compiler warning
fe24e031 LocalMultiStore: Always put varId for backedge on loop phi function.
e2544ddc DeadBranchElim: Improve algorithm to only remove blocks with no predecessors
06d4fd52 Minor code review feedback on AggressiveDCE
9de4e698 Add AggressiveDCEPass
cc8bad3a Add LocalMultiStoreElim pass
52e247f2 DeadBranchElim: Add DeadBranchElimPass
35a06958 Include memory and semantics IDs when iterating over inbound IDs
abc6f5a6 MARK-V decoder supports extended instructions
826d968a Update CHANGES to say we use GNUIntallDirs
fd70a1d7 Define variable to skip installation
78338d5b Convert pattern stack from deque to vector, and share it
e842c17e Added fixed width encoding to bit_stream
73e8dac5 Added compression tool tools/spirv-markv. Work in progress.
8d3882a4 Added log(n) move-to-front implementation
40a28296 Added Huffman codec to utils
65ea8852 Travis CI: stop requiring sudo and use make instead of ninja
d431b69c Don't do hash lookup twice in FindDef
c14966b8 Move spv_instruction_t's into vector
1cd47d7a Reserve expected length of instructions vector
fcd991f0 Move some temp vectors into parser state
ad1d0351 BlockMerge: Add BlockMergePass
0b0454c4 Update CHANGES
5fbbadca Add support for SPV AMD extensions
6136bf9e mem2reg: Add InsertExtractElimPass
760789f5 Transform multiple entry points
0c5722fc mem2reg: Add LocalSingleStoreElimPass
7c8da66b mem2reg: Add pass to eliminate local loads and stores in single block.
1567cddc Don't install googletest and googlemock
aa7e687e Mem2Reg: Add Local Access Chain Convert pass
d71d9768 Fix memory leak in ValidateBinaryUsingContextAndValidationState
66fc1056 Bots print output from timed out tests
e7aff807 Fixed misspelled ctest flag --output_on_failure
ddf4de61 Support building on FreeBSD
3bea99d3 CFA: Move TraversalRoots and ComputeAugmentedCFG into CFA
d6f29790 CFA: Pull in CalculateDominators
df6537ce DefUseManager: Fix ReplaceAllUsesWith() to update inst_to_used_ids_
20fe9466 Added extension SPV_VALIDATOR_ignore_type_decl_unique
3492cc63 Remove unused this in lambda capture
dbc2049a Add SPIR-V 1.2 support, for OpenCL 2.2
eb720b2a Fix size_t conversion error on MinGW
51b67783 Update CHANGES: note fix of issue 629
bba812f4 Inline: Inline early return function if no returns in loop.
3eb716ca Added bit stream utils
f5facf84 Stats analyzer aggregates OpConstant usage
b4cf3719 Stats analyzer uses validator
01b28750 Avoid snprintf warning in GCC 7.1
b25b3300 Inline: Create CFA class
3f90058d Update set_spec_const_default_value_test.cpp
87a3f651 Added Markov chain analysis to stats
bad90d9f Inline: Change "--inline-entry-points-all" to "-exhaustive"
d870dbe6 Inline: Fix inliner description in usage message to reflect exceptions.
a107d349 Inline: Do not inline functions with multiple returns (for now)
144f59e4 Add bit pattern interface for setting default value for spec constants
1d8efb02 Update CHANGES with recent news
1e309af8 Added --compact-ids to /tools/opt
b173d1c3 Added option --preserve-numeric-ids to tools/spirv-as
4f216402 Added statistical analysis tool (tool/stats)
72debb8f Test source language HLSL
bf68c814 Support SPV_KHR_storage_buffer_storage_class
23af06c3 Validator support for Variable Pointer extension.
4895ace2 Update cap tests for SPV_KHR_16bit_storage
4087e89b Test asm,dis support for SPV_KHR_variable_pointers
11a867f4 Add FlattenDecoration transform
5c3c054c Group targets into folders
dec3f5e2 Update spirv-opt to use spvtools::Optimizer
afc60bbe Fix optimizer on when to write the binary
ad3b0828 Add /EHs for targets for MSVC
4be6abe3 Fix spelling in SPV_AMD_gcn_shader support
58e7a3e6 Fix typo in method name Struct::AddMemberName
ceb1d4f2 Avoid inlining calls to external functions
4fc93022 opt::Function::cbegin and cend are const
6cd45177 Mention inliner in CHANGES
2410e008 Add low priority test suggestions for inliner
04fcc667 Add exhaustive function call inlining to spirv-opt
b85997a1 Add various accessors needed to read and edit SPIRV code.
7fe8a57a Support SPV_AMD_gcn_shader
fa834dea Fix validator message for bad logical pointer
ddd40f85 Update capability tests for SPV_KHR_16bit_storage rev 7
654feb32 Do nothing if trying to make the current dir
c3caa546 spirv-val prints warnings
0066a363 Add SpirvTools::Validate that takes an options object
971ede33 Validator dissallows unsupported Vulkan capability
c804c125 Autogenererating enum-string mappings from grammar
b0116331 Validator checks if operands require extension
1fb8c37b Refactored enum_set
12f55097 Fix extension grammar parsing
1c43cb85 Validator parses and registers OpExtension
42037205 Test SPV_KHR_multiview in assembler, disassembler
7327f63c Test SPV_KHR_device_group in assembler, disassembler
83b334e5 Test SPV_KHR_16bit_storage in assembler, disassembler
0004f721 Test SPV_KHR_subgroup_vote support in assembler, disassembler
9696393c Fix nullptr dereferencing in val_fixtures.cpp
892b0099 Change Ids in tests to avoid confusion
edb52647 Validate that SpecId decoration target is a OpSpecConstant instruction on a scalar
11fbe5dc Validator: unique type check allows runtime arrays
a0c5ffe8 Use OpenCL extinst definitions from SPIRV-Headers
2046e244 Fixes issue #489.
40be4bdd Allow using FPRoundingMode when see VK_KHR_16bit_storage
94d94e1f Validator: downgraded dupl type decl to warning
6a2b5148 Add a default virtual dtor to Pass and check for missing virtual dtors
0e9c24fd Issue 559: check type declaration uniqueness
4ef3b3e0 Refactored validation_state, added new types
da4ae056 Add command line options struct for the validator
e3632a26 Update CHANGES for SPV_KHR_16bit_storage validator
af7125df Validation of type decls for SPV_KHR_16bit_storage
c6099ad2 Add a Feature struct to validation state.
c0949703 Fixes issue #548
dadd5161 Check strict domination of merge block
f2867d74 The Signedness in OpTypeInt must always be 0.
f980d8c6 Add vim-spirv plugin description to the README
ab03b879 Encourage use of the validator
affbc318 Making the unit tests more robust.
cb009b38 Fixes issue #497.
9c71c572 Check BuiltIn Decoration rules.
3a7df2cf Fixes issue #532.
eb7d2534 Fixes issue #493.
d75bf5ef Validation for decoration rules. Fixes issue #499.
699943d2 Say why we allow override of build timestamp
29b37fb3 make build reproducible
fcf7df06 Adding decoration class and tests.
1c11c869 Validation of OpEntryPoint usage.
68e36ec7 Introducing a new flow for running the Validator.
d5e4f06e Update Travis CI configuration.
545a6c1d Provide friendly names for true and false
d1868b93 Validation for Composite Extract and Insert.
109ce225 Fixes bug #517.
558ac1e5 Allow trailing whitespace on version lines in CHANGES
20b2035f Use the default Xcode image on OSX
ff272a98 Adding validation code for PtrAccessChain.
c656c23a Refactoring unit tests using TEST_P.
6993fc41 Validation code for control flow nesting depth.
37422e9d Support building under CYGWIN
e0e4044f Update Travis notification emails
f8cc3975 Generate spvasm.vim
68c5f043 Start v2016.7-dev
5f5fa3a3 Finalize v2016.6
5a0b5ca4 Get vendor tool info from the SPIR-V registry file
945e9fc4 Document the use of the GitHub Project feature
d004cd46 Adding validation for OpInBoundsAccessChain.
4fb79b54 Validation for struct nesting depth.
d5b0cd34 An OpVariable initializer can be a module-scope variable
aadf696f Fixing bug in OpAccessChain validation code.
1f6123fa Add a test that exercises wrong usage of result id
bab1aad8 Adding validation code for OpAccessChain.
e6e7bd7d No need to install cmake for new osx images.
4b26d514 Validate the number of global and local variables.
49061713 Validate the number of arguments in OpTypeFunction
5f2d4091 Say how the validator checks universal limits
3c8bc80e Adding validation code for OpSwitch limits
bef80716 Validation for number of Struct members.

Change-Id: I14705ab30ee48b1ace2ff697ec02bf73cca6f67c
Testing: checkbuild.py on Linux; unit tests on Windows
tree: d13c49d79e2609b7dde99cf8a35831b14a257ad6
  1. android_test/
  2. build_overrides/
  3. cmake/
  4. examples/
  5. external/
  6. include/
  7. kokoro/
  8. source/
  9. test/
  10. tools/
  11. utils/
  12. .appveyor.yml
  13. .clang-format
  14. .gitignore
  15. .gn
  16. Android.mk
  17. BUILD.gn
  18. CHANGES
  19. CMakeLists.txt
  20. codereview.settings
  21. CONTRIBUTING.md
  22. DEPS
  23. LICENSE
  24. PRESUBMIT.py
  25. projects.md
  26. README.md
  27. syntax.md
README.md

SPIR-V Tools

Build status Linux Build Status MacOS Build Status Windows Build Status

Overview

The SPIR-V Tools project provides an API and commands for processing SPIR-V modules.

The project includes an assembler, binary module parser, disassembler, validator, and optimizer for SPIR-V. Except for the optimizer, all are based on a common static library. The library contains all of the implementation details, and is used in the standalone tools whilst also enabling integration into other code bases directly. The optimizer implementation resides in its own library, which depends on the core library.

The interfaces have stabilized: We don't anticipate making a breaking change for existing features.

SPIR-V is defined by the Khronos Group Inc. See the SPIR-V Registry for the SPIR-V specification, headers, and XML registry.

Versioning SPIRV-Tools

See CHANGES for a high level summary of recent changes, by version.

SPIRV-Tools project version numbers are of the form vyear.index and with an optional -dev suffix to indicate work in progress. For exampe, the following versions are ordered from oldest to newest:

  • v2016.0
  • v2016.1-dev
  • v2016.1
  • v2016.2-dev
  • v2016.2

Use the --version option on each command line tool to see the software version. An API call reports the software version as a C-style string.

Supported features

Assembler, binary parser, and disassembler

  • Support for SPIR-V 1.0, 1.1, 1.2, and 1.3
    • Based on SPIR-V syntax described by JSON grammar files in the SPIRV-Headers repository.
  • Support for extended instruction sets:
    • GLSL std450 version 1.0 Rev 3
    • OpenCL version 1.0 Rev 2
  • Assembler only does basic syntax checking. No cross validation of IDs or types is performed, except to check literal arguments to OpConstant, OpSpecConstant, and OpSwitch.

See syntax.md for the assembly language syntax.

Validator

The validator checks validation rules described by the SPIR-V specification.

Khronos recommends that tools that create or transform SPIR-V modules use the validator to ensure their outputs are valid, and that tools that consume SPIR-V modules optionally use the validator to protect themselves from bad inputs. This is especially encouraged for debug and development scenarios.

The validator has one-sided error: it will only return an error when it has implemented a rule check and the module violates that rule.

The validator is incomplete. See the CHANGES file for reports on completed work, and the Validator sub-project for planned and in-progress work.

Note: The validator checks some Universal Limits, from section 2.17 of the SPIR-V spec. The validator will fail on a module that exceeds those minimum upper bound limits. It is future work to parameterize the validator to allow larger limits accepted by a more than minimally capable SPIR-V consumer.

Optimizer

Note: The optimizer is still under development.

Currently supported optimizations:

  • General
    • Strip debug info
  • Specialization Constants
    • Set spec constant default value
    • Freeze spec constant
    • Fold OpSpecConstantOp and OpSpecConstantComposite
    • Unify constants
    • Eliminate dead constant
  • Code Reduction
    • Inline all function calls exhaustively
    • Convert local access chains to inserts/extracts
    • Eliminate local load/store in single block
    • Eliminate local load/store with single store
    • Eliminate local load/store with multiple stores
    • Eliminate local extract from insert
    • Eliminate dead instructions (aggressive)
    • Eliminate dead branches
    • Merge single successor / single predecessor block pairs
    • Eliminate common uniform loads
    • Remove duplicates: Capabilities, extended instruction imports, types, and decorations.

For the latest list with detailed documentation, please refer to include/spirv-tools/optimizer.hpp.

For suggestions on using the code reduction options, please refer to this white paper.

Linker

Note: The linker is still under development.

Current features:

  • Combine multiple SPIR-V binary modules together.
  • Combine into a library (exports are retained) or an executable (no symbols are exported).

See the CHANGES file for reports on completed work, and the General sub-project for planned and in-progress work.

Extras

  • Utility filters
  • Build target spirv-tools-vimsyntax generates file spvasm.vim. Copy that file into your $HOME/.vim/syntax directory to get SPIR-V assembly syntax highlighting in Vim. This build target is not built by default.

Contributing

The SPIR-V Tools project is maintained by members of the The Khronos Group Inc., and is hosted at https://github.com/KhronosGroup/SPIRV-Tools.

Consider joining the public_spirv_tools_dev@khronos.org mailing list, via https://www.khronos.org/spir/spirv-tools-mailing-list/. The mailing list is used to discuss development plans for the SPIRV-Tools as an open source project. Once discussion is resolved, specific work is tracked via issues and sometimes in one of the projects.

(To provide feedback on the SPIR-V specification, file an issue on the SPIRV-Headers GitHub repository.)

See projects.md to see how we use the GitHub Project feature to organize planned and in-progress work.

Contributions via merge request are welcome. Changes should:

We intend to maintain a linear history on the GitHub master branch.

Source code organization

  • example: demo code of using SPIRV-Tools APIs
  • external/googletest: Intended location for the googletest sources, not provided
  • external/effcee: Location of Effcee sources, if the effcee library is not already configured by an enclosing project.
  • external/re2: Location of RE2 sources, if the effcee library is not already configured by an enclosing project. (The Effcee project already requires RE2.)
  • include/: API clients should add this directory to the include search path
  • external/spirv-headers: Intended location for SPIR-V headers, not provided
  • include/spirv-tools/libspirv.h: C API public interface
  • source/: API implementation
  • test/: Tests, using the googletest framework
  • tools/: Command line executables

Example of getting sources, assuming SPIRV-Tools is configured as a standalone project:

git clone https://github.com/KhronosGroup/SPIRV-Tools.git   spirv-tools
git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-tools/external/spirv-headers
git clone https://github.com/google/googletest.git          spirv-tools/external/googletest
git clone https://github.com/google/effcee.git              spirv-tools/external/effcee
git clone https://github.com/google/re2.git                 spirv-tools/external/re2

Tests

The project contains a number of tests, used to drive development and ensure correctness. The tests are written using the googletest framework. The googletest source is not provided with this project. There are two ways to enable tests:

  • If SPIR-V Tools is configured as part of an enclosing project, then the enclosing project should configure googletest before configuring SPIR-V Tools.
  • If SPIR-V Tools is configured as a standalone project, then download the googletest source into the <spirv-dir>/external/googletest directory before configuring and building the project.

Note: You must use a version of googletest that includes a fix for googletest issue 610. The fix is included on the googletest master branch any time after 2015-11-10. In particular, googletest must be newer than version 1.7.0.

Optional dependency on Effcee

Some tests depend on the Effcee library for stateful matching. Effcee itself depends on RE2.

  • If SPIRV-Tools is configured as part of a larger project that already uses Effcee, then that project should include Effcee before SPIRV-Tools.
  • Otherwise, SPIRV-Tools expects Effcee sources to appear in external/effcee and RE2 sources to appear in external/re2.

Currently Effcee is an optional dependency, but soon it will be required.

Build

Instead of building manually, you can also download the binaries for your platform directly from the master-tot release on GitHub. Those binaries are automatically uploaded by the buildbots after successful testing and they always reflect the current top of the tree of the master branch.

The project uses CMake to generate platform-specific build configurations. Assume that <spirv-dir> is the root directory of the checked out code:

cd <spirv-dir>
git clone https://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers
git clone https://github.com/google/googletest.git external/googletest # optional

mkdir build && cd build
cmake [-G <platform-generator>] <spirv-dir>

Once the build files have been generated, build using your preferred development environment.

CMake options

The following CMake options are supported:

  • SPIRV_COLOR_TERMINAL={ON|OFF}, default ON - Enables color console output.
  • SPIRV_SKIP_TESTS={ON|OFF}, default OFF- Build only the library and the command line tools. This will prevent the tests from being built.
  • SPIRV_SKIP_EXECUTABLES={ON|OFF}, default OFF- Build only the library, not the command line tools and tests.
  • SPIRV_BUILD_COMPRESSION={ON|OFF}, default OFF- Build SPIR-V compressing codec.
  • SPIRV_USE_SANITIZER=<sanitizer>, default is no sanitizing - On UNIX platforms with an appropriate version of clang this option enables the use of the sanitizers documented here. This should only be used with a debug build.
  • SPIRV_WARN_EVERYTHING={ON|OFF}, default OFF - On UNIX platforms enable more strict warnings. The code might not compile with this option enabled. For Clang, enables -Weverything. For GCC, enables -Wpedantic. See CMakeLists.txt for details.
  • SPIRV_WERROR={ON|OFF}, default ON - Forces a compilation error on any warnings encountered by enabling the compiler-specific compiler front-end option.

Additionally, you can pass additional C preprocessor definitions to SPIRV-Tools via setting SPIRV_TOOLS_EXTRA_DEFINITIONS. For example, by setting it to /D_ITERATOR_DEBUG_LEVEL=0 on Windows, you can disable checked iterators and iterator debugging.

Android

SPIR-V Tools supports building static libraries libSPIRV-Tools.a and libSPIRV-Tools-opt.a for Android:

cd <spirv-dir>

export ANDROID_NDK=/path/to/your/ndk

mkdir build && cd build
mkdir libs
mkdir app

$ANDROID_NDK/ndk-build -C ../android_test     \
                      NDK_PROJECT_PATH=.      \
                      NDK_LIBS_OUT=`pwd`/libs \
                      NDK_APP_OUT=`pwd`/app

Library

Usage

The internals of the library use C++11 features, and are exposed via both a C and C++ API.

In order to use the library from an application, the include path should point to <spirv-dir>/include, which will enable the application to include the header <spirv-dir>/include/spirv-tools/libspirv.h{|pp} then linking against the static library in <spirv-build-dir>/source/libSPIRV-Tools.a or <spirv-build-dir>/source/SPIRV-Tools.lib. For optimization, the header file is <spirv-dir>/include/spirv-tools/optimizer.hpp, and the static library is <spirv-build-dir>/source/libSPIRV-Tools-opt.a or <spirv-build-dir>/source/SPIRV-Tools-opt.lib.

  • SPIRV-Tools CMake target: Creates the static library:
    • <spirv-build-dir>/source/libSPIRV-Tools.a on Linux and OS X.
    • <spirv-build-dir>/source/libSPIRV-Tools.lib on Windows.
  • SPIRV-Tools-opt CMake target: Creates the static library:
    • <spirv-build-dir>/source/libSPIRV-Tools-opt.a on Linux and OS X.
    • <spirv-build-dir>/source/libSPIRV-Tools-opt.lib on Windows.

Entry points

The interfaces are still under development, and are expected to change.

There are five main entry points into the library in the C interface:

  • spvTextToBinary: An assembler, translating text to a binary SPIR-V module.
  • spvBinaryToText: A disassembler, translating a binary SPIR-V module to text.
  • spvBinaryParse: The entry point to a binary parser API. It issues callbacks for the header and each parsed instruction. The disassembler is implemented as a client of spvBinaryParse.
  • spvValidate implements the validator functionality. Incomplete
  • spvValidateBinary implements the validator functionality. Incomplete

The C++ interface is comprised of three classes, SpirvTools, Optimizer and Linker, all in the spvtools namespace.

  • SpirvTools provides Assemble, Disassemble, and Validate methods.
  • Optimizer provides methods for registering and running optimization passes.
  • Linker provides methods for combining together multiple binaries.

Command line tools

Command line tools, which wrap the above library functions, are provided to assemble or disassemble shader files. It's a convention to name SPIR-V assembly and binary files with suffix .spvasm and .spv, respectively.

Assembler tool

The assembler reads the assembly language text, and emits the binary form.

The standalone assembler is the exectuable called spirv-as, and is located in <spirv-build-dir>/tools/spirv-as. The functionality of the assembler is implemented by the spvTextToBinary library function.

  • spirv-as - the standalone assembler
    • <spirv-dir>/tools/as

Use option -h to print help.

Disassembler tool

The disassembler reads the binary form, and emits assembly language text.

The standalone disassembler is the executable called spirv-dis, and is located in <spirv-build-dir>/tools/spirv-dis. The functionality of the disassembler is implemented by the spvBinaryToText library function.

  • spirv-dis - the standalone disassembler
    • <spirv-dir>/tools/dis

Use option -h to print help.

The output includes syntax colouring when printing to the standard output stream, on Linux, Windows, and OS X.

Linker tool

The linker combines multiple SPIR-V binary modules together, resulting in a single binary module as output.

This is a work in progress. The linker does not support OpenCL program linking options related to math flags. (See section 5.6.5.2 in OpenCL 1.2)

  • spirv-link - the standalone linker
    • <spirv-dir>/tools/link

Optimizer tool

The optimizer processes a SPIR-V binary module, applying transformations in the specified order.

This is a work in progress, with initially only few available transformations.

  • spirv-opt - the standalone optimizer
    • <spirv-dir>/tools/opt

Validator tool

Warning: This functionality is under development, and is incomplete.

The standalone validator is the executable called spirv-val, and is located in <spirv-build-dir>/tools/spirv-val. The functionality of the validator is implemented by the spvValidate library function.

The validator operates on the binary form.

  • spirv-val - the standalone validator
    • <spirv-dir>/tools/val

Control flow dumper tool

The control flow dumper prints the control flow graph for a SPIR-V module as a GraphViz graph.

This is experimental.

  • spirv-cfg - the control flow graph dumper
    • <spirv-dir>/tools/cfg

Utility filters

  • spirv-lesspipe.sh - Automatically disassembles .spv binary files for the less program, on compatible systems. For example, set the LESSOPEN environment variable as follows, assuming both spirv-lesspipe.sh and spirv-dis are on your executable search path:

     export LESSOPEN='| spirv-lesspipe.sh "%s"'
    

    Then you page through a disassembled module as follows:

    less foo.spv
    
    • The spirv-lesspipe.sh script will pass through any extra arguments to spirv-dis. So, for example, you can turn off colours and friendly ID naming as follows:
      export LESSOPEN='| spirv-lesspipe.sh "%s" --no-color --raw-id'
      
  • vim-spirv - A vim plugin which supports automatic disassembly of .spv files using the :edit command and assembly using the :write command. The plugin also provides additional features which include; syntax highlighting; highlighting of all ID's matching the ID under the cursor; and highlighting errors where the Instruction operand of OpExtInst is used without an appropriate OpExtInstImport.

  • 50spirv-tools.el - Automatically disassembles ‘.spv’ binary files when loaded into the emacs text editor, and re-assembles them when saved, provided any modifications to the file are valid. This functionality must be explicitly requested by defining the symbol SPIRV_TOOLS_INSTALL_EMACS_HELPERS as follows:

    cmake -DSPIRV_TOOLS_INSTALL_EMACS_HELPERS=true ...
    

    In addition, this helper is only installed if the directory /etc/emacs/site-start.d exists, which is typically true if emacs is installed on the system.

    Note that symbol IDs are not currently preserved through a load/edit/save operation. This may change if the ability is added to spirv-as.

Tests

Tests are only built when googletest is found. Use ctest to run all the tests.

Future Work

See the projects pages for more information.

Assembler and disassembler

  • The disassembler could emit helpful annotations in comments. For example:
    • Use variable name information from debug instructions to annotate key operations on variables.
    • Show control flow information by annotating OpLabel instructions with that basic block's predecessors.
  • Error messages could be improved.

Validator

This is a work in progress.

Linker

  • The linker could accept math transformations such as allowing MADs, or other math flags passed at linking-time in OpenCL.
  • Linkage attributes can not be applied through a group.
  • Check decorations of linked functions attributes.
  • Remove dead instructions, such as OpName targeting imported symbols.

Licence

Full license terms are in LICENSE

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

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.