-
Notifications
You must be signed in to change notification settings - Fork 566
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: Add const folding for CompositeInsert #4943
Conversation
@dnovillo - can this get a CI dispatch, this is preventing a real world app from using the Vulkan Validation layers (since it uses this pass and the shader had a |
source/opt/const_folding_rules.cpp
Outdated
for (size_t i = chain.size(); i > 0; i--) { | ||
// Need to insert any previous instruction into the module first | ||
// TODO - Is there a better way to find this position | ||
Module::inst_iterator* pos = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also insert at the top of the constants declared in the module, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, I guess I was going for keeping the instructions next to each other, but I also like the idea of making the code simpler and just putting at the top (since I should have an easy reference to its iterator)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I tried this approach and the issue currently there is only an iterator to the Types
which ends up inserting it above where the types are declared. Updated comment and think this is the best way currently to find the instruction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
friendly ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry! LGTM.
0fb4bae
to
a1cbaf5
Compare
a1cbaf5
to
1956d45
Compare
1956d45
to
9262600
Compare
Currently doing a
OpSpecConstantOp %x CompositeInsert
would segfaultThis change injects the extra needed
OpConstantComposite
in order to properly handle foldingCompositeInsert