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
SPIRV code fails validation after optimization #5624
Comments
Minimal reproducible example:
|
Before and after
|
This look like an issues with the isomorphic structs. This confuses the type manager when the type manager is not used correctly. This is a known source of bugs, but there is not enough activity on spirv-opt to make a major change to the type manager. I'll try fixing the code in this one place, and check if I can add an assert that might catch some of these cases. Assuming my guess at the root cause is correct. |
When dealing with structs the type manager merge two different structs into a single entry if they have all of the same decorations and element types. This is because they hash to the same value in the hash table. This can cause problems if you need to get the id of a type from the type manager because you could get either one. In this case, it returns the wrong one. The fix is to avoid using the type manager in certain places. I have not looked closely at all of the places the type manager is used to make sure it is used safely everywhere else. Fixes KhronosGroup#5624
When dealing with structs the type manager merge two different structs into a single entry if they have all of the same decorations and element types. This is because they hash to the same value in the hash table. This can cause problems if you need to get the id of a type from the type manager because you could get either one. In this case, it returns the wrong one. The fix avoids using the type manager in one place. I have not looked closely at other places the type manager is used to make sure it is used safely everywhere. Fixes KhronosGroup#5624
Hi,
I built a shader in slang that fails validation on
-O3
, but does not on-O1
. The slang team redirected me here as they think the problem comes from spirv-opt.Compiling the slang code from the slang ticket gives me
shader.spv
spirv file on-O0
, find it here: spirv_opt.zip.Calling
spirv-val shader.spv
from the 1.3.280 vulkan sdk gives me no validation errors for this file.Calling
spirv-opt --validate-after-all -O shader.spv -o shaderOpt.spv
results in this validation error:Can you fix this issue or point me to a workaround? Thanks!
The text was updated successfully, but these errors were encountered: