Commit Graph

6 Commits

Author SHA1 Message Date
André Perez
5e5929455f
spirv-fuzz: Ignore specialization constants (#3664)
`FuzzerPassInterchangeSignednessOfIntegerOperands` and `FuzzerPassInterchangeZeroLikeConstants` both included specialization constants when trying to find integer constants with known values. However, this is incorrect behavior because we do not know the value of specialization constants. Furthermore, ConstantManager does not support them, and this led to crashes where we assumed we could look up specialization constants via the ConstantManager.

This change fixes both passes to ignore specialization constants.

Fixes #3663.
2020-08-12 18:59:47 +01:00
Stefano Milizia
96bcc82743
spirv-fuzz: Pass to replace int operands with ints of opposite signedness (#3612)
This PR introduces a new fuzzer pass, which:

- finds all integer vectors or constants
- finds or creates the corresponding constants with opposite
  signedness
- records such constants as synonyms of the first ones
- replaces the usages of the original constants with the new ones
  if allowed

Fixes #2677.
2020-07-30 19:48:29 +01:00
Vasyl Teliman
d6306537dc
spirv-fuzz: Don't use default parameters (#3583)
Fixes #3177.
2020-07-24 07:57:49 +01:00
Vasyl Teliman
bc2f78b7d9
spirv-fuzz: Fix usages of irrelevant constants (#3566)
Part of #3177.
2020-07-22 19:03:58 +01:00
Stefano Milizia
7dfd9b8680
spirv-fuzz: Implement MaybeApplyTransformation helper function (#3540)
This function can be used to apply a transformation only if it is
applicable and use it wherever this pattern is used.

Fixes #3530.
2020-07-17 13:01:35 +01:00
Stefano Milizia
f12c40f5a6
spirv-fuzz: Fuzzer pass to interchange zero-like constants (#3524)
This fuzzer pass:

For each zero-like constant, either finds the existing definition of
the corresponding toggled one (OpConstantNull becomes zero-valued
scalar OpConstant or vice versa) or creates a new one if it doesn't
exist and records that the two are synonyms

For each use of these constants, probabilistically decides whether to
change it with the corresponding toggled constant id (as described in
#3486 )

Only uses inside blocks of instructions are considered and not, for
example, in instructions declaring other constants.
2020-07-15 12:58:29 +01:00