-
5994ae2a
by Steven Perron
at 2019-02-20T16:05:57Z
Start SPIRV-Tools 2019.3
-
76730a46
by Sarah
at 2019-02-20T16:50:57Z
In Vulkan, disallow BufferBlock on StorageBuffer variables (#2380)
To fix #2168.
-
8eddde2e
by Steven Perron
at 2019-02-20T23:59:41Z
Don't change type of input and output var in dead member elim (#2412)
The types of input and output variables must match for the pipeline. We
cannot see the uses in all of the shader, so dead member
elimination cannot safely change the type of input and output variables.
-
fde69dcd
by Steven Perron
at 2019-02-21T01:05:08Z
Fix OpDot folding of half float vectors. (#2411)
* Fix OpDot folding of half float vectors.
The code that folds OpDot does not handle half floats correctly. After
trying to multiple the first components, we get a nullptr because we
don't fold half float values. This nullptr gets passed to the code that
does the addition, and causes an assert.
Fixes #2405.
-
4c43afca
by Sarah
at 2019-02-21T17:03:52Z
It is invalid to apply both Restrict and Aliased to the same <id> (#2408)
to fix #2408 - It is invalid to apply both Restrict and Aliased to the same
-
a006cbc1
by Steven Perron
at 2019-02-22T17:51:22Z
Non memory object as parameters. (#2415)
In relaxed addressing mode, we want to accept non memory objects
because this is a very natural translation of hlsl. It should be fixed
by legalization by inlining the calls.
-
37b584a7
by François Bertel
at 2019-02-25T13:57:34Z
Fixed undefined reference to 'clock_gettime' by linking rt library (#2409)
-
fc3897b5
by Sarah
at 2019-02-25T15:37:43Z
Validate: (data) Block can't appear within a Block (#2410)
A Block or BufferBlock cannot be nested within another Block or BufferBlock
-
002ef361
by Jeff Bolz
at 2019-02-25T22:43:11Z
Add validation for SPV_NV_cooperative_matrix (#2404)
-
d800bbba
by Steven Perron
at 2019-02-26T14:06:51Z
Handle back edges better in dead branch elim. (#2417)
* Handle back edges better in dead branch elim.
Loop header must have exactly one back edge. Sometimes the branch
with the back edge can be folded. However, it should not be folded
if it removes the back edge.
The code to check this simply avoids folding the branch in the
continue block. That needs to be changed to not fold the back edge,
wherever it is.
At the same time, the branch can be folded if it folds to a branch to
the header, because the back edge will still exist.
Fixes #2391.
-
32b0f673
by Steven Perron
at 2019-02-26T21:52:33Z
Use correct option in spvTextToBinary. (#2416)
Fixes #2414.
-
5fb83a97
by Ehsan
at 2019-02-27T21:11:50Z
Allow NonWritable to target struct members. (#2420)
It should be allowed for the NonWritable decoration to be applied to
structure type members.
-
86f6ac08
by alan-baker
at 2019-03-05T16:52:02Z
Add a test for two back-edges in a continue (#2418)
-
07f80c4d
by Steven Perron
at 2019-03-06T19:11:01Z
Fix python scripts to work with python3 (#2426)
Updated script to work with python3 and python2.
Added required tools.
We added a section to the readme to mention the tools that are needed to
build and test spirv-tools. For the compiler, the compilers used by the
bots are mentioned.
The bots have been changed. The windows bots will not use python 3.6 for testing. The other bots will still use python 2.7. Both Python2 and Python3 will be tested.
Fixes #2407.
Fixes #1856.
-
a2ef7be2
by fjhenigman
at 2019-03-06T22:21:24Z
Add Linux ASAN bot configs. (#2427)
Fix the ASAN part of the bot script.
Add continuous and presubmit Linux ASAN bot configurations.
-
b12e7338
by Ryan Harrison
at 2019-03-08T18:01:09Z
Implement WebGPU specific CFG validation (#2386)
In WebGPU all blocks are required to be reachable, unless they are one of two
specific degenerate cases for merge-block or continue-target. This PR adds in
checking for these conditions.
Fixes #2068
-
b1ff15f2
by Ryan Harrison
at 2019-03-12T15:27:40Z
Add missing DepthGreater case to Fragment only check (#2440)
Fixes #2439
-
b75f4362
by Ryan Harrison
at 2019-03-12T18:50:25Z
Add validation for ExecutionMode in WebGPU (#2443)
Fixes #2437
-
9d29c37a
by Steven Perron
at 2019-03-13T14:40:49Z
Removing decorations when doing constant propagation. (#2444)
In constant propagation, decoration are transfered from the original
_expression_ to the constant that will replace it. This can be wrong
because there are no decorations that apply to constants. We choose to
simply delete the decorations.
Fixes #2441
-
a5c06c90
by Jaebaek Seo
at 2019-03-13T16:25:24Z
Validator: no Storage comparison for pointer param (#2428)
If relax-logical-pointer is enabled, this commit makes Validator
accept function param even when its Storage Class is different from
the expected one.
Related to #2423, #2430
-
6df8a917
by Ryan Harrison
at 2019-03-13T17:01:25Z
Add validation of storage classes for WebGPU (#2446)
Fixes #2445
-
5186ffed
by Steven Perron
at 2019-03-13T19:46:31Z
Remove duplicates from list of interface IDs in OpEntryPoint instruction (#2449)
* Remove duplicates from list of interface IDs in OpEntryPoint instruction
Fixes #2002.
-
bdcb1551
by alan-baker
at 2019-03-14T16:45:31Z
Relax function call parameter check (#2448)
Fixes #2447
* Allow sub-objects for UniformConstant storage class
* Updated tests
-
e5455221
by Ryan Harrison
at 2019-03-14T17:34:33Z
Add --strip-atomic-counter-memory (#2413)
Adds an optimization pass to remove usages of AtomicCounterMemory
bit. This bit is ignored in Vulkan environments and outright forbidden
in WebGPU ones.
Fixes #2242
-
2ac348b5
by David Neto
at 2019-03-15T00:38:53Z
Repair test for unused storage buffer with descriptor (#2436)
Fixes two things:
- struct needed layout decorations. It never had them
- use Block decoration, rather than BufferBlock that was removed in
#2380
-
da5a780f
by SarahM0
at 2019-03-18T18:07:36Z
Variable pointers cannot be an operand to OpArrayLength
-
9244e6ff
by Alan Baker
at 2019-03-18T19:14:41Z
Reverting commit da5a780ff9fff7e226ca84728075adabc4d1608c
-
e1a76269
by greg-lunarg
at 2019-03-19T13:53:43Z
Bindless Validation: Descriptor Initialization Check (#2419)
If SPV_EXT_descriptor_indexing is enabled, add check that for a
descriptor-based reference, the descriptor is initialized. Initialization
data is stored in the debug input buffer, added to the length information
already there. This feature must be seperately enabled on the pass
creation routine. NOTE: Currently just supports image references; buffer
references are still TODO.
-
08b54d9e
by Ryan Harrison
at 2019-03-19T16:39:37Z
Convert sampled consumers to being Instructions instead of IDs (#2464)
Changing the stored value for a sampled image consumer to be the
instruction instead of result ID, since not all instructions have
result IDs. Using result IDs led to a potential crash when using
OpReturnValue, which doesn't have a result ID. OpReturnValue is not a
legal consumer, but the validator needs to look at the instruction to
determine this, thus storing the pointer to the instruction, instead
of trying to fetch the pointer using the instruction.
Issue #1528 covers fixing the check.
Fixes #2463
-
1f60f989
by Paul Thomson
at 2019-03-21T13:32:21Z
reduce: remove unreferenced blocks pass (#2398)
-
2d52cbee
by Paul Thomson
at 2019-03-21T14:28:06Z
Add some val options to reduce (#2401)
Fix #2396
* Check that initial state is valid. Add kInitialStateInvalid.
* Fix RemoveOpnameAndRemoveUnreferenced test; turns out the original shader is invalid, but we never notice because we don't check this and the reduced shader is valid; fix original shader. Assert reduction status is kComplete.
* Always check return value from `Reducer::Run`.
* Change Reducer::Run to *not* immediately copy the input binary.
-
ffbecae5
by Ryan Harrison
at 2019-03-25T19:44:57Z
Check OpSampledImage is only passed into valid instructions (#2467)
Fixes #1528
-
7d1b176c
by Paul Thomson
at 2019-03-26T13:22:31Z
Improve reducer algorithm and other changes (#2472)
Fix #2475. Fix #2476.
* Improve reducer algorithm: shrink granularity, remove an early return, no lazy initialization, notify pass if binary is interesting, add comments.
* Add fail-on-validation-error option to fail a reduction if an invalid state is reached; useful for tests.
* Set fail-on-validation-error in tests.
* Improve some documentation comments.
* Add Reducer::AddDefaultReductionPasses so tests (and other library consumers) can add the default reduction passes.
* Add CLIMessageConsumer in test_reduce so we can see messages for tricky tests.
* Remove test RemoveUnreferencedInstructionReductionPassTest_ApplyReduction because it was indirectly testing the reduction algorithm, not the RemoveUnreferencedInstruction pass.
* Tweak tests where needed.
-
fb075364
by Paul Thomson
at 2019-03-26T16:37:08Z
reduce: fix loop to selection dominance query (#2477)
Fix #2457
-
42e6f1aa
by alan-baker
at 2019-03-26T18:38:59Z
Add option to validate after each pass (#2462)
* New command-line option to opt: --validate-after-all
* Pass manager will validate after each pass it runs
-
2ff54e34
by alan-baker
at 2019-03-26T18:39:16Z
Handle function decls in Structured CFG analysis (#2474)
Fixes #2451
* Structured cfg analysis now handles functions with no basic blocks
* Added a test
-
fcb84531
by Paul Thomson
at 2019-03-29T11:29:24Z
reduce: fix loop to selection pass for loops with combined header/continue block (#2480)
* Fix #2478. The fix is to just not try to simplify such loops.
* Also added `BasicBlock::MergeBlockId()` and `BasicBlock::ContinueBlockId()`.
* Some minor changes to `structured_loop_to_selection_reduction_opportunity.cpp`.
* Added test.
-
320a7de5
by alan-baker
at 2019-03-29T14:49:37Z
Validate that OpUnreacahble is not statically reachable (#2473)
* Adds a validator check that ensures no block reachable from the entry
block is terminated by OpUnreachable
* Updated tests
* Added new tests
-
0300a464
by alan-baker
at 2019-04-01T17:14:10Z
Maintain inst to block mapping in merge return (#2469)
Fixes #2455
Properly maintains instruction to block mapping for newly created phi instructions in merge return
-
c9874e50
by alan-baker
at 2019-04-02T14:05:28Z
Fix merge return in the face of breaks (#2466)
Fixes #2453
* Enable addition of OpPhi instructions when the loop has multiple
predecessors of the merge due to a break
* This can result in some values no longer dominating their uses
* Track return blocks in structured flow to produce OpPhis that have
multiple undef and non-undef arguments
* New tests to catch the bug
* When a block is predicated, mark the new body as a return if the old
block as already a return
-
e2ddb937
by Paul Thomson
at 2019-04-02T15:50:15Z
reduce: add remove_selection_reduction_opportunity (#2485)
Fix #2484
-
8129cf2f
by alan-baker
at 2019-04-02T18:37:05Z
Remove merge assert in block calculation (#2489)
Fixes #2488
* Validator doesn't identify back-edge of the loop, so the merge is
never set
* Construct::blocks() has safe uses of `merge` so the assert can be
removed
* Added a test
-
4bd106b0
by alan-baker
at 2019-04-03T14:30:12Z
Handle dead infinite loops in DCE (#2471)
Fixes #2456
* When eliminating a structured construct that has an unreachable merge,
replace that unreachable terminator with an appropriate return
* New tests
-
01964e32
by Ryan Harrison
at 2019-04-03T15:44:09Z
Add pass to generate needed initializers for WebGPU (#2481)
Fixes #2387
-
12e4a7b6
by Steven Perron
at 2019-04-03T16:47:51Z
Handle variable pointer in some optimizations (#2490)
* Check var pointer capability in ADCE.
* Check var ptr capability for common uniform.
* Check var ptr capability in access chain convert.
Since we want this pass to run even if there are variable pointer on
storage buffers, we had to remove asserts that assumed there were no
variable pointers. The functions with the asserts will now work, it
becomes the responsibility of the callers to deal with the output as
appropriate.
* Single block elimination and variable pointers.
It seems like the code in local single block elimination is able to
handle cases with variable pointers already. This is because the
function `HasOnlySupportedRefs` ensures that variables that feed a
variable pointer are not candidates.
* Single store elimination and variable pointers.
It seems like the code in local single stroe elimination is able to
handle cases with variable pointers already. This is because the
function `FindSingleStoreAndCheckUses` ensures that variables that feed
a variable pointer are not candidates.
* SSA rewriter and variable pointers.
It seems like the code in the two passes that call the SSA rewriter are
able to handle cases with variable pointers already. This is because the
function `HasOnlySupportedRefs` ensures that variables that feed
a variable pointer are not candidates.
Fixes #2458.
-
236bdc00
by alan-baker
at 2019-04-03T16:50:08Z
Change prioritization of unreachable merge and continue (#2460)
Fixes #2452
Swaps priority of handling unreachable merge and continues so that the
back-edge is retained in the case a block is both a loop continue and
loop merge
-
26c1b887
by Steven Perron
at 2019-04-03T17:22:54Z
Update CHANGES
-
e8c2d95e
by Shahbaz Youssefi
at 2019-04-04T15:46:51Z
Fix webgpu header file name in BUILD.gn (#2493)
A .h file was specified as .hpp file, causing `gn gen path/ --check` to
fail.
-
3a0bc9e7
by Steven Perron
at 2019-04-05T17:12:08Z
Add fix storage class code. (#2434)
This pass tries to fix validation error due to a mismatch of storage classes
in instructions. There is no guarantee that all such error will be fixed,
and it is possible that in fixing these errors, it could lead to other
errors.
Fixes #2430.
-
9766b22b
by JasperNV
at 2019-04-05T17:36:42Z
spirv-opt: Behave a bit better in the face of unknown instructions (#2487)
* opt/ir_loader: Don't silently drop unknown instructions on the floor
Currently, if spirv-opt sees an instruction it does not know, it will
silently ignore it and move to the next one. This changes it
to be an error, as dropping it on the floor is likely to generate
invalid SPIR-V output.
* opt/optimizer: Complain a bit louder for unexpected binary changes
If a binary change happens despite a pass saying that the binaries
should be identical, this is indicative of a bug in the pass itself.
This does not change behavior for it to be an error, but simply emits a warning in this case.
-
0cb2d407
by Ryan Harrison
at 2019-04-05T19:12:26Z
Add WebGPU->Vulkan and Vulkan->WebGPU flags in spirv-opt (#2496)
Renames the existing flag '--webgpu-mode' to '--vulkan-to-webgpu' for
the Vulkan->WebGPU operation, and adds a new flag '--webgpu-to-vulkan'
for the WebGPU->Vulkan operation.
Currently '--webgpu-to-vulkan' doesn't have any passes associated with
it yet, but further patches will implement them.
Fixes #2495
-
7ce37d66
by Steven Perron
at 2019-04-08T15:06:48Z
Fix use of Logf to avoid format security warning (#2498)
When -Wformat-security is enabled, we are getting an error. I do not
claim to fully understand when the warning is triggered or not, but this
one can be avoided by calling "Log" instead of "Logf" because the
formating string is not needed.
-
d90aae9a
by Paul Thomson
at 2019-04-08T18:37:17Z
reduce: miscellaneous fixes (#2494)
* Fix .gitignore
* Add missing reduction pass: RemoveBlockReductionOpportunityFinder
* Add DumpShader functions in test_reduce for debugging
* Add DumpShader functions in spirv-reduce for debugging
* Fix include style
* Don't use "using namespace"
-
9047de51
by Steven Perron
at 2019-04-09T18:10:35Z
Accept OpBitCast in fix storage class. (#2505)
Fixes http://crbug.com/950889.
-
82ebbbba
by David Neto
at 2019-04-09T18:42:20Z
README: fix formatting of requiring Python 'future' (#2500)
-
2b46521c
by Steven Perron
at 2019-04-11T20:33:26Z
Add -fsantize to link flags. (#2506)
The option "SPIRV_USE_SANITIZER=address" does not work as stated in our
documentation because the link step fails for the tools. We have to add
-fsanitize to the link flags so the correct libraries are added on the
link step.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/2482.
-
98b3f26c
by alan-baker
at 2019-04-11T20:39:50Z
Gate formatless checks on Vulkan env (#2486)
Fixes #2470
* Only require the *WithoutFormat capabilities for Unknown image reads
and writes in the Vulkan environment
* update tests and add new vulkan specific tests
-
07ac7dee
by David Neto
at 2019-04-12T12:23:19Z
SPIRV-Tools requires python3 (#2510)
Updates:
- CMake configuration
- Kokoro build scripts on Linux and macos (Windows already uses Python 3.6)
-
102e430a
by Ryan Harrison
at 2019-04-12T16:14:23Z
Add pass to legalize OpVectorShuffle for WebGPU (#2509)
In WebGPU, the component operand 0xFFFFFFFF is forbidden, but in
Vulkan it is used to indicate a value is undefined. When converting to
WebGPU, 0xFFFFFFFF needs to converted to a legal value, though the
specific one does not matter, since it was used to indicate an
undefined entry in the original code. Choosing to use 0, since the
operands are required to be on [0, N-1], so 0 is guaranteed to always
be valid.
Fixes #2349
-
3335c611
by Paul Thomson
at 2019-04-15T18:54:36Z
reduce: Add two branch reduction passes (#2507)
* Fix #2320. `conditional_branch_to_simple_conditional_branch` reduction pass changes conditional branches so both targets point to the same block id (creating a "simple" conditional branch).
* Fix #2501. `simple_conditional_branch_to_branch` reduction pass changes "simple" conditional branches to branches.
* Fix #2503. `conditional_branch_to_simple_conditional_branch` proper handling of back-edges.
-
048dcd38
by Ryan Harrison
at 2019-04-16T18:31:36Z
Implement WebGPU->Vulkan initializer conversion for 'Function' variables (#2513)
WebGPU requires certain variables to be initialized, whereas there are
known issues with using initializers in Vulkan. This PR is the first
of three implementing a pass to decompose initialized variables into
a variable declaration followed by a store. This has been broken up
into multiple PRs, because there 3 distinct cases that need to be
handled, which require separate implementations.
This first PR implements the basic infrastructure that is needed, and
handling of Function storage class variables. Private and Output will
be handled in future PRs.
This is part of resolving #2388
-
3aad3e92
by Ryan Harrison
at 2019-04-16T18:49:07Z
Change validation of memory semantics for OpAtomics* in WebGPU (#2519)
Recent change to the spec restricted the valid values for Memory
Semantics in OpAtomics* in the WebGPU env. Implementing enforcing
these changes.
Fixes #2499
-
21712068
by Ryan Harrison
at 2019-04-17T16:44:54Z
Validate that SPIR-V binary is encoded as little endian for WebGPU (#2523)
Fixes #2522
-
ac878fcb
by alan-baker
at 2019-04-17T22:21:19Z
Remove unreachable block validation (#2525)
* Remove the check that blocks terminated by OpUnreachable are not
statically reachable in the CFG
* Updated tests
-
d754b705
by Steven Perron
at 2019-04-18T17:22:28Z
Shorten names of cmake targets (#2531)
Window still had a limit of 260 chars for file paths. Visual C++ create
directories and file names based on the cmake target names, so if they are
too long, the windows build will fail.
This is not a problem for spirv-tools on its own, but the files names
currently go up to 220 characters for some spirv-tools files when built as
part of VK-GL-CTS. This change will get it back down to 190, leaving more
space for the directory that will contain VK-GL-CTS.
This is fixing an issue reported against the VK-GL-CTS.
-
7aad9653
by Ryan Harrison
at 2019-04-18T18:57:19Z
Remove legacy utility functions (#2530)
These are not called/referenced by anything, and are marked as being
unused. They were brought to my attention by a coverity based bug
report.
Fixes #2537
-
07c4dd4b
by alan-baker
at 2019-04-23T14:33:00Z
Reduce runtime of array layout checks (#2534)
Fixes #2533
* Stop checking layouts once the offset gets back to a 16 byte alignment
-
736376db
by Ryan Harrison
at 2019-04-23T17:27:40Z
Remove Acquire, Release, and Relaxed from allowed Mem Sem bits for WebGPU (#2526)
Fixes #2524
-
b68af7ca
by Ryan Harrison
at 2019-04-25T20:24:32Z
Add support for Private & Output to initializer decompose flag (#2537)
Fixes #2388
-
fb08224f
by Steven Perron
at 2019-04-26T13:34:11Z
Fix spirv-headers link in the README. (#2516)
-
2de3e3c0
by Gustavo Alvarez
at 2019-04-26T13:37:23Z
Add spirv-lesspipe.sh into SPIRV_SKIP_EXECUTABLES umbrella (https://github.com/KhronosGroup/SPIRV-Tools/issues/2497) (#2504)
-
dca3ea5e
by Clouds
at 2019-04-26T14:18:13Z
fix example.cpp (#2540)
-
64faf6d9
by Steven Perron
at 2019-04-26T16:52:23Z
Fix undefined bit shift in sroa. (#2532)
There was a bit shift done on 32-bit values, but they should have been
done on 64-bit values. This is fixed. At the same time, uses of size_t
are repalaced by uint64_t to ensure these values are 64-bit.
A test case cannot be created because the code that was change is not
run at the moment since we do not split up vectors or matricies. I do
not want to delete the code because I like to experitment with it every
once in a while.
Fixes #2528.
-
32af4261
by Steven Perron
at 2019-04-29T21:09:20Z
Change implementation of post order CFG traversal (#2543)
* Change implementation of post order CFG traversal
It seems like the recursion is going very deep, and causing some problem
is particular situations. I've reimplemented the CFG post order
traversal to not use recursion.
Fixes #2539.
-
a5da68d4
by Ryan Harrison
at 2019-05-01T14:56:39Z
Remove stale comment (#2542)
Fixes #1121
-
c8b09744
by Ryan Harrison
at 2019-05-01T17:29:39Z
Add validation specific to OpExecutionModeId (#2536)
Fixes #1565
-
6d04da22
by Steven Perron
at 2019-05-02T13:31:46Z
Fix up type mismatches. (#2545)
Add functionality to fix-storage-class so that it can fix up mismatched
data types for pointers as well.
Fixes bugs in when fixing up storage class.
Move GenerateCopy to the Pass class to be reused.
The spirv-opt change for #2535.
-
5fc5303e
by Ehsan
at 2019-05-02T18:25:09Z
[spirv] Package and upload builds. (#2544)
-
eef11cdb
by Ehsan
at 2019-05-06T14:21:57Z
Update README with links to build artifacts. (#2548)
-
106c98d0
by Steven Perron
at 2019-05-06T17:05:31Z
Validate sign of int types. (#2549)
Fixes https://crbug.com/959011.
-
63f57d95
by David Neto
at 2019-05-07T16:27:18Z
Support SPIR-V 1.4 (#2550)
* SPIR-V 1.4 headers, add SPV_ENV_UNIVERSAL_1_4
* Support --target-env spv1.4 in help for command line tools
* Support asm/dis of UniformId decoration
* Validate UniformId decoration
* Fix version check on instructions and operands
Also register decorations used with OpDecorateId
* Extension lists can differ between enums that match
Example: SubgroupMaskEq vs SubgroupMaskEqKHR
* Validate scope value for Uniform decoration, for SPIR-V 1.4
* More unioning of exts
* Preserve grammar order within an enum value
* 1.4: Validate OpSelect over composites
* Tools default to 1.4
* Add asm/dis test for OpCopyLogical
* 1.4: asm/dis tests for PtrEqual, PtrNotEqual, PtrDiff
* Basic asm/Dis test for OpCopyMemory
* Test asm/dis OpCopyMemory with 2-memory access
Add asm/dis tests for OpCopyMemorySized
Requires grammar update to add second optional memory access operand
to OpCopyMemory and OpCopyMemorySized
* Validate one or two memory accesses on OpCopyMemory*
* Check av/vis on CopyMemory source and target memory access
This is a proposed rule. See
https://gitlab.khronos.org/spirv/SPIR-V/issues/413
* Validate operation for OpSpecConstantOp
* Validate NonWritable decoration
Also permit NonWritable on members of UBO and SSBO.
* SPIR-V 1.4: NonWrtiable can decorate Function and Private vars
* Update optimizer CLI tests for SPIR-V 1.4
* Testing tools: Give expected SPIR-V version in message
* SPIR-V 1.4 validation for entry point interfaces
* Allow only unique interfaces
* Allow all global variables
* Check that all statically used global variables are listed
* new tests
* Add validation fixture CompileFailure
* Add 1.4 validation for pointer comparisons
* New tests
* Validate with image operands SignExtend, ZeroExtend
Since we don't actually know the image texel format, we can't fully
validate. We need more context.
But we can make sure we allow the new image operands in known-good
cases.
* Validate OpCopyLogical
* Recursively checks subtypes
* new tests
* Add SPIR-V 1.4 tests for NoSignedWrap, NoUnsignedWrap
* Allow scalar conditions in 1.4 with OpSelect
* Allows scalar conditions with vector operands
* new tests
* Validate uniform id scope as an execution scope
* Validate the values of memory and execution scopes are valid scope
values
* new test
* Remove SPIR-V 1.4 Vulkan 1.0 environment
* SPIR-V 1.4 requires Vulkan 1.1
* FIX: include string for spvLog
* FIX: validate nonwritable
* FIX: test case suite for member decorate string
* FIX: test case for hlsl functionality1
* Validation test fixture: ease debugging
* Use binary version for SPIR-V 1.4 specific features
* Switch checks based on the SPIR-V version from the target environment
to instead use the version from the binary
* Moved header parsing into the ValidationState_t constructor (where
version based features are set)
* Added new versions of tests that assemble a 1.3 binary and validate a
1.4 environment
* Fix test for update to SPIR-V 1.4 headers
* Fix formatting
* Ext inst lookup: Add Vulkan 1.1 env with SPIR-V 1.4
* Update spirv-val help
* Operand version checks should use module version
Use the module version instead of the target environment version.
* Fix comment about two-access form of OpCopyMemory
-
2b65a71d
by Raul Tambre
at 2019-05-07T18:19:32Z
Fix use of 'is' operator for comparison (#2547)
The 'is' operator is not meant to be used for comparisons. It currently working is an implementation detail of CPython.
CPython 3.8 has added a SyntaxWarning for this.
-
b74d92a8
by alan-baker
at 2019-05-07T18:52:22Z
ADCE support for SPIR-V 1.4 entry points (#2561)
Fixes #2551
* Add support for 1.4 entry point interface lists
* only input and output variables are automatically live
* can clean up interfaces after DCE
* added tests
* allow opt tests to specify a target environment
-
d0a1f5a0
by David Neto
at 2019-05-08T02:01:06Z
spvtest::Validate::CompileFailure: Don't leak the diagnostic (#2564)
-
ea5e1b62
by alan-baker
at 2019-05-08T16:38:49Z
Update priv-to-local for SPIR-V 1.4 (#2567)
Fixes #2555
* Fix a bug in validation where interfaces were considered non-unique
between different entry points targeting the same function
* added a test
* Update private to local pass to remove localized private variables
from entry point interfaces
* added tests
-
cc3e93c4
by alan-baker
at 2019-05-08T18:06:04Z
Add tests for folding 1.4 selects (#2568)
Fixes #2554
* Folding rules already handle 1.4 selects so I simply added some tests
-
f2803c4a
by David Neto
at 2019-05-08T22:01:10Z
VK_KHR_uniform_buffer_standard_layout validation (#2562)
Add a command-line option to enable validating SPIR-V for
implementations that support VK_KHR_uniform_buffer_standard_layout.
-
89fe836f
by Diego Novillo
at 2019-05-09T04:15:08Z
Fix clang-tidy warning about definition/declaration mismatch. (#2571)
Fix clang-tidy warning about definition/declaration mismatch.
-
f6d9a178
by Ryan Harrison
at 2019-05-09T16:56:10Z
Add pass to fix some invalid unreachable blocks for WebGPU (#2563)
Attempts to split up unreachable blocks that are used both as a
merge-block and a continue-target.
Fixes #2429
-
45fb6966
by alan-baker
at 2019-05-10T15:02:01Z
Use last version (#2578)
* Use grammar last version
Fixes #2560
* Parse last version and use it in checks
* Update grammar header generation
* Fix NonWritable tests
* Fix check and add specific tests
-
87c4ef8a
by alan-baker
at 2019-05-10T15:03:22Z
Do not fold floating point if float controls used (#2569)
Fixes #2558
* Mark floating point instructions as non-foldable if any
SPV_KHR_float_controls capabilities are present
* tests
-
06ce59b0
by greg-lunarg
at 2019-05-10T15:06:00Z
Instrument: Fix load type of pre-existing builtin (#2575)
Builtins may be declared int, so load with its pointee type and cast
to uint if needed.
-
2947e88f
by alan-baker
at 2019-05-10T15:08:28Z
Update instrumentation passes to handle 1.4 interfaces (#2573)
Fixes #2556
Added variables get added to entry point interfaces
Add to input buffer too
-
e935dac9
by Steven Perron
at 2019-05-13T17:48:17Z
Make pointers to isomorphic type interchangeable with option. (#2570)
* Make pointers to logically matching types interchangeable with option.
DXC will be generating code where the function parameters will be a more
generic type that the actual parameter. They should be logically
matching and the decorations of the actual parameter must be a superset
of the decorations of the formal parameter.
We want to accept this code with an options so that spirv-opt can then
inline and fix the type mismatch. We will accept this under a new
options `--before-hlsl-legalization`.
The new option will also imply `relax-logical-pointer` so that HLSL
frontends will need to use just the one more generic option.
Moved the |LogicallyMatches| to the validation state to make it
available in more places. Also added a parameter to have it check the
decorations. I did not do a separate function for the decorations
because checking the decorations involves making sure the types
logically match anyway.
Fixes #2535
-
f815e6fe
by Steven Perron
at 2019-05-14T14:06:35Z
Update CHANGES
-
84503583
by Steven Perron
at 2019-05-15T13:29:28Z
Handle id overflow in sroa better. (#2582)
There is a case where sroa is not handling id overflow gracefully. It
is handled and an error message is output when the ids overflow.
Fixes https://crbug.com/961030.
-
ce19e217
by Steven Perron
at 2019-05-15T19:08:51Z
Finalize SPIRV-Tools v2019.3
-
84aa4946
by Steven Perron
at 2019-05-15T19:10:21Z
Start SPIRV-Tools v2019.4
-
fc7b5d8c
by alan-baker
at 2019-05-15T23:06:37Z
Mem model spv 1.4 (#2565)
* Update memory model support for SPIR-V 1.4
Fixes #2552
* Upgrade memory model now supports two memory access operands for
OpCopyMemory*
* in all cases the pass will first generate two operands by either
adding them or copying
* updates accounts for multiple operands
* tests
-
7e7745fc
by alan-baker
at 2019-05-15T23:38:41Z
Validate loop merge (#2579)
Fixes #2559
* Validate OpLoopMerge including loop controls
* add tests
* fix some bad tests
-
9dfd4b83
by greg-lunarg
at 2019-05-15T23:43:23Z
Bindless Validation: Instrument descriptor-based loads and stores (#2583)
Essentially, support UBOs and SSBOs, scalar and array (sized and unsized).
-
ff4feb44
by alan-baker
at 2019-05-16T21:59:30Z
Validate construct exits (#2459)
Validate structured exits from constructs
* Add checks that exits from a construct are valid
* Add Construct::IsStructuredExit()
* uses specific rules for each type of construct
* Added a test and check for #2213
* Adding tests for bad loop and continue exits
* Fix identification of continue block that prevented some selections
from having any blocks
-
47741f05
by Kévin Petit
at 2019-05-17T12:25:20Z
Validate OpenCL memory and addressing model environment rules (#2589)
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-
9f035269
by Kévin Petit
at 2019-05-21T13:17:50Z
Validate OpenCL environment rules for OpTypeImage (#2606)
It is currently not possible to use an Image Format that is
not Unknown without requiring a capability forbidden by the
OpenCL environment. As such the validation of Image Format
currently leans on capability validation entirely.
Fixes #2592.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-
0982f021
by Steven Perron
at 2019-05-21T16:45:00Z
Using the instruction folder to fold OpSpecConstantOp (#2598)
In order to try to reduce code duplication and to be able
to fold more cases, we want to use the instruction folder
when folding an OpSpecConstantOp with constant operands.
A couple other changes are need to make this work. First
GetDefiningInstruction| in the constant manager is able
to handle |type_id| being logically equivalent to another
type, so we updated the interface, and removed the assert.
Some tests were also updated because we not generate
better code because constants are not duplicated as much
as before.
No need for new tests. The functionality of the instruction folder is
already tested. There are tests check that the instruction folder is
being used correctly for OpCompositeExtract and OpVectorShuffle in the
existing test cases.
Fixes #2585.
-
60aaafbc
by alan-baker
at 2019-05-22T05:49:37Z
Allows breaks selection breaks to switches (#2605)
Fixes #2604
* Allow selection constructs to branch to the nearest selection merge
whose header is terminated by an OpSwitch
* Cleanup break and continue checks generally
* add tests
-
713da30b
by alan-baker
at 2019-05-22T06:02:53Z
Disallow merge targeting block with OpLoopMerge (#2610)
Fixes #2588
* Add a check that the merge block of OpLoopMerge may not be the block
that contains the OpLoopMerge
* add a test
-
d9c00e1d
by Steven Perron
at 2019-05-22T06:15:01Z
Add folding rules for OpQuantizeToF16 (#2614)
Adding the folding rules for OpQuantizeToF16, and fixed some matching
tests to check identify new lines.
-
13f61bf8
by Toomas Remmelg
at 2019-05-22T12:09:50Z
Update vloadn and vstoren validation to match the OpenCL Extended Instruction Set Specification (#2599)
-
4557d085
by Ryan Harrison
at 2019-05-22T17:06:53Z
Add in individual flags for Vulkan <-> WebGPU passes (#2615)
Adds flags and/or documentation for individual transformation passes
that had been missed in previous patches.
Fixes #2574
-
b0504239
by Alastair Donaldson
at 2019-05-22T17:24:11Z
Added an external dependency on protobufs, included when SPIRV_BUILD_FUZZER is defined, so that they can be used by the (upcoming) spirv-fuzz tool. Also updated the kokoro build scripts, for relevant targets, to clone an appropriate tag of the protobufs repo, and to pass -DSPIRV_BUILD_FUZZER to the configurations for which we intend to ultimately build spirv-fuzz. (#2616)
-
07a10197
by Kévin Petit
at 2019-05-23T12:35:14Z
Validate OpenCL environment rules for OpImageWrite (#2619)
Fixes #2593.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-
b8fe7211
by Sahil Parmar
at 2019-05-23T19:08:59Z
Allow arrays of out per-primitive builtins for mesh shaders (#2617)
- PrimitiveID, Layer, ViewportIndex
* Add validation tests for mesh builtins
-
4c73ebc4
by Kévin Petit
at 2019-05-24T18:33:43Z
Enable the base branch to be overridden in the code format check script (#2607)
Default to master.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-
3b5ab540
by Jonathon Anderson
at 2019-05-24T19:40:28Z
linker: Add tests for various type comparisons (#2613)
This adds a number of tests that check that all types will match to
identically written clones during linking, including nearly every Type
and some combinations (e.g. Functions of Arrays of Floats). Intent is
for use with https://github.com/KhronosGroup/SPIRV-Tools/pull/2580,
however that PR focuses on issues with TypeArray whereas these tests are
(more) comprehensive and test more subtle (and possibly incorrect)
cases.
A number of these tests fail, many are fixed by the aforementioned PR.
Some additional tests involving TypeForwardPointer are currently
disabled as they cause assertion failures.
-
42abaa09
by dan sinclair
at 2019-05-24T19:43:59Z
Remove MarkV and Stats code. (#2576)
* Remove MarkV and Stats code.
This Cl removes the MarkV and Stats code from SPIRV-Tools. This code was
unused and currently un-maintained.
-
fe9f8701
by Alastair Donaldson
at 2019-05-27T13:34:55Z
Add library for spirv-fuzz (#2618)
Adds a library for spirv-fuzz, consisting of a Fuzzer class that will
transform a module with respect to (a) facts about the module provided
via a FactManager class, and (b) a source of random numbers and
parameters to control the transformation process provided via a
FuzzerContext class. Transformations will be applied via classes that
implement a FuzzerPass interface, and both facts and transformations
will be represented via protobuf messages. Currently there are no
concrete facts, transformations nor fuzzer passes; these will follow.
-
37ae8671
by Alastair Donaldson
at 2019-05-27T14:46:35Z
Add spirv-fuzz tool. (#2631)
The current tool can parse basic command-line argument, but generates
a binary identical to the input binary, since no transformations are
yet implemented.
-
6c7db9c6
by Steven Perron
at 2019-05-27T20:28:14Z
Handle nested breaks from switches. (#2624)
* Handle nested breaks from switches.
There was a recent decision made to allow branches to the merge node of
a switch even if the switch is not the first enclosing construct. They
can be generated by glslang from break statements in switches.
Dead branch elimination seems to be the only optimization that will
break because of this change, so I will update that optimizations.
The change made are:
- Track switches in structured cfg analysis.
- In Dead branch elimination:
- Look for nested breaks that will require a switch instruction.
- Rewrite, but don't delete, switchs that are required even if it
could be replaced by an unconditional branch.
- When looking for the first break, consider the merge of a switch
as well.
See #2612.
* Fix variable names and comments.
* Add tests for the struct cfg analysis and switches.
* Fix typos in comments.
-
78b2b186
by Ryan Harrison
at 2019-05-28T14:18:03Z
Add fuzzer for WebGPU->Vulkan spirv-opt passes (#2625)
Fixes #2623
-
5a06fa46
by Ryan Harrison
at 2019-05-28T17:11:43Z
Add fuzzer for Vulkan->WebGPU spirv-opt passes (#2626)
Fixes #2622
-
f0518123
by Ryan Harrison
at 2019-05-28T18:51:52Z
Add WebGPU specific fuzzer for validation (#2628)
Fixes #2627
-
1b71e453
by Alastair Donaldson
at 2019-05-29T15:42:46Z
Add "split block" transformation. (#2633)
With this pass, the fuzzer can split blocks in the input module. This
is mainly useful in order to give other (future) transformations more
opportunities to apply.
-
3d62cb81
by greg-lunarg
at 2019-05-29T19:08:21Z
Instrument: Add version 2 of record formats (#2630)
New version has additional word in stage-specific section. Also
some changes in content for tesselation and compute shaders. Either
version can be invoked at pass creation. This is done to ease integration
and updating of validation layers. Version 1 is deprecated and eventually
will go away.
Also sneaking in fix to version 1 compute shaders.
-
0125b28e
by Ryan Harrison
at 2019-05-29T19:58:37Z
Add compact ids to WebGPU <-> Vulkan transformations (#2639)
Fixes #2634
-
e7866de4
by Pierre Moreau
at 2019-05-29T20:12:02Z
Linker: Better type comparison for OpTypeArray and OpTypeForwardPointer (#2580)
* Types: Avoid comparing IDs for in Type::IsSameImpl
When linking, we end up with duplicate types for imported and exported
types, that needs to be removed. The current code would reject valid
import/export pairs of symbols due to IDs mismatch, even if the types or
constants behind those ID were the same.
Enabled remaining type_match_test
Fixes #2442
-
209ff0ce
by Alastair Donaldson
at 2019-05-31T08:59:06Z
Add spirv-fuzz pass to permute blocks. (#2642)
The blocks within each function in the module will be permuted in a
randomized manner that respects dominance.
-
f99d7ad5
by Kévin Petit
at 2019-05-31T14:05:34Z
Validate OpenCL rules for ImageRead and OpImageSampleExplicitLod (#2643)
Fixes #2594.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-
7919b877
by dan sinclair
at 2019-05-31T14:28:33Z
Close opened file handles. (#2644)
The close for the file handles was missing in the error cases.
Fixes #2641
-
699e167d
by Ryan Harrison
at 2019-05-31T15:57:41Z
Remove asserts from GetUnderlyingType (#2646)
Fixes #2463
-
2c0111e6
by Jeff Bolz
at 2019-06-03T14:55:07Z
Add validation for SPV_EXT_fragment_shader_interlock (#2650)
-
620197bd
by Alastair Donaldson
at 2019-06-04T13:55:00Z
Add fuzzer pass that adds useful constructs to a module (#2647)
This new pass adds some basic ingredients to a module on which future
passes are likely to depend, such as boolean constants and some
specfic integer and floating-point values. This is not a fuzzer pass
in the true sense in that it does not employ randomization, but it
makes sense to define it as a fuzzer pass since it is the first of a
number of transformations passes that the fuzzer will run on a module.
-
4a00a80c
by Alastair Donaldson
at 2019-06-05T07:02:16Z
Add fuzzer pass to add dead breaks. (#2654)
This pass randomly add breaks to the merge blocks of selection and
loop constructs, such that the breaking edges will not be dynamically
reachable.
-
d01a3c3b
by David Neto
at 2019-06-05T20:35:50Z
Optimizer: Handle array type with OpSpecConstantOp length (#2652)
When it's an OpConstant or OpSpecConstant, then the literal
values are compared. If the OpSpecConstant also has a SpecId
decoration, then that's also compared.
Otherwise, it's an OpSpecConstantOp and we only compare the
ID of the OpSpecConstantOp instruction itself.
Fixes #2649
-
08cc49ec
by Alastair Donaldson
at 2019-06-05T20:54:47Z
Fix bug in 'split blocks', and add tests for fuzzer. (#2658)
There turned out to be a bug in the 'split blocks' transformation due
to blocks being split while they were being iterated over. This
change fixes that issue, and adds tests that were able to expose the
issue by running the fuzzer on some example shaders.
-
43fb2403
by greg-lunarg
at 2019-06-06T15:35:34Z
Instrument: Fix code for version 2 output format. (#2655)
Correct record size. Also bring version 2 tests up to version 1
equivalence.
-
0755d6ce
by Daniel Koch
at 2019-06-06T18:53:48Z
Add builtin validation for SPV_NV_shader_sm_builtins (#2656)
Also add a Builtin test generator variant that takes
capabilities and extensions.
Tests
- verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
accepted as Inputs in Vertex, Fragment, TessControl, TessEval, Geometry,
and Compute.
- verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
accepted as Inputs in MeshNV and TaskNV shaders.
- verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
accepted as Inputs in the 6 ray tracing stages
- verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
NOT accepted as Outputs.
- verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
NOT accepted as non-scalar integers (f32, uvec3)
- verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
NOT accepted as non-32-bit integers (u64)
-
a8ae579f
by Alastair Donaldson
at 2019-06-06T21:22:35Z
Add transformation to replace a boolean constant with a numeric comparison (#2659)
The transformation can, for example, replace "true" with "12.0 > 6.0",
if constants for those floating-point values are available.
This introduces a new 'id use descriptor' structure, which provides a
way to describe a particular use of an id, and which will be heavily
used in future transformations. Describing an id use is trivial if
the use occurs in an instruction that itself generates an id, but is
less straightforward if the id of interest is used by an instruction
such as OpStore that does not have a result id. The 'id use
descriptor' structure caters for such cases.
-
208d3132
by Steven Perron
at 2019-06-07T17:06:42Z
Cast __LINE__ to size_t (#2661)
Fixes #2648
-
9c083013
by Alastair Donaldson
at 2019-06-11T14:56:08Z
Add constant == uniform facts. (#2660)
Adds a new (and first) kind of fact to the fact manager, which is that
a specific uniform value is guaranteed to be equal to a specific
constant. The point of this is that such information (if known to be
true by some external source) can be used by spirv-fuzz to transform
the module in interesting ways that a static compiler cannot reverse
via compile-time analysis.
This change introduces protobuf messages for the fact, and adds
capabilities to the fact manager to store this kind of fact and
provide information about it.
-
b4bf7bcf
by alan-baker
at 2019-06-13T12:47:05Z
Add validation for Subgroup builtins (#2637)
Fixes #2611
* Validates builtins in the Vulkan environment:
* NumSubgroups
* SubgroupId
* SubgroupEqMask
* SubgroupGeMask
* SubgroupGtMask
* SubgroupLeMask
* SubgroupLtMask
* SubgroupLocalInvocationId
* SubgroupSize
-
42830e5a
by Alastair Donaldson
at 2019-06-13T13:08:33Z
Add replayer tool for spirv-fuzz. (#2664)
The replayer takes an existing sequence of transformations and applies
them to a module. Replaying a sequence of transformations that were
obtained via fuzzing should lead to an identical module to the module
that was fuzzed. Tests have been added to check for this.
-
9477c91d
by David Neto
at 2019-06-14T21:21:37Z
Fix uint -> uint32_t in fuzz.cpp (#2675)
Fixes MSVC builds
-
59983a60
by alan-baker
at 2019-06-15T04:34:18Z
Validate variable initializer type (#2668)
Fixes #249
* The pointed to type of Result Type must match the initializer type
* Had to update some opt tests to be valid
-
6cc2c8f4
by David Neto
at 2019-06-17T15:28:25Z
Another fix uint -> uint32_t (#2676)
-
400dbde0
by alan-baker
at 2019-06-17T17:13:07Z
Disallow stores to UBOs (#2651)
Fixes #2638
* Adds a check that errors out if there is a store to a UBO in the
Vulkan environment
* tests
* Function to trace pointers
-
3d5fb7b9
by alan-baker
at 2019-06-17T17:35:40Z
Validate Volatile memory semantics bit (#2672)
* Can only be used with Vulkan memory model
* Can only be used with atomics
* Bit setting must match for compare exchange opcodes
* Updated memory semantics checks to allow constant instructions
generally with CooperativeMatrixNV
-
2090d7a2
by alan-baker
at 2019-06-17T20:01:37Z
Handle volatile memory semantics in upgrade (#2674)
* If an atomic is decorated with volatile add the volatile bit to its
memory semantics
-
001e823b
by Alastair Donaldson
at 2019-06-18T17:41:08Z
Add fuzzer pass to obfuscate constants. (#2671)
Adds a new transformation that can replace a constant with a uniform known to have the same value, and adds a fuzzer pass that (a) replaces a boolean with a comparison of literals (e.g. replacing "true" with "42 > 24"), and then (b) obfuscates the literals appearing in this comparison by replacing them with identically-valued uniforms, if available.
The fuzzer_replayer test file has also been updated to allow initial facts to be provided, and to do error checking of the status results returned by the fuzzer and replayer components.
-
a132c9b6
by Ehsan
at 2019-06-19T16:18:13Z
Whitelist SPV_GOOGLE_user_type. (#2673)
-
fa981bc2
by Ryan Harrison
at 2019-06-19T18:19:54Z
Roll external/spirv-headers/ 8b911bd2b..de99d4d83 (8 commits) (#2682)
https://github.com/KhronosGroup/SPIRV-Headers/compare/8b911bd2ba37...de99d4d834ae
$ git log 8b911bd2b..de99d4d83 --date=short --no-merges --format='%ad %ae %s'
2019-06-12 dneto Add Volatile to Memory Semantics, for SPV_KHR_vulkan_memory_model
2019-06-10 ehsannas Add grammar and symbols for UserTypeGOOGLE extension to unified1.
2019-06-07 cepheus Add missing "version" : "None" to a bunch of reserved enumerants.
2019-06-07 cepheus Add more detail about reserving tokens to the README.
2019-06-07 cepheus Restore numerical order in enumerants.
2019-05-18 mchiasson Update CMakeLists.txt
2019-05-16 mchiasson updated as per code review
2019-05-11 mchiasson cmake development configuration package Fixes #104
Created with:
roll-dep external/spirv-headers
-
51b0d5ce
by Alastair Donaldson
at 2019-06-19T19:45:14Z
Represent uniform facts via descriptor set and binding. (#2681)
* Represent uniform facts via descriptor set and binding.
Previously uniform facts were expressed with resepect to the id of a
uniform variable. Describing them with respect to a descriptor set
and binding is more convenient from the point of view of expressing
facts about a shader without requiring analysis of its SPIR-V.
* Fix equality testing for uniform buffer element descriptors.
The equality test now checks that the lengths of the index vectors
match. Added a test that exposes the previous omission.
-
bec7e039
by Kévin Petit
at 2019-06-20T13:41:28Z
Add all accepted target environments to the tools' help texts (#2687)
Several tools take a --target-env option to specify the SPIR-V
environment to use. They all use spvParseTargetEnv to parse
the user-specified string and select the appropriate spv_target_env
but all tools list only _some_ of the valid values in their help
text.
This change makes the help text construction automatic from the
full list of valid values, establishing a single source of truth
for the values printed in the help text. The new utility function
added allows its user to specify padding and wrapping constraints
so the produced strings fits well in the various help texts.
Signed-off-by: Kévin Petit <kpet@free.fr>
-
2b84d25f
by alan-baker
at 2019-06-20T18:22:41Z
Fix store to uniform Vulkan check (#2688)
* Wrong operands were used for pointer and array types
* added tests to catch the wierd number corner
-
69b94599
by Ryan Harrison
at 2019-06-20T18:57:28Z
Add infrastructure for maintaining and using DEPS (#2684)
This adds in a script for updating DEPS and another for pulling in the
specified versions in the DEPS file.
DEPS entries that are not part of the documented build processs are
removed. Using the documented cmake process with them made for a very
sad state of one's checkout. If this removal breaks workflows we can
revist this, since the state is saved in git.
DEPS are rolled forward, so that this is taking use to a known good
state. These look like scary big rolls, but in reality the bots and
most people are running near HEAD for external/, so this integration
should already have been tested.
Summary of DEPS roll:
+ Rolling 3 dependencies
+ Roll external/effcee/ 04b624799..b83b58d17 (14 commits)
+ Roll external/googletest/ 98a0d007d..2f42d769a (576 commits)
+ Roll external/re2/ 6cf8ccd82..848dfb7e1 (90 commits)
+ Created with:
+ roll-dep external/effcee external/googletest external/re2 external/spirv-headers
Fixes #2665
-
7c294608
by Józef Kucia
at 2019-06-20T22:16:12Z
Basic validation for Component decorations (#2679)
* Add basic validation for Component decoration
* Add validator tests for Component decoration
-
df86bb44
by Kévin Petit
at 2019-06-21T12:47:27Z
Replace global static map with an array of pairs (#2691)
* Replace global static map with an array of pairs
\#2687 introduced a global static map, which isn't allowed by
the style guide and caused an issue in DXC.
This change replaces it with an array of pairs.
Signed-off-by: Kévin Petit <kpet@free.fr>
* Replace constexpr with const
Signed-off-by: Kévin Petit <kpet@free.fr>
-
888aeef8
by Józef Kucia
at 2019-06-25T17:28:16Z
Fix Component decoration validation for arrays (#2697)
-
dfcb5a1e
by Alastair Donaldson
at 2019-06-25T19:49:46Z
Refactor fuzzer transformations (#2694)
Introduced abstract class for transformations, and refactored all transformations to inherit from this abstract class.
-
efde6823
by Alastair Donaldson
at 2019-06-26T14:32:25Z
Disallow movement of unreachable blocks. (#2700)
Fixes #2695. Allowing unreachable blocks to be moved can lead to an
unreachable block A getting placed after an unreachable successor B,
which is a problem if B uses ids that A generates.
-
88183041
by Alastair Donaldson
at 2019-06-26T15:36:15Z
Got rid of redundant declaration. (#2698)
-
6ccb52b8
by Alastair Donaldson
at 2019-06-26T15:40:19Z
Warn when input facts are invalid. (#2699)
Fixes #2621.
Instead of aborting when an invalid input fact is provided, the tool
now warns about the invalid fact and then ignores it. This is
convenient for example if facts are specified about uniforms with
descriptor sets and bindings that happen to not be present in the
input binary.
-
e6e3e2cc
by Jason Macnak
at 2019-06-28T13:46:16Z
Update type for loaded builtin GlobalInvocationID in pass instrumentation (#2705)
When working on descriptor indexing validation for compute shaders, the
gl_GlobalInvocationID builtin was being loaded as uint which would cause
compute shaders instrumented by the bindless check pass to have:
%83 = OpLoad %uint %gl_GlobalInvocationID
%84 = OpCompositeExtract %uint %83 0
%85 = OpCompositeExtract %uint %83 1
%86 = OpCompositeExtract %uint %83 2
which results in validation failures:
error: line 127: Reached non-composite type while indexes still remain
to be traversed.
%84 = OpCompositeExtract %uint %83 0
for trying to extract a uint from a uint.
-
9702d47c
by Caio Marcelo de Oliveira Filho
at 2019-07-02T12:11:20Z
Validate that in OpenGL env block variables have Binding (#2685)
* Add spvIsOpenGLEnv helper
* Validate that in OpenGL env block variables have Binding
-
a6bfc26e
by David Turner
at 2019-07-03T20:26:06Z
Fix BUILD.gn for Fuchsia platform build. (#2692)
In order for the Fuchsia source tree to update its
version of SPIRV-Tools to a newer upstream, the
BUILD.gn needs to be slightly altered to take care
of the fact that it can be used with a different
GN //build set of rules and configs than the
Chromium one.
This is done by using |build_with_chromium|, already
defined by //build_overrides/build.gni, to guard
Chromium-specific statements.
+ Add a target to generate spirv-opt which is used by
Fuchsia to optimize shaders at build time for some
of its graphics libraries.
-
5a93e073
by Alastair Donaldson
at 2019-07-04T10:11:42Z
Refactor reducer options (#2709)
Avoids polluting the global namespace with a constant, and moves constructor to .cpp file as is done for spirv-reduce's options.
-
fe7cc9c6
by Steven Perron
at 2019-07-04T16:08:23Z
Do not inline OpKill Instructions (#2713)
It is illegal to inline an OpKill instruction into a continue construct because the continue header will no longer dominate the backedge.
This commit adds a check for this, and does not inline.
If we still want to be able to inline a function that contains an OpKill, we can add a new pass that will wrap OpKill instructions into its own function with just the single instruction.
I do not believe that this is a common case right now, so I will not do that yet.
Fixes #2433.
-
37e8f799
by Steven Perron
at 2019-07-04T18:14:49Z
Perform merge return with single return in loop. (#2714)
Inlining does not inline functions that have a single return that is in a loop. This is because the return cannot be replaced by a branch outside of the loop easily. Merge return knows how to rewrite the function so the return is replaced by a branch.
Fixes #2038.
-
b8ab8084
by Alastair Donaldson
at 2019-07-07T07:55:30Z
Shrinker for spirv-fuzz (#2708)
Adds to spirv-fuzz the option to shrink a sequence of transformations
that lead to an interesting binary to be generated, to find a smaller
sub-sequence of transformations that still lead to an interesting (but
hopefully simpler) binary being generated. The notion of what counts
as "interesting" comes from a user-provided script, the
"interestingness function", similar to the way the spirv-reduce tool
works. The shrinking process will give up after a maximum number of
steps, which can be configured on the command line.
Tests for the combination of fuzzing and shrinking are included, using
a variety of interestingness functions.
-
456cc598
by alan-baker
at 2019-07-08T18:10:13Z
Validate usage of 8- and 16-bit types with only storage capabilities (#2704)
Fixes #2669
* Check capabilities when validating variables
* validate load and store types
* Constant check
* Don't checks pointers for stores, constants and loads
* Validate composite instructions
* Validate conversions for 8- and 16-bit limited types
* Unified tests and expanded them
* Disallow OpCopyMemory
* new tests and update old tests
-
0c4feb64
by alan-baker
at 2019-07-08T19:07:36Z
Remove extra semis (#2717)
* Remove extra semi-colons
* Update re2 dep
-
3a252a26
by Ryan Harrison
at 2019-07-10T14:34:50Z
Update memory scope rules for WebGPU (#2725)
Fixes #2721
-
86e45efe
by Steven Perron
at 2019-07-10T15:37:16Z
Handle decorations better in some optimizations (#2716)
There are a couple spots where we are not looking at decorations when we should.
1. Value numbering is suppose to assign a different value number to ids if they have different decorations. However that is not being done for OpCopyObject and OpPhi.
1. Instruction simplification is propagating OpCopyObject instruction without checking for decorations. It should only do that if no decorations are being lost.
Add a new function to the decoration manager to check if the decorations of one id are a subset of the decorations of another.
Fixes #2715.
-
cd153db8
by Thomas Roughton
at 2019-07-10T18:12:19Z
Add —preserve-bindings and —preserve-spec-constants (#2693)
Add optimizer options to for preservation of spec constants and variable with
binding decorations. They are to be preserved even if they are unused.
-
5ce8cf78
by Steven Perron
at 2019-07-10T18:59:44Z
Change the order branches are simplified in dead branch elim (#2728)
Dead branch elimination needs to know about the constructs that a block is contained it when determining what to do with its merge instruction. We currently fold branches in block as we see them, which is parent constructs before their children. This causes the struct cfg analysis to crash because it tries to get the parent construct for a block after the parent has been folded.
This can be fixed by folding the branch of the children before the parents.
Fixes #2667.
-
50815125
by David Turner
at 2019-07-10T20:37:10Z
BUILD.gn: Add targets to build all command-line tools (#2727)
This adds all the command-line tools from the CMakeLists.txt
file to the BUILD.gn used by Chromium and Fuchsia.
+ Add a convenient "all_spirv_tools" GN target to rebuild
all command-line tools at once.
+ "gn format" pass to fix a few minor issues in the file.
Tested on Chromium with the following procedure:
1) Have a clean Chromium checkout
2) # Update to upstream spirv-headers (otherwise spirv-tools build fails)
cd $CHROMIUM_SRC/third_party/spirv-headers/src &&
git remote add upstream https://github.com/KhronosGroup/SPIRV-Headers.git &&
git fetch upstream &&
git checkout upstream/master
3) # Update to upstream spirv-tools (Chromium is tracking older revision)
cd $CHROMIUM_SRC/third_party/SPIRV-Tools/src &&
git remote add upstream https://github.com/KhronosGroup/SPIRV-Tools.git &&
git fetch upstream &&
git checkout -tb check-patch upstream/master &&
git cherry-pick <patch>
3) # Rebuild Chromium and all SPIR-V tools for the host
cd $CHROMIUM_SRC/src &&
gn gen out/Linux --args 'use_goma = true' &&
ninja -C out/Linux -j1000 -l30 gn_all all_spirv_tools
4) Run the command-line tools, e.g.:
out/Linux/spirv-link --help
-
32796376
by Jeff Bolz
at 2019-07-11T14:33:22Z
Add validation for SPV_EXT_demote_to_helper_invocation (#2707)
-
1a2de48a
by alan-baker
at 2019-07-11T17:05:14Z
Extra small storage validation (#2732)
Fixes #2729
* Check acceptable uses of small type generators
-
55adf4cf
by Ryan Harrison
at 2019-07-11T18:37:36Z
Update execution scope rules for WebGPU (#2730)
Fixes #2722
-
59de04ad
by Corentin Wallez
at 2019-07-12T14:35:59Z
BUILD.gn: Add deps and move files for `gn check` (#2735)
This makes SPIRV-Tools produce no GN check errors when used in Dawn and
ANGLE.
-
92c41ff1
by greg-lunarg
at 2019-07-12T15:02:10Z
Remove Common Uniform Elimination Pass (#2731)
Remove Common Uniform Elimination Pass
Fixes #2520.
-
032adc4d
by Ryan Harrison
at 2019-07-12T18:14:46Z
Correctly implement WebGPU related flag exclusions (#2737)
Fixes #2736
-
1fedf72e
by Jason Macnak
at 2019-07-15T20:24:42Z
Allow ray tracing shaders in inst bindle check pass. (#2733)
Adds the ray tracing stages (ray gen, intersection, any hit, closest hit,
miss, and callable) to the allowed stages in pass instrumentation and add
debug records for these stages to output the global launch id.
More information for ray tracing shaders:
- https://github.com/KhronosGroup/GLSL/blob/master/extensions/nv/GLSL_NV_ray_tracing.txt
-
230c9e43
by Steven Perron
at 2019-07-16T13:11:22Z
Fix bug in merge return (#2734)
* Fix bug in merge return
The merge return pass seems to assume that the only new edges in the cfg
are from return block to merge blocks. However, it is possible that a
merge block branches to a merge block when it did not before.
This change add a new variable to track all of the new edges. It also
renames some other variables and cleans us the code to make it a bit
easier to read.
Fixes #2702.
-
58e2ec25
by Jeff Bolz
at 2019-07-16T20:16:19Z
For Vulkan, disallow structures containing opaque types (#2546)
-
aa9e8f53
by Steven Perron
at 2019-07-17T18:59:05Z
Revert "Do not inline OpKill Instructions (#2713)" (#2749)
This reverts commit fe7cc9c61286cfe90f28d42034d7b13f8bcad7bd.
-
76b75c40
by David Neto
at 2019-07-18T15:37:28Z
Document opt::Instruction::InsertBefore methods (#2751)
-
bac82f49
by Jason Macnak
at 2019-07-22T12:37:44Z
Allow LOD ops in compute shaders with derivative group execution modes (#2752)
Also update existing derivative check to be based on the execution mode
instead of just the extension being present.
More info about extension:
- https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/NV/SPV_NV_compute_shader_derivatives.asciidoc
-
11516c0b
by Kévin Petit
at 2019-07-22T12:38:42Z
Validate storage class OpenCL environment rules for atomics (#2750)
This change refactors all storage class validation for atomics
to reflect the similar refactoring in the specification.
It is currently not possible to write a test for the check
rejecting Generic in an OpenCL 1.2 environment as the required
GenericPointer capability isn't allowed there. I've decided
to keep the check nonetheless to guard against the capability
becoming available without the rules for atomics being updated.
The ID changes in existing tests aren't ideal but introducing
names drags in a substantial refactoring of this file.
Contributes to #2595.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
-
3855447d
by greg-lunarg
at 2019-07-22T17:51:39Z
Bindless Instrument: Make init check depend solely on input_init_enabled (#2753)
* Bindless Instrument: Make init check depend solely on input_init_enabled
Previously was dependent on presense of descriptor_indexing extension
in SPIR-V, but this missed some cases. Tests updated to refect this new
policy.
* Fix format.
-
a94ddc26
by alan-baker
at 2019-07-23T15:23:32Z
Case validation with repeated labels (#2689)
Fixes #2686
* Update validation to handle the default case being mentioned multiple
times
* new tests
-
aea4e6b1
by alan-baker
at 2019-07-23T17:57:44Z
Fix block depth rule priority (#2755)
Fixes #2743
* Continue depth calculation should take precedence over merge calculation
-
c9190a54
by Steven Perron
at 2019-07-23T21:59:30Z
SSA rewriter: Don't use trivial phis (#2757)
When a phi candidate is marked as trivial, we are suppose to update all
of its uses to the reference the value that it is being folded to.
However, the code updates the uses misses `defs_at_block_`. So at a
later time, the id for the trivial phi can reemerge.
Fixes #2744
-
fb83b6fb
by Steven Perron
at 2019-07-24T17:56:54Z
Record correct dominators in merge return (#2760)
In merge return, we need to know the original dominator for a block in order to
traverse code from the original dominator to the new dominator and add
appropriate Phi nodes. The current code gets this wrong because the dominator
tree is build as needed. The first time we get the immediate dominator for a
function we just built the dominator tree and it takes into account that a
block has been split. The second time it does not.
This inconsistency needs to be fixed. We do that by recording the original
dominator for all blocks at the start of the pass.
If we were to record just the basic block, that could change if the block is
split. We want to traverse the code in the body of the original dominator,
whatever block it ends up in. To make this easy to track, we not save the
terminator instruction to represent the original dominator.
Fixes #2745
-
c7fcb8c3
by Steven Perron
at 2019-07-24T18:43:49Z
Process OpDecorateId in ADCE (#2761)
* Process OpDecorateId in ADCE
When there is an OpDecorateId instruction that is live,
the ids that is references must be kept live. This change
adds them to the worklist.
I've also updated a validator check to allow OpDecorateId
to be able to apply to decoration groups.
Fixes #1759.
* Remove dead code.
-
65f49dfc
by Ryan Harrison
at 2019-07-24T19:29:38Z
Remove unneeded future imports (#2739)
Also, adds explicitly setting python executable in the NDK build script, rewrites
some Python2-isms to 3isms, and formats some code.
Fixes #2738
-
1a89ac8b
by Alastair Donaldson
at 2019-07-25T12:50:33Z
Transformation and fuzzer pass to add dead continues (#2758)
Similar to the existing 'add dead breaks' pass, this adds a pass to
add dead continues to blocks in loops where such a transformation is
viable. Various functionality common to this new pass and 'add dead
breaks' has been factored into 'fuzzer_util', and some small
improvements to 'add dead breaks' that were identified while reviewing
that code again have been applied.
Fixes #2719.
-
bb0e2f65
by Steven Perron
at 2019-07-25T13:34:18Z
Fix check for unreachable blocks in merge-return (#2762)
Merge return expects unreachable merge block to look a certain way, and
unreachable continue blocks to look a certain way. What if an
unreachable block is both a merge and a continue? The continue is
suppose to take precedent, but merge-return implements it with the merge
taking precedent. This change flips that around.
Fixes #2746
-
f54b8653
by Alastair Donaldson
at 2019-07-25T17:09:49Z
Limit fuzzer tests so that they take less time to run (#2763)
The recently added fuzzer_replayer and fuzzer_shrinker tests were
rather heavyweight and were leading to CI timeouts. This change
reduces the runtime of those tests by having them do fewer iterations.
-
9559cdbd
by Diego Novillo
at 2019-07-26T16:33:40Z
Fix #2609 - Handle out-of-bounds scalar replacements. (#2767)
* Fix #2609 - Handle out-of-bounds scalar replacements.
When SROA tries to do a replacement for an OpAccessChain that is exactly
one element out of bounds, the code was trying to access its internal
array of replacements and segfaulting.
This protects the code from doing this, and it additionally fixes the
way SROA works by not returning failure when it refuses to do a
replacement. Instead of failing the optimization pass, SROA will now
simply refuse to do the replacement and keep going.
Additionally, this patch fixes the SROA logic to now return a proper status so we can
correctly state that the pass made no changes to the IR if it only found
invalid references.
-
7bafeda2
by Ryan Harrison
at 2019-07-29T16:53:27Z
Update OpControlBarriers rules for WebGPU (#2769)
* Update OpControlBarriers rules for WebGPU
Part of #2724
-
7fd2365b
by alan-baker
at 2019-07-29T20:20:43Z
Don't move debug or decorations when folding (#2772)
Fixes #2764
* Don't replace all uses when simplifying instructions, instead only
update non-debug, non-decoration uses
* added a test
* Add a new version of RAUW that takes a predicate to decide whether to
replace the use or not
* used in simplification pass
-
49797609
by Diego Novillo
at 2019-07-29T20:27:40Z
Protect against out-of-bounds references when folding OpCompositeExtract (#2774)
This fixes #2608.
The original test case had an out-of-bounds reference that ended up
folding into OpCompositeExtract that was indexing right outside the
constant composite.
The returned constant would then cause a segfault during constant
propagation.
-
ac3d1310
by David Neto
at 2019-07-30T02:55:18Z
Element type is const for analysis::Vector,Matrix,RuntimeArray (#2765)
This makes it symmetric with the result type of ...->element_type which
returns a const Type.
So now we can write code like this:
analysis::Vector v = ...
analysis::Vector(v->element_type(), 2);
-
7621034a
by David Neto
at 2019-07-30T14:38:46Z
Add opt test fixture method SinglePassRunAndFail (#2770)
Checks for failure status code and matches against
the expected error message.
-
4a28259c
by Ryan Harrison
at 2019-07-30T18:50:55Z
Update OpMemoryBarriers rules for WebGPU (#2775)
Part of #2724
-
31590104
by David Neto
at 2019-07-30T23:52:46Z
Add pass to inject code for robust-buffer-access semantics (#2771)
spirv-opt: Add --graphics-robust-access
Clamps access chain indices so they are always
in bounds.
Assumes:
- Logical addressing mode
- No runtime-array-descriptor-indexing
- No variable pointers
Adds stub code for clamping coordinate and samples
for OpImageTexelPointer.
Adds SinglePassRunAndFail optimizer test fixture.
Android.mk: add source/opt/graphics_robust_access_pass.cpp
Adds Constant::GetSignExtendedValue, Constant::GetZeroExtendedValue
-
3726b500
by alan-baker
at 2019-07-31T19:39:33Z
Treat access chain indexes as signed in SROA (#2776)
Fixes #2768
* In scalar replacement, interpret access chain indexes as signed counts
* Use Constant::GetSignExtendedValue and Constant::GetZeroExtendedValue
where appropriate
* new tests
-
5ada98d0
by Ryan Harrison
at 2019-07-31T21:15:47Z
Update WebGPU validation rules of OpAtomic*s (#2777)
Fixes #2723
-
0b70972a
by Geoff Lang
at 2019-08-01T23:33:55Z
Remove extra ';' after member function definition. (#2780)
This fixes a clang compiler warning about extra semicolons.
-
4f14b4c8
by Paul Thomson
at 2019-08-02T09:09:41Z
fuzz: change output extension and fix usage string (#2778)
-
698b56a8
by Alastair Donaldson
at 2019-08-05T17:00:13Z
Add 'copy object' transformation (#2766)
This transformation can introduce an instruction that uses
OpCopyObject to make a copy of some other result id. This change
introduces the transformation, but does not yet introduce a fuzzer
pass to actually apply it.
-
370375d2
by Ryan Harrison
at 2019-08-07T15:09:55Z
Add -fextra-semi to Clang builds (#2787)
This will catch instances on the bots where PRs introduce unneeded
semi-colons, which are going to cause downstream users problems.
Fixes #2781
-
b029d369
by Steven Perron
at 2019-08-07T16:17:26Z
Handle RelaxedPrecision in SROA (#2788)
If a member of a struct has a relaxed precision, sroa will not split the
struct. This means we do not get all cases. This commit handles these
cases. The other part is that the decoration needs to be passed on to
the new variables.
Fixes #2786
-
29af42df
by greg-lunarg
at 2019-08-08T13:45:59Z
Add SPV_EXT_physical_storage_buffer to opt whitelists (#2779)
This also fixes ADCE to not remove possibly needed OpTypeForwardPointer.
The bug, its fix and the corresponding test have a circular dependency
with the extension, so they are packaged together.
-
c26c2615
by Steven Perron
at 2019-08-08T14:52:01Z
Update CHANGES
-
4b64beb1
by Steven Perron
at 2019-08-08T14:53:19Z
Add descriptor array scalar replacement (#2742)
Creates a pass that will replace a descriptor array with individual variables. See #2740 for details.
Fixes #2740.
-
d65513e9
by Steven Perron
at 2019-08-08T14:55:48Z
Finalize SPIRV-Tools v2019.4