Skip to content
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-opt problems #5596

Open
mihaly-sisak opened this issue Feb 28, 2024 · 3 comments
Open

spirv-opt problems #5596

mihaly-sisak opened this issue Feb 28, 2024 · 3 comments

Comments

@mihaly-sisak
Copy link

mihaly-sisak commented Feb 28, 2024

I try to ship optimized OpenGL code in my game EvoLife. Without this steps the shader compilation takes longer on first launch. My optimizing pipeline:

glslang --quiet -G -S <stage> -o <filename>.spv <filename>.glsl
spirv-opt -Oconfig=glsl_opt_config.cfg -o <filename>_opt.spv <filename>.spv
spirv-cross --version 430 --no-es --output <filename>_opt.<stage>.glsl <filename>_opt.spv

My problem is that I can not run spirv-opt with -O, I have to use -Oconfig with the file attached. My starting point was the -O list and I bisected which options cause issues.
glsl_opt_config.txt
Line 3 --merge-return: causes glsl shaders to behave differently than unoptimized versions
Line 4 --inline-entry-points-exhaustive: can not run without merge-return
Line 40 and 43 --merge-blocks: causes spirv-cross to abort on some shaders

Please let me know how can I help to resolve this problem. In the meantime maybe others will find this and can use the same workaround.

@cassiebeckley
Copy link
Contributor

Thank you for reporting this issue. Would you be able to post an example of a shader that behaves differently with --merge-return?

@mihaly-sisak
Copy link
Author

The input file is a 11 kLOC file that contains almost all of my glsl source code. Is it possible to provide an example without it being public?

@cassiebeckley
Copy link
Contributor

cassiebeckley commented Feb 29, 2024

It would be better if you were able to provide a minimal reproducible example of a SPIR-V shader which has this issue. You might be able to create one semi-automatically using spirv-reduce on <filename>.spv. In the "interestingness function", you'd want to run glslang -O and test for whether the behavior has changed.

It may also help if you can describe the change in the behavior of glsl shaders after running the merge-return pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants