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

Add preserver-interface option to spirv-opt #5524

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

s-perron
Copy link
Collaborator

The optimizer is able to preserve the interface variables of the
shaders, but that feature has not been exposed to the command line
tool.

This commit adds an option --preserve-interface to spirv-opt that will
cause all calls to ADCE to leave the input and output variables, even if
the variable is unused. It will apply regardless of where the option
appears on the command line.

Fixes #5522

The optimizer is able to preserve the interface variables of the
shaders, but that feature has not been exposed to the command line
tool.

This commit adds an option `--preserve-interface` to spirv-opt that will
cause all calls to ADCE to leave the input and output variables, even if
the variable is unused. It will apply regardless of where the option
appears on the command line.

Fixes KhronosGroup#5522
@s-perron
Copy link
Collaborator Author

@alecazam Let me now if this fixes your problem. I'm still trying to get input to make sure this is the right direction. To me it seems the most intuitive.

@s-perron s-perron self-assigned this Jan 10, 2024
@alecazam
Copy link

That looks like it would work. To minimize code churn, could it be a member of the Optimizer class, and then you could just pull it from that. It would default to false if not set for Vulkan spirv codegen. Then you don't need the split of functions.

@s-perron
Copy link
Collaborator Author

I did it this way so I don't have to create another pass over the flags. If it is in the library then -O --preserve-interface would not preserve the interface. I could make it work, but I would have to traverse all of the flags once to look for the new flag. This would be a lot more string compares.

Copy link
Collaborator

@sudonatalie sudonatalie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@s-perron s-perron merged commit 155728b into KhronosGroup:main Jan 12, 2024
24 checks passed
@s-perron s-perron deleted the i5522 branch January 12, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CLI option to set CreateAggressiveDCEPass(true)
3 participants