Commit Graph

343 Commits

Author SHA1 Message Date
Alastair Donaldson
8866fd7ae2
spirv-fuzz: Locate instructions more efficiently (#4189)
Avoids redundantly searching the whome module when locating an
instruction from its descriptor - instead, only the block containing
the instruction needs to be searched.
2021-03-17 09:28:57 +00:00
Alastair Donaldson
db2a706467
spirv-fuzz: Make adding equation instructions more efficient (#4190)
Avoids unnecessary invalidation of analyses.
2021-03-17 09:28:46 +00:00
Alastair Donaldson
e8ab7101f6
spirv-fuzz: Make PermutePhiOperands more efficient (#4191)
Amends def-use information rather than invalidating all analyses in
TransformationPermutePhiOperands.
2021-03-17 09:28:36 +00:00
Alastair Donaldson
478754c005
spirv-fuzz: Avoid invalidating analyses (#4176)
The performance of spirv-fuzz is sometimes poor due to analyses being
conservatively invalidated. This can lead to quadratic time algorithms
when a fuzzer pass applies O(N) transformations, and where every
transformation e.g. depends on def-use analysis and invalidates
def-use analysis (because building def-use analysis is O(N)).

This change avoids invalidating analyses for certain transformations.
2021-03-14 01:53:21 +00:00
Alastair Donaldson
f7cf3ec2a5
spirv-fuzz: Avoid unnecessary dependency (#4165)
The fuzzer library depended on CLIMessageConsumer, due to its explicit
use in a function. This change removes that dependency so that,
instead, a message consumer parameter is passed.
2021-03-10 15:37:14 +00:00
Vasyl Teliman
e6a9f4e430
spirv-fuzz: Fix the bug in TransformationReplaceBranchFromDeadBlockWithExit (#4140)
Fixes #4136.
2021-03-05 14:27:37 +00:00
Vasyl Teliman
7d514cf1c7
spirv-fuzz: Fix PartialCount (#4159)
Fixes #4158.
2021-03-05 11:13:28 +00:00
Alastair Donaldson
f7043c0de6
spirv-fuzz: Handle Vulkan SPIR-V versions (#4156)
Fixes #4155.
2021-03-03 22:29:57 +00:00
Vasyl Teliman
43cfa9bc1d
spirv-fuzz: Add persistent state to the fuzzer (#4137)
Adds persistent state to the fuzzer so that it can be used as a custom
mutator for mutation-based fuzzing.
2021-03-03 15:34:53 +00:00
Alastair Donaldson
4e31fdd4aa
spirv-fuzz: Fix OpPhi handling in DuplicateRegionWithSelection (#4065)
Avoid generating OpPhi on void types, and allow the transformation to
take place on regions that produce pointer and sampled image result
ids if such ids are not used after the region.

Fixes #3787.
2020-12-17 11:45:52 +00:00
Alastair Donaldson
b0e22d28f5
spirv-fuzz: Fix facts arising from CompositeConstruct (#4034)
Fixes #4023.
2020-11-25 12:03:05 +00:00
Alastair Donaldson
5ffa320fee
spirv-fuzz: Do not flatten conditionals that create synonyms (#4030)
Fixes #4024.
2020-11-24 20:18:23 +00:00
Alastair Donaldson
1f2fcddd39
spirv-opt: Set parent when adding basic block (#4021)
Ensures that the parent of a block is set in Function::AddBasicBlock.
Removes various now unnecessary calls to BasicBlock::SetParent.

Fixes #3912.
2020-11-13 12:33:15 -05:00
Alastair Donaldson
02195a029c
spirv-fuzz: Fixes to pass management (#4011) 2020-11-04 10:45:53 +00:00
Alastair Donaldson
bcf5b211db
spirv-fuzz: Add support for reining in rogue fuzzer passes (#3987)
Adds some functions that allow a fuzzer pass to check whether it is
spiralling out of control and exit early.  The fuzzer pass for adding
bit instruction synonyms now uses this.  Also make many methods in
FuzzerContext const.
2020-11-03 16:51:10 +00:00
Vasyl Teliman
7d250ed510
spirv-fuzz: Fix assertion failure in FuzzerPassAddCompositeExtract (#3995) 2020-11-03 15:09:36 +00:00
Vasyl Teliman
f9937bcc83
spirv-fuzz: Fix invalid equation facts (#4009)
Fixes #4008.
2020-11-03 15:06:55 +00:00
Vasyl Teliman
aa6035f1c6
spirv-fuzz: Fix bugs in TransformationFlattenConditionalBranch (#4006)
Fixes #4005.
Fixes #3993.
2020-11-03 15:03:08 +00:00
André Perez
5735576f87
spirv-fuzz: Fix bug related to transformation applicability (#3990)
This PR fixes a bug related to the transformation applicability.
When the OpNot case was implemented, its opcode was not
added to the list of supported bit instructions in IsApplicable.
So, the changes made are the following.

- Add OpNot to the list of supported bit instructions.
- Update the tests.
2020-11-03 10:48:30 +00:00
Ben Clayton
7403dfafd8
CMake: Add SPIRV_TOOLS_BUILD_STATIC flag (#3910)
If enabled the following targets will be created:

* `${SPIRV_TOOLS}-static` - `STATIC` library. Has full public symbol visibility.
* `${SPIRV_TOOLS}-shared` - `SHARED` library. Has default-hidden symbol visibility.
* `${SPIRV_TOOLS}`        - will alias to one of above, based on BUILD_SHARED_LIBS.

If disabled the following targets will be created:

* `${SPIRV_TOOLS}`        - either `STATIC` or `SHARED` based on the new `SPIRV_TOOLS_LIBRARY_TYPE` flag. Has full public symbol visibility.
* `${SPIRV_TOOLS}-shared` - `SHARED` library. Has default-hidden symbol visibility.

Defaults to `ON`, matching existing build behavior.

This flag can be used by package maintainers to ensure that all libraries are built as shared objects.
2020-10-29 09:25:26 -04:00
André Perez
abe2eff36f
spirv-fuzz: Add expand vector reduction transformation (#3869)
The following implementations are introduced:

- Transformation and fuzzer pass for expanding vector reduction.
- Unit tests to cover the instructions with different vector sizes.

Fixes #3768.
2020-10-23 14:59:08 +01:00
Vasyl Teliman
99ad4f1e29
spirv-fuzz: Don't replace irrelevant indices in OpAccessChain (#3988)
Part of #3980.
2020-10-23 14:52:22 +01:00
Vasyl Teliman
895dafcc1d
spirv-fuzz: Add FuzzerPassAddCompositeExtract (#3904)
Fixes #3806.
2020-10-23 14:49:50 +01:00
Alastair Donaldson
69f07da41b
spirv-fuzz: Fix mismatch with shrinker step limit (#3985)
Fixes #3984.
2020-10-22 23:23:59 +01:00
Alastair Donaldson
9223493f4d
spirv-fuzz: Fix off-by-one error in replayer (#3982)
Fixes #3981.
2020-10-22 20:07:09 +01:00
Alastair Donaldson
4f5423187d
spirv-fuzz: Get order right for OpSelect arguments (#3974)
Fixes #3948.
2020-10-22 16:05:51 +01:00
Alastair Donaldson
88f7bcb6af
spirv-fuzz: Do not add synonym-creating loops in dead blocks (#3975)
Fixes #3954.
2020-10-22 12:07:49 +01:00
Alastair Donaldson
64eaa9832f
spirv-fuzz: Skip OpTypeSampledImage when propagating up (#3976)
Fixes #3959.
2020-10-22 12:07:17 +01:00
Alastair Donaldson
53f2a69c19
spirv-fuzz: Pass OpUndef in function call if needed (#3978)
Fixes #3977.
2020-10-22 12:06:54 +01:00
Alastair Donaldson
de2c0ba202
spirv-fuzz: Fix off-by-one in TransformationCompositeConstruct (#3979) 2020-10-22 12:06:37 +01:00
Alastair Donaldson
dc4a182282
spirv-fuzz: Tolerate absent ids in data synonym fact management (#3966)
Fixes #3952.
2020-10-22 00:06:53 +01:00
Alastair Donaldson
8496780f57
spirv-fuzz: Fix to id availability (#3971)
Fixes #3958.
2020-10-21 22:52:47 +01:00
Alastair Donaldson
3b7aebca45
spirv-fuzz: Fix operand types (#3962)
Fixes #3945.
Fixes #3946.
2020-10-21 22:41:30 +01:00
Alastair Donaldson
a8d7062fe5
spirv-fuzz: Don't flatten conditional if condition is irrelevant (#3944)
Fixes #3942.
2020-10-21 21:26:59 +01:00
Alastair Donaldson
a3d5378df6
spirv-fuzz: Do not produce OpPhis of type OpTypeSampledImage (#3964)
Also removes some redundant validity checks in tests.

Fixes #3950.
2020-10-21 21:12:19 +01:00
Alastair Donaldson
7edd0525b9
spirv-fuzz: Restrict fuzzer pass to reachable blocks (#3970) 2020-10-21 20:52:58 +01:00
Alastair Donaldson
f03779a1a1
spirv-fuzz: Handle more types when extending OpPhi instructions (#3969)
Fixes #3953.
2020-10-21 20:52:36 +01:00
Alastair Donaldson
c794b70461
spirv-fuzz: Skip early terminator wrappers when merging returns (#3968)
Fixes #3955.
2020-10-21 20:51:10 +01:00
Alastair Donaldson
dc9c6407d6
spirv-fuzz: Avoid irrelevant constants in synonym-creating loops (#3967)
Fixes #3956.
2020-10-21 20:50:45 +01:00
Alastair Donaldson
26954c281e
spirv-fuzz: Skip dead blocks in FuzzerPassAddOpPhiSynonyms (#3965)
Fixes #3949.
2020-10-21 20:49:33 +01:00
Alastair Donaldson
5600fb85b6
spirv-fuzz: Avoid the type manager when looking for struct types (#3963)
Fixes #3947.
2020-10-21 18:28:05 +01:00
Alastair Donaldson
ba15b58862
spirv-fuzz: Fix to TransformationDuplicateRegionWithSelection (#3941)
Also incorporates a few style fixes.

Fixes #3940.
2020-10-20 18:59:53 +01:00
Alastair Donaldson
5984350044
spirv-fuzz: Skip OpFunction when replacing irrelevant ids (#3932)
Fixes #3927.
2020-10-20 18:58:42 +01:00
Alastair Donaldson
8362eae552
spirv-fuzz: Use component-wise selectors when flattening conditional branches (#3921)
Fixes #3920.
2020-10-20 18:57:56 +01:00
Alastair Donaldson
b1350659b6
spirv-fuzz: Avoid void struct member when outlining functions (#3936)
Fixes #3935.
2020-10-19 17:34:31 +01:00
Alastair Donaldson
fd0f295da6
spirv-fuzz: Do not allow Block-decorated structs when adding parameters (#3931)
Fixes #3929.
2020-10-19 17:34:04 +01:00
Alastair Donaldson
5d7893b376
spirv-fuzz: Fix to operand id type (#3937)
Fixes #3934.
2020-10-19 17:33:25 +01:00
Alastair Donaldson
cd1d3b6e0c
spirv-fuzz: Handle dead blocks in TransformationEquationInstruction (#3933)
Fixes #3926.
2020-10-19 17:32:56 +01:00
Alastair Donaldson
6cdae9da72
spirv-fuzz: Do not allow sampled image load when flattening conditionals (#3930)
Fixes #3928.
2020-10-19 17:32:26 +01:00
Alastair Donaldson
7e1825a596
spirv-fuzz: Take care of OpPhi instructions when inlining (#3939)
Fixes #3938.
2020-10-19 09:41:01 +01:00