Commit Graph

2192 Commits

Author SHA1 Message Date
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
greg-lunarg
9540f2d981 Instrumentation: Fix instruction index when multiple functions (#2389) 2019-02-15 09:49:18 -05:00
Steven Perron
1b0047f210
Add pass to remove dead members. (#2379)
Add a pass that looks for members of structs whose values do not affects
the output of the shader. Those members are then removed and just
treated like padding in the struct.
2019-02-14 13:42:35 -05:00
Ryan Harrison
0167a20b0a
Move usage detection to after all instructions are registered (#2378)
This is required to properly handle uses of forward declared ids. Since forward
declared ids were not being properly covered by the validator this uncovered a
bunch of small issues that needed to be resolved to get tests passing again.

Fixes #2373
2019-02-13 14:06:56 -05:00
Takuto Ikuta
0187c190b5 Fix BUILD.gn (#2381)
extensions_enum.inc is included from source/table.h.
So spvtools_core_enums_unified1 target should be in public_deps of
spvtools target.

This is for crbug.com/931596
2019-02-13 10:24:06 -05:00
alan-baker
354205b3dc
Don't merge unreachable blocks (#2375)
Fixes #2374

* Block merging no longer merges unreachable blocks into their
successors
 * added a test
2019-02-12 09:24:01 -05:00
Paul Thomson
40a7940e05 Fix merge blocks opportunity to check if still enabled (#2370)
Fix MergeBlocksReductionOpportunity so it checks whether it is still enabled

Fixes #2369. Added tests.
2019-02-11 16:26:37 -05:00
Ryan Harrison
12b3d7e9d6 Add strip-debug to webgpu-mode passes (#2368)
Fixes #2366
2019-02-08 14:26:17 -05:00
Ryan Harrison
a0ff7c5120
Add better error message to ValidateInstructions (#2365)
Fixes #2364
2019-02-08 11:24:02 -05:00
Alastair Donaldson
34c5ac614c
Fixes #2358. Added to the reducer the ability to remove a function t… (#2361)
* Fixes #2358.  Added to the reducer the ability to remove a function that is not directly called.  Factored out some code from the optimizer to help with this.
2019-02-08 16:20:29 +00:00
dan sinclair
10a7def6c0
Smoketest should use KhronosGroup glslang (#2363) 2019-02-07 15:32:41 -05:00
dan sinclair
39bfb6b978
Make spvParseTargetEnv public (#2362)
This CL moves the method to parse the SPIRV environment into the public headers. This will allow other applications to re-use the same parsing logic.
2019-02-07 14:49:15 -05:00
greg-lunarg
cf21146137 Expand bindless bounds checking to runtime-sized descriptor arrays (#2316) 2019-02-07 14:00:36 -05:00
alan-baker
9b6ba4d1c5
Allow arrayed storage images for NonWritable decoration (#2358)
Fixes #2354

* Storage image pointer registration allows optional level of arraying
* Added a test
2019-02-06 15:20:19 -05:00
alan-baker
117a1fd11f
Validate variable pointer related function call rules (#2270)
Fixes #2105

* Check storage class validity
* Check memory object declaration validity
2019-02-06 14:10:40 -05:00
Ryan Harrison
0f4bf0720a
Add flatten-decorations flag to webgpu-mode flags (#2348)
Fixes #2272
2019-02-05 14:07:53 -05:00
Ryan Harrison
368567bc51
Convert deprecated GoogleTest fixture to the new version (#2357)
Fixes #2356
2019-02-05 10:33:55 -05:00
Alastair Donaldson
adbbe20241 Mention the reducer tool and location in the README. (#2341)
* Mention the reducer tool and location in the README.

* Remark on how to get info on specifying interestingness.
2019-02-04 09:41:38 -08:00
Dan Ginsburg
e3c64a374b Do not build spirv-reduce on iOS/tvOS/watchOS - it requires std::system which is not available on those platforms (#2355) 2019-02-04 09:39:39 -08:00
Alastair Donaldson
37861ac106
Merge blocks in reducer (#2353)
Fixes #2120 

Enhanced the reducer so that it can merge blocks together, leveraging the functionality extracted from the block_merge pass in the optimizer.
2019-02-01 14:56:54 +00:00
Steven Perron
453b7c85c8
Fix up some test (#2351)
I made a mistake merging a PR, and it contained tests that break with
the latest google test.  I've fixed them up.
2019-01-31 16:44:15 -05:00
Ryan Harrison
846d12afed
Add whitelist for decorations in WebGPU (#2346)
Fixes #2273
2019-01-31 16:25:46 -05:00
alan-baker
63e032f910
Remove unused lambda capture (#2350) 2019-01-31 15:57:45 -05:00
Alastair Donaldson
3b6fee3dae Fixes #2338. Added functionality to remove OpPhi instructions (replacing their uses) when merging blocks (#2339)
* Fixes #2338.  Added check for phi node before merging blocks.

* Added functionality to merge blocks A and B even when B starts with OpPhi instructions, by replacing uses of the OpPhi results with the definitions coming from A.  Added some tests for this.

* Fixed assertion.
2019-01-31 09:36:05 -05:00
Ryan Harrison
2acbf488b8
Add WebGPU specific validation for WorkgroupSize BuiltIn decoration (#2334)
Part of resolving #2276
2019-01-30 17:01:17 -05:00
Ryan Harrison
e2f4622627
Add WebGPU specific validation for multiple BuiltIn decorations (#2333)
Covers NumWorkgroups, LocalInvocationId & GlobalInvocationId

Part of resolving #2276
2019-01-30 17:00:58 -05:00
Ryan Harrison
3d2afb78c2
Add whitelist of allowed BuiltIn decorations for WebGPU (#2337)
Part of resolving #2276
2019-01-30 15:46:02 -05:00