Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Update to inline SPIR-V #59
Update to inline SPIR-V #59
Changes from 9 commits
c7ff8c5
343cb98
0de10ef
859108c
394e810
395d1d6
50e679b
c959e96
5bd1280
e20ba38
272026d
e35d92f
003ebbd
6176ba9
be6d20c
a9fa0e3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
If I understand correctly this will mean that the compiler will have to parse the body of the function in order to figure out the input storage class, correct? What happens if someone calls the
ext_builtin_input
function from a function that isn't an entry point, or only conditionally?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.
When the compiler sees the declaration of the function with this attribute, it will create the spir-v variable in the input storage class. It has all of the information that it needed to get the storage class correct.
The compiler will have to do an analysis to know if the variable needs to be added as an operand to the OpEntryPoint instruction (https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpEntryPoint). This problem is not unique to these builtins. Starting with version 1.4, all interface variables will have to be added in the same way. This proposal will not add any extra complication.
We need to traverse the entire call tree starting that the entry point, and it does not matter if it is conditionally referenced. However, if optimization is able to remove all references to it, then we can remove it from the OpEntryPoint, and we have an optimization in spirv-opt that does that.
I could reuse the language from the SPIR-V spec and say "add it to the OpEntryPoint instruction when it is referenced by the entry point’s call tree." Is that clear enough?
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.
Yes, that language makes it clearer. Thanks for the explanation.