Skip to content

spirv-fuzz: Introduce a loop to create a synonym of an integer constant #3616

@afd

Description

@afd

*Motivation for transformation:

  • Increase the extent to which loops are used in the SPIR-V module
  • Provide the possibility to replace constant uses with the results of computations coming from loops
  • The new loops can be transformed further by other fuzzer passes to make them more interesting.

Suppose that C is an integer constant (possibly a vector).

Decide on:

  • A number of loop iterations, N
  • A step count vector S
  • An initial value vector I such that C = I - N*S

Introduce a loop that does:

temp = I // A constant containing value I
for (int new_counter = 0; new_counter < N; new_counter++) {
  temp = temp - S;
}

The number of loop iterations should be fairly small, to avoid very long-running loops.
The step count can vary between components of the vector, but overall should be small enough that we don't have overflow problems.
We should be careful about the extent to which we nest these - that could be taken care of in the fuzzer pass, not the transformation, though.

Then add a synonym between C and the final value of temp.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions