Fix codegen of Memory-repr enum payload accesses#616
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
left a comment
There was a problem hiding this comment.
Can confirm that this one works
|
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)? |
|
Not in my case, I guess it depends on the code |
|
Hmmm, yeah it depends on the code. |
|
Ok, we don't currently handle this automatically in any way and just punt to the user AFAICT. That's probably correct, it would be weird to promote to |
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.