Commit Graph

2018 Commits

Author SHA1 Message Date
alan-baker
8129cf2f99
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
2019-04-02 14:37:05 -04:00
Paul Thomson
e2ddb9371e
reduce: add remove_selection_reduction_opportunity (#2485)
Fix #2484
2019-04-02 16:50:15 +01:00
alan-baker
c9874e5090
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
2019-04-02 10:05:28 -04:00
alan-baker
0300a464a4 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
2019-04-01 13:14:10 -04:00
alan-baker
320a7de5c9
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
2019-03-29 10:49:37 -04:00
Paul Thomson
fcb8453104
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.
2019-03-29 11:29:24 +00:00
alan-baker
2ff54e34ed
Handle function decls in Structured CFG analysis (#2474)
Fixes #2451

* Structured cfg analysis now handles functions with no basic blocks
* Added a test
2019-03-26 14:39:16 -04:00
alan-baker
42e6f1aa62
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
2019-03-26 14:38:59 -04:00
Paul Thomson
fb0753640a
reduce: fix loop to selection dominance query (#2477)
Fix #2457
2019-03-26 16:37:08 +00:00
Paul Thomson
7d1b176c1d
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.
2019-03-26 13:22:31 +00:00
Ryan Harrison
ffbecae56a
Check OpSampledImage is only passed into valid instructions (#2467)
Fixes #1528
2019-03-25 15:44:57 -04:00
Paul Thomson
2d52cbee49
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.
2019-03-21 14:28:06 +00:00
Paul Thomson
1f60f98964
reduce: remove unreferenced blocks pass (#2398) 2019-03-21 13:32:21 +00:00
Ryan Harrison
08b54d9e45
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
2019-03-19 12:39:37 -04:00
greg-lunarg
e1a76269b6 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.
2019-03-19 09:53:43 -04:00
Alan Baker
9244e6ff62 Reverting commit da5a780ff9 2019-03-18 15:14:41 -04:00
SarahM0
da5a780ff9 Variable pointers cannot be an operand to OpArrayLength 2019-03-18 14:07:36 -04:00
David Neto
2ac348b5c0
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
2019-03-14 20:38:53 -04:00
Ryan Harrison
e545522146
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
2019-03-14 13:34:33 -04:00
alan-baker
bdcb155163
Relax function call parameter check (#2448)
Fixes #2447

* Allow sub-objects for UniformConstant storage class
* Updated tests
2019-03-14 12:45:31 -04:00
Steven Perron
5186ffedb3
Remove duplicates from list of interface IDs in OpEntryPoint instruction (#2449)
* Remove duplicates from list of interface IDs in OpEntryPoint instruction

Fixes #2002.
2019-03-13 15:46:31 -04:00
Ryan Harrison
6df8a917a4
Add validation of storage classes for WebGPU (#2446)
Fixes #2445
2019-03-13 13:01:25 -04:00
Jaebaek Seo
a5c06c903c
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
2019-03-13 12:25:24 -04:00
Steven Perron
9d29c37ac5
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
2019-03-13 10:40:49 -04:00
Ryan Harrison
b75f4362f0
Add validation for ExecutionMode in WebGPU (#2443)
Fixes #2437
2019-03-12 14:50:25 -04:00
Ryan Harrison
b1ff15f220
Add missing DepthGreater case to Fragment only check (#2440)
Fixes #2439
2019-03-12 11:27:40 -04:00
Ryan Harrison
b12e7338ee
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
2019-03-08 13:01:09 -05:00
fjhenigman
a2ef7be242
Add Linux ASAN bot configs. (#2427)
Fix the ASAN part of the bot script.
Add continuous and presubmit Linux ASAN bot configurations.
2019-03-06 17:21:24 -05:00
Steven Perron
07f80c4df1
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.
2019-03-06 14:11:01 -05:00
alan-baker
86f6ac086c Add a test for two back-edges in a continue (#2418) 2019-03-05 11:52:02 -05:00
Ehsan
5fb83a9708
Allow NonWritable to target struct members. (#2420)
It should be allowed for the NonWritable decoration to be applied to
structure type members.
2019-02-27 16:11:50 -05:00
Steven Perron
32b0f6739f
Use correct option in spvTextToBinary. (#2416)
Fixes #2414.
2019-02-26 16:52:33 -05:00
Steven Perron
d800bbbac9
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.
2019-02-26 09:06:51 -05:00
Jeff Bolz
002ef361ca Add validation for SPV_NV_cooperative_matrix (#2404) 2019-02-25 17:43:11 -05:00
Sarah
fc3897b5f5
Validate: (data) Block can't appear within a Block (#2410)
A Block or BufferBlock cannot be nested within another Block or BufferBlock
2019-02-25 10:37:43 -05:00
François Bertel
37b584a736 Fixed undefined reference to 'clock_gettime' by linking rt library (#2409) 2019-02-25 08:57:34 -05:00
Steven Perron
a006cbc1d0
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.
2019-02-22 12:51:22 -05:00
Sarah
4c43afcade
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
2019-02-21 12:03:52 -05:00
Steven Perron
fde69dcd80
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.
2019-02-20 20:05:08 -05:00
Steven Perron
8eddde2e70
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.
2019-02-20 18:59:41 -05:00
Sarah
76730a46a1
In Vulkan, disallow BufferBlock on StorageBuffer variables (#2380)
To fix #2168.
2019-02-20 11:50:57 -05:00
Steven Perron
5994ae2a04 Start SPIRV-Tools 2019.3 2019-02-20 11:05:57 -05:00
Steven Perron
61dfd8492b Finalize SPIRV-Tools 2019.2 2019-02-20 11:04:41 -05:00
Sarah
bf23ed887c
OpAtomicLoad, OpAtomicStore, OpAtomicExchange can operate on int or float value. Except for Vulkan environment that only operates on int value. (#2385)
To fix: #2128. Already implemented. This PR adds witness tests.
2019-02-20 11:00:58 -05:00
Steven Perron
80496f42a5 Update CHANGES 2019-02-19 12:54:42 -05:00
greg-lunarg
2f84b5de9a Bindless: Fix computation of set and binding for runtime bounds check (#2384)
Also fix test to use non-zero set and binding which will make error
more obvious.
2019-02-19 11:43:30 -05:00
dan sinclair
528fea2b1e
Fixup unused variables (#2402) 2019-02-19 11:11:04 -05:00
Jamie Madill
4b42cd19d3 BUILD.gn: Only build tests in Chromium. (#2392)
The prior GoogleTest integration was incomplete and produced errors
when building with 'gn check' enabled. Fix this by scoping the test
integration to Chromium.

Fixes Issue #2382
2019-02-19 10:38:38 -05:00
Ryan Harrison
6d20f62570
Refactor webgpu-mode pass ran tests to be parameterized (#2395)
Fixes #2394
2019-02-15 11:08:05 -05:00
Steven Perron
78ac954c41
Mark type id of unknown instructions at fully used. (#2399) 2019-02-15 10:49:49 -05:00