-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect optimization of Phi nodes in SPIR-V #5815
Labels
Comments
The problem is the ssa-rewrite pass. It is an odd error with a very particular control flow. This is the reduced spir-v, and it can be reproduced by running the ssa-rewrite pass: Command:
Input:
Output:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
spirv-opt
misoptimizes a series of Phi nodes and causes incorrect constant folding results.In the following shader program:
The
input1
is set to 1 during runtime. The program contains a series of control-flow structures. The outer loop should only iterate once sinceinput = 1
. The first if-statement should evaluate to false, thus the else branch is executed. The variablek
is set to be 1 in the statementk = g | k
sinceg
is 1. As such, the final color should be white.However, the
spirv-opt
misoptimizes the shader and the final color is black.Steps to reproduce
I provide a minimal Vulkan application that runs the give shader program. Simply follow the instruction in the
README.md
in the package. It should take less than a minute to reproduce the issue. I also provide the non-optimized, optimized, and the disassembled code from the optimized SPIR-V binary in the package.The text was updated successfully, but these errors were encountered: