Commit Graph

2970 Commits

Author SHA1 Message Date
Alastair Donaldson
e022659922
spirv-fuzz: Wrap OpKill and similar in function calls (#3884)
Part of #3717.
2020-10-08 22:33:14 +01:00
dan sinclair
11d5924227
Update val to handle reversed instruction sections. (#3887)
Currently the validator, when checking an instruction is in the correct
section, always advances the current section. This means if we have an
instruction from a previous section we'll end up reporting it as invalid
in a function definition. This error is confusing.

This CL updates the validator to check if the given opcode is from a
previous layout section before advancing the current section. If it is
from a previous layout section an error is emitted.
2020-10-08 13:10:12 -04:00
Alastair Donaldson
fc8264854c
spirv-fuzz: Replace dead-block terminators with OpKill etc. (#3882)
Fixes #3615.
2020-10-06 15:59:05 +01:00
Vasyl Teliman
63cc22d645
spirv-fuzz: TransformationPropagateInstructionDown (#3692)
Fixes #3691.
2020-10-06 13:38:19 +01:00
Alastair Donaldson
65b2a9e814
spirv-fuzz: Transformation to add wrappers for OpKill and similar (#3881)
Part of #3717.
2020-10-06 12:07:56 +01:00
Alastair Donaldson
624b16cd0c
spirv-fuzz: Use overflow ids when duplicating regions (#3878)
Fixes #3786.
2020-10-06 12:07:20 +01:00
Vasyl Teliman
bd0dd9cef1
spirv-fuzz: Fix rvalue references (#3883)
Fixes #3659.
2020-10-06 12:06:53 +01:00
Alastair Donaldson
f151337880
spirv-fuzz: Avoid using block-decorated structs in transformations (#3877)
Fixes #3875.
2020-10-02 20:01:08 +01:00
Alastair Donaldson
0e85530728
spirv-fuzz: Use overflow ids when inlining functions (#3880)
Fixes #3751.
2020-10-02 16:53:54 +01:00
Jaebaek Seo
67f8e2eddc
Debug info preservation in convert-local-access-chains pass (#3835)
1. DebugValue/DebugDeclare references of load/store must not change
the behaviors of the convert-local-access-chains pass
2. We have to properly set the scope and line information of new
instructions made by the convert-local-access-chains pass
2020-10-02 10:45:24 -04:00
Vasyl Teliman
d91afd8de2
spirv-fuzz: Refactor fact manager tests (#3879)
Fixes #3698.
2020-10-02 08:51:54 +01:00
Alastair Donaldson
b920b620ad
spirv-fuzz: Integrate spirv-reduce with shrinker (#3849)
This extends shrinking so that spirv-reduce is employed to simplify
the functions that are added by TransformationAddFunction.
2020-10-02 04:53:12 +01:00
Alastair Donaldson
74a711a76d
spirv-fuzz: Only recommend passes when a pass had an effect (#3863)
Fixes #3817.
2020-10-02 04:48:39 +01:00
Stefano Milizia
fc7860e2db
spirv-fuzz: Merge the return instructions in a function (#3838)
This PR introduces TransformationMergeFunctionReturns, which changes
a function so that it only has one reachable return statement.

Fixes #3655.
2020-10-02 04:45:44 +01:00
Jaebaek Seo
57abfd88c5
Debug info preservation in redundancy-elimination pass (#3839)
* Debug info preservation in redundancy-elimination pass
2020-10-01 09:22:16 -04:00
Jaebaek Seo
e246038364
Debug info preservation in if-conversion pass (#3861)
* Debug info preservation in if-conversion pass
2020-10-01 09:20:27 -04:00
Vasyl Teliman
16cc197c8c
spirv-fuzz: Refactor conditions in the fact manager (#3867)
Refactors conditions and names of some methods in the fact manager. Part of #3698.
2020-10-01 11:48:47 +01:00
Vasyl Teliman
615fbe6cbc
spirv-fuzz: TransformationWrapRegionInSelection (#3674)
Fixes #3675.
2020-10-01 09:54:10 +01:00
Alastair Donaldson
f2b8a4ee51
spirv-fuzz: Enable some passes with high probability (#3860)
Fixes #3764.
2020-10-01 09:07:06 +01:00
Alastair Donaldson
50e04f6123
spirv-fuzz: Do not add constants for Block-decorated structs (#3862)
Fixes #3794.
2020-10-01 09:06:36 +01:00
Vasyl Teliman
8edd79ddcc
spirv-fuzz: Fix to FuzzerPassFlattenConditionalBranches (#3865)
Fixes #3864.
2020-10-01 09:06:00 +01:00
Vasyl Teliman
719bade4ff
spirv-fuzz: Fix TransformationRecordSynonymousConstants (#3868)
Fixes #3866.
2020-09-30 17:05:10 +01:00
Alastair Donaldson
009facc978
spirv-fuzz: Fix flatten conditional branch transformation (#3859)
Fixes #3850.
2020-09-30 11:43:40 +01:00
Alastair Donaldson
fcb22ecf0f
spirv-fuzz: Report fresh ids in transformations (#3856)
Adds a virtual method, GetFreshIds(), to Transformation. Every
transformation uses this to indicate which ids in its protobuf message
are fresh ids. This means that when replaying a sequence of
transformations the replayer can obtain a smallest id that is not in
use by the module already and that will not be used by any
transformation by necessity. Ids greater than or equal to this id
can be used as overflow ids.

Fixes #3851.
2020-09-29 22:12:49 +01:00
dan sinclair
c6ca885c0b
[spirv-dis] Add some context comments to disassembly. (#3847)
This CL adds some extra new lines and context comments into the
spirv-dis output format. This CL adds:

 - Blank line and '; Annotations' before decorations
 - Blank line and '; Debug Information' before debug instructions
 - Blank line and '; Types, variables and constants' before type section
 - Blank line and '; Function <name>' before each function.

Issue #788
2020-09-28 10:59:50 -04:00
Maksim Ivanov
446adb05ff
Fix use-after-move in val/validate.cpp (#3848)
Fix a use-after-move (potential) bug found by the
"bugprone-use-after-move" clang-tidy check.

This is part of a Chromium-related effort (see
https://crbug.com/1122844).
2020-09-28 10:49:24 -04:00
Antoni Karpiński
4b07d50cd9
spirv-fuzz: Fix bug in TransformationDuplicateRegionWithSelection (#3819)
The following changes are introduced:

1. Entry block might have more than one predecessor, even if it is not
   a selection/loop merge block. However Apply method asserts that
   there is only one predecessor. Now, IsApplicable method ensures
   that there is only one predecessor.

2. In fuzzer pass we exclude both loop headers and selection headers
as potential exit blocks.

Fixes #3827.
2020-09-26 19:18:41 +01:00
André Perez
fec56146a7
spirv-fuzz: Support OpNot bit instruction case (#3841)
This PR implements the OpNot instruction for the
add bit instruction synonym transformation. In addition,
some code improvements have been made.
2020-09-26 10:42:46 +01:00
Alastair Donaldson
9e17b9d07a
spirv-fuzz: Return IR and transformation context after replay (#3846)
Before this change, the replayer would return a SPIR-V binary. This
did not allow further transforming the resulting module: it would need
to be re-parsed, and the transformation context arising from the
replayed transformations was not available. This change makes it so
that after replay an IR context and transformation context are
returned instead; the IR context can subsequently be turned into a
binary if desired.

This change paves the way for an upcoming PR to integrate spirv-reduce
with the spirv-fuzz shrinker.
2020-09-25 09:58:10 +01:00
Paul Thomson
e12087d6c3
spirv-fuzz: fix test (#3845)
Fix test that broke due to a merge.
2020-09-24 19:38:50 +01:00
Alastair Donaldson
9edeeafdb6
spirv-fuzz: Use unique_ptr<FactManager> in TransformationContext (#3844)
TransformationContext now holds a std::unique_ptr to a FactManager,
rather than a plain pointer. This makes it easier for clients of
TransformationContext to work with heap-allocated instances of
TransformationContext, which is needed in some upcoming work.
2020-09-24 17:28:49 +01:00
Ehsan Nasiri
50dacda553 Start SPIRV-Tools v2020.6 2020-09-24 10:58:53 -04:00
Ehsan Nasiri
b27e039c68 Finalize SPIRV-Tools v2020.5 2020-09-24 10:53:49 -04:00
Ehsan Nasiri
a5903a969b Update CHANGES 2020-09-24 10:52:17 -04:00
Vasyl Teliman
330c72549a
spirv-fuzz: Support dead blocks in TransformationAddSynonym (#3832)
Fixes #3830.
2020-09-24 14:18:07 +01:00
Vasyl Teliman
36185f8b09
spirv-fuzz: Move IRContext parameter into constructor (#3837)
This PR converts IRContext parameter in fact managers into a class field. Part of #3698.
2020-09-24 12:27:59 +01:00
Simran
0e7fe4d35b
Add missing backticks around <result-id> (#3840) 2020-09-23 20:20:57 -04:00
Ryan Harrison
d1bb98fd48
Validate SPIRV Version number when parsing binary header (#3834)
Fixes #3831
2020-09-23 11:59:41 -04:00
Stefano Milizia
67525bded1
spirv-fuzz: Create synonym of int constant using a loop (#3790)
This transformation, given a constant integer (scalar or vector) C,
constants I and S of compatible type and scalar 32-bit integer constant
N, such that C = I - S*N, adds a loop which subtracts S from I, N
times, creating a synonym for C.

The related fuzzer pass randomly chooses constants to which to add
synonyms using this transformation, and the location where they should
be added.

Fixes #3616.
2020-09-23 14:10:02 +01:00
Richard S. Wright Jr
7cc4b4d2ca
Fix compiler error on macOS with XCode12 (#3836) 2020-09-22 19:12:23 -04:00
Vasyl Teliman
5a5b750aaf
spirv-fuzz: Handle OpPhis in TransformationInlineFunction (#3833)
Fixes #3829.
2020-09-22 21:35:56 +01:00
Steven Perron
0a1fb588cd Update CHANGES 2020-09-22 09:23:45 -04:00
Alastair Donaldson
125b642419
spirv-fuzz: Refactor fuzzer, replayer and shrinker (#3818)
In preparation for some upcoming work on the shrinker, this PR changes
the interfaces of Fuzzer, Replayer and Shrinker so that all data
relevant to each class is provided on construction, meaning that the
"Run" method can become a zero-argument method that returns a status,
transformed binary and sequence of applied transformations via a
struct.

This makes greater use of fields, so that -- especially in Fuzzer --
there is a lot less parameter passing.
2020-09-22 10:07:58 +01:00
Alastair Donaldson
60ce96e2ff
spirv-fuzz: Add pass recommendations (#3757)
This change introduces various strategies for controlling the manner
in which fuzzer passes are applied repeatedly, including infrastructure
to allow fuzzer passes to be recommended based on which passes ran
previously.
2020-09-18 15:51:35 +01:00
Stefano Milizia
2945963cce
spirv-fuzz: Consider all ids from dead blocks irrelevant (#3795)
This PR modifies the FactManager methods IdIsIrrelevant and GetIrrelevantIds so
that an id is always considered irrelevant if it comes from a dead block.

Fixes #3733.
2020-09-18 11:45:02 +01:00
Alastair Donaldson
50ae4c5f44
Fix header guard macros (#3811) 2020-09-18 05:37:30 +01:00
Antoni Karpiński
296e9c7bc8
spirv-fuzz: Fix TransformationDuplicateRegionWithSelection (#3815)
Introduces two changes:

- duplicated_exit_region refers to a correct block, regardless of the order
  of the blocks in the enclosing function.
- Exclude the case where the continue target is the exit block.
2020-09-18 05:36:08 +01:00
sfricke-samsung
937a757f04
spirv-val: Add DeviceIndex (#3812) 2020-09-17 08:27:40 -04:00
Ryan Harrison
34ef0c3fdc
Fix missed modification flagging (#3814)
Fixes #3813
2020-09-16 19:57:04 -04:00
André Perez
748edbf8c1
spirv-fuzz: Use an irrelevant id for the unused components (#3810)
Fixes #3808.
2020-09-16 21:23:32 +01:00