-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
OpenMP failing offload of static object if bitfields #132342
Comments
@llvm/issue-subscribers-openmp Author: None (KaruroChori)
Tested in one of the latest commits. This works as intended:
```
struct hello{
struct sub{
uint32_t uid;
uint32_t gid ;
uint32_t idx;
uint32_t weak ;
};
|
Hmm, wonder what the difference is in terms of IR representation of the two structs. |
Honestly, no idea and I have no clue where to start to check that. But I would be mildly surprised if that was the case. |
More info as I tested this further:
I also tried to compare the llvm bytecode, but I cannot spot any meaningful difference |
The error is emitted here https://github.com/llvm/llvm-project/blob/main/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp#L9499. We need an address to be able to emit an offloading entry, because an offloading entry fundamentally is a named symbol in the ELF that the device runtime can look up and copy / read to. A bitfield should have an address, but I'm going to guess that something inside of OpenMP gets confused when it's used. I don't know anything more than that, maybe @alexey-bataev has a guess. |
Bitfields are not addressable by the standard |
The bit-aligned fields inside a structure surely are not, but I would assume there should be no problem addressing full instances of structs, even if they have bitfields inside. |
Tested in one of the latest commits. This works as intended:
while this does not:
Bitfields are intrinsically not working, and the error message is a generic sounding
Offloading entry for declare target variable _ZN3sdf5hello1AE is incorrect: the address is invalid.
At the very least, a more explicit description would help but still, I see no reason why bitfields should not be allowed.
Potential workarounds like wrapping it in an union and setting it up through a different field will not work.
The text was updated successfully, but these errors were encountered: