Skip to content
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

C compatible Int128 layout on x64 #20415

Closed
yuyichao opened this issue Feb 2, 2017 · 12 comments
Closed

C compatible Int128 layout on x64 #20415

yuyichao opened this issue Feb 2, 2017 · 12 comments
Labels
breaking This change will break code compiler:codegen Generation of LLVM IR and native code

Comments

@yuyichao
Copy link
Contributor

yuyichao commented Feb 2, 2017

A recent discourse post just reminds me about this....

(Or in general, any C->LLVM mapping that requires explicit padding.)

The alignment for Int128 on x64 is currently 8 in julia and LLVM. However, AFAIK, it should be 16 in order to match the C ABI. Fixing this may require adding explicit padding fields when we declare the LLVM struct in the same way clang does it. The hard part is to fix all the use of gep on a struct in codegen to use the actual field index including the padding field rather than the julia field index.

@yuyichao yuyichao added the compiler:codegen Generation of LLVM IR and native code label Feb 2, 2017
@vchuravy vchuravy added this to the 1.0 milestone May 19, 2017
@PallHaraldsson
Copy link
Contributor

@simonbyrne
Copy link
Contributor

Will #22649 fix this?

@yuyichao
Copy link
Contributor Author

yuyichao commented Jul 6, 2017

Not afaict. The llvm pr might though.

@vchuravy
Copy link
Member

vchuravy commented Jul 7, 2017

The llvm PR got reverted in llvm-mirror/llvm@8c54b81.

@StefanKarpinski
Copy link
Member

I don't think this is a 1.0-blocking issue.

@StefanKarpinski StefanKarpinski modified the milestones: 1.x, 1.0 Aug 31, 2017
@yuyichao
Copy link
Contributor Author

Note that fixing this will be breaking.

@StefanKarpinski
Copy link
Member

Note that fixing this will be breaking.

Only if we declare struct layout to be stable in 1.0, which I don't think we should do.

@yuyichao
Copy link
Contributor Author

yuyichao commented Sep 1, 2017

What do you mean? The structure layout (and size) is a user observable API so changing that is breaking.

@StefanKarpinski
Copy link
Member

Yes, but what we promise not to break is up to us.

@yuyichao
Copy link
Contributor Author

yuyichao commented Sep 1, 2017

Well, that's an API that people needs to rely on so we'll have to call that a breaking change, especially for isbits layout.
Whether that can be an API breakage exception for 1.0 is another issue.

@vtjnash
Copy link
Member

vtjnash commented Aug 16, 2024

AFAIK, LLVM 18 fixed this?

@vchuravy
Copy link
Member

vchuravy commented Aug 19, 2024

We probably should add tests then?

I found quite nice to explain the situation.
https://blog.rust-lang.org/2024/03/30/i128-layout-update.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code compiler:codegen Generation of LLVM IR and native code
Projects
None yet
Development

No branches or pull requests

7 participants