KhronosGroup / KhronosGroup/SPIRV-Tools

Simplify float or integer constant to 0 or 1

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

Description

When manually simplifying a spirv-reduced shader I found that I could change:

```
%11 = OpConstant %7 0.600000024
```

to

```
%11 = OpConstant %7 0
```

without changing the interestingness of the shader, suggesting that spirv-reduce is not doing this simplification.

Contributor guide

Open the contributing guide

Research direction

Start at the spirv-reduce constant-simplification logic and use the reduced shader example in the issue as the reproduction case. Trace how float and integer constants are considered for simplification, then verify that eligible constants can become 0 or 1 without changing the shader's interestingness.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.