-
Notifications
You must be signed in to change notification settings - Fork 816
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: Remapper: allow 64 bit literals in OperandVariableLiteralId iteration #456
Conversation
numOperands -= 2; | ||
case spv::OperandVariableLiteralId: { | ||
// word-2 is the position of the selector ID. | ||
const unsigned literalSize = idTypeSizeInWords(asId(word-2)); |
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.
The "word-2" expression is strongly tied to the fact that this must be an OpSwitch instruction. It just so happens that OpSwitch is the only case so far where we have an OperandVariableLiteralId.
I'd probably assert that opcode == OpSwitch.
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.
Good point. Will change.
Works for me. The only other place in the grammar where Ids and literals are mixed is in OpGroupMemberDecorate, but there the literals are the 32-bit index of the structure member. So this problem won't occur in that context. This patch works on the submitted case, and also in the following, were I made OpConstant for 64-bit integer and 64-bit float:
|
Cool; thanks for the review. I've pushed a new version with your review changes. |
Ooops. This is causing a failure in the Vulkan CTS. |
This is the failing test case, in GLSL form.
|
I've narrowed it down to the |
If I use |
…r-literal64" This reverts commit ad08b30, reversing changes made to 28660bb. This backs out the pull request KhronosGroup#456 because it introduced several internal errors even on code that only uses 32-bit numeric types.
With --dce-types I get "ID not found" as well. |
Revert "Merge pull request #456 from steve-lunarg/remapper-literal64"
It's out. Definitely need a better testing strategy. |
Or, something like this could be experimented with in a branch first, like the Vulkan precision qualifier change. |
Thanks for the reproduction case; I'll check it out. |
I see the problem; it relates to how I was obtaining the type size from the instruction stream during the remapping pass, which is actively changing all the IDs. I'll fix. Unless you have an urgent need, I'd like to do it next week rather than when tired at the end of this one. |
Also, I'll focus soon on creating a better testing infrastructure, since my test dataset didn't expose the problem. That might take a bit longer since it seems best coupled with other infrastructure changes if it's to use SPIRV-Tools for testing. |
This PR addresses issue #435, where iteration over the OperandVariableLiteralId argument list class would not cope with multiple word literals.
It also includes a small improvement to dead type elimination which picks up some cases previously dropped. The algorithm used for this is suboptimal, but it's an offline tool, it was easy to write that way, and it can be further improved later if there is ever a performance concern.