KhronosGroup / KhronosGroup/SPIRV-Tools

spirv-opt: Loop unroller ignores OpPhi instructions in the loop's body

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

Description

[data.zip](https://github.com/KhronosGroup/SPIRV-Tools/files/5083970/data.zip)

spirv-opt produces an error
> error: line 36: OpPhi's incoming basic block 14[%14] is not a predecessor of 301[%301].
%302 = OpPhi %float %291 %14
>
> error: line 0: Validation failed after pass loop-unroll

when executed with `spirv-opt -o out.spv --validate-after-all --loop-unroll`.

Can be reproduced on b8de4f57.

Contributor guide

Open the contributing guide

Research direction

Start with data.zip and reproduce the failure using spirv-opt with --validate-after-all --loop-unroll, as described in the issue. Investigate the loop-unroll pass's handling of OpPhi instructions and verify the fix by rerunning the command without the validation error on commit b8de4f57's reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.