KhronosGroup / KhronosGroup/SPIRV-Tools

spirv-fuzz: Wrap region in single iteration loop

Open
#3,613 1 comment 0 reactions 0 assignees View on GitHub
component:fuzzer
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

This transformation should take region R and turn it into, essentially:

```
for (int new_counter = 0; new_counter < 1; new_counter++) {
R;
}
```

Several variations are possible here:

(1) The loop can be "for" style, with the check and break occurring in the loop head, or "do-while" style, with the check and break occurring at the back-edge block

(2) The loop counter can be a variable that is loaded and stored, or an id for which OpPhi captures the loop-carried dependence

(3) In the case where the loop counter is a variable, it can be Private or Function

(4) The counter could start from 0 and go to 1, or start from 1 and go to 0, and the check can use != or an ordered comparison.

(5) The counter could be integer or floating-point

Ideally the transformation should support all of these. I'm unsure whether this should be achieved by one monolithic transformation or a couple of different transformations. For instance, the "for" and "do-while" approach have different consequences for ids defined in the new loop and used after the loop, as the "for" approach changes dominance.

Contributor guide

Open the contributing guide

Research direction

The issue names no file, test, or entry point. Start by surveying existing spirv-fuzz transformations and how they handle region R, then settle the loop form, counter representation, storage class, comparison, and numeric type before implementing. Done means the transformation supports the agreed variations and preserves the required dominance behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.