Fix codegen of Memory-repr enum payload accesses#616
Open
LegNeato wants to merge 1 commit into
Open
Conversation
a8ef01f to
fb1d7d4
Compare
fb1d7d4 to
138d04a
Compare
Fixes Rust-GPU#615. After the nightly-2026-05-22 upgrade, `TryFromIntError` is no longer a ZST, so `Result<u32, TryFromIntError>` is laid out as `BackendRepr::Memory` instead of `ScalarPair`. Multi-variant enums with this layout were translated to a tag-only `OpTypeStruct`, so payload field accesses couldn't be recovered into a valid `OpAccessChain`. The SPIR-V type now also includes each variant's non-ZST payload fields at their absolute offsets, so payload accesses work.
138d04a to
dfdd6e0
Compare
nazar-pc
reviewed
Jun 14, 2026
nazar-pc
left a comment
Contributor
There was a problem hiding this comment.
Can confirm that this one works
nazar-pc
added a commit
to nazar-pc/abundance
that referenced
this pull request
Jun 14, 2026
Contributor
|
Yes, this PR fixes compilation issue, but requires usage of OpCapability Int8 to be actually compiled (for some unknown reason); without capability it produces such message: I guess this is because of blanket implementation could not be inlined (or something similar to that)? |
Contributor
|
Not in my case, I guess it depends on the code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #615.
After the nightly-2026-05-22 upgrade,
TryFromIntErroris no longer a ZST, soResult<u32, TryFromIntError>is laid out asBackendRepr::Memoryinstead ofScalarPair. Multi-variant enums with this layout were translated to a tag-onlyOpTypeStruct, so payload field accesses couldn't be recovered into a validOpAccessChain.The SPIR-V type now also includes each variant's non-ZST payload fields at their absolute offsets, so payload accesses work.