Skip to content

Clang ICEs compiling project pveclib __float128 implementation #127344

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

Open
munroesj52 opened this issue Feb 15, 2025 · 12 comments
Open

Clang ICEs compiling project pveclib __float128 implementation #127344

munroesj52 opened this issue Feb 15, 2025 · 12 comments

Comments

@munroesj52
Copy link

For the project: https://github.com/open-power-sdk/pveclib

Clang 16/17/18 ICEs when compiling PVECLIB implementation for __Float128/__int128 types.

In powerpc64le these types are implemented in the PowerISA in 128-bit vector (VMX) registers.

So are __Float128/__int128 types scalars OR vectors, Yes for PowerISA.

While POWER9 implements _Float128 in hardware but PVECLIB it trying to implement _Float128 operations for POWER8 and earlier using the wider (__int128) registers of the vector unit.

This is working in GCC.

But clang is pita as it is ICEing without useful diagnostics.

Clang does generate preprocessed source and run scripts on these occasions but not sure how to attach those in this tool.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Feb 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 16, 2025

@llvm/issue-subscribers-backend-powerpc

Author: Steven Munroe (munroesj52)

For the project: https://github.com/open-power-sdk/pveclib

Clang 16/17/18 ICEs when compiling PVECLIB implementation for __Float128/__int128 types.

In powerpc64le these types are implemented in the PowerISA in 128-bit vector (VMX) registers.

So are __Float128/__int128 types scalars OR vectors, Yes for PowerISA.

While POWER9 implements _Float128 in hardware but PVECLIB it trying to implement _Float128 operations for POWER8 and earlier using the wider (__int128) registers of the vector unit.

This is working in GCC.

But clang is pita as it is ICEing without useful diagnostics.

Clang does generate preprocessed source and run scripts on these occasions but not sure how to attach those in this tool.

@nemanjai
Copy link
Member

Hi Steve, clang should produce a preprocessed file and invocation script when it crashes. Can you attach those to this PR?

@munroesj52
Copy link
Author

It says file type .c and .sh are not allowed!?

Is this a size problem? Fedora problem?

Any suggestions?

@munroesj52
Copy link
Author

Tried:

tar -zcf clang18-ppc64le-f128.tgz ./clang-ice/vec_f128_dummy-203ba0.*

and uploading clang18-ppc64le-f128.tgz

still no joy...

@munroesj52
Copy link
Author

munroesj52 commented Feb 20, 2025

I seems that clang does no like it when I mess the clang defined types.

But I must! Because GCC/clang have been and continues to be inconsistent.

So does clang (and which version) actually support IEEE _Float128 for PPC64LE?
What is the type name (names) that are currently supported?

There is no clean documentation that I can find for this!

Can I typedef the supported _Float128 (__binary128, __float128, __ieee128) to something I can use in code common to GCC/Clang?

@ecnelises
Copy link
Member

There appear to be two distinct issues here:

  1. Float128 default disabled for POWER7+ targets:

The float128 feature is currently disabled by default for PowerPC targets (POWER7 and newer). This stems from compilation failures involving glibc - when float128 is enabled, certain standard library headers cause type mismatch errors. This has since been fixed in upstream glibc by @tuliom as I recall.

  1. _Float128 support in ppc64le Clang:

The second issue concerns missing _Float128 support in powerpc64le Clang, related to #97335. A proposed fix exists in the LLVM patch D111382 (cc @hubert-reinterpretcast @MaskRay for context).

@EugeneZelenko EugeneZelenko removed the clang Clang issues not falling into any other category label Apr 18, 2025
@munroesj52
Copy link
Author

I am not concerned about powerpc targets and PWR7.

Primary focus work on PowerPC64LE targets PWR8/9/10.

But I keep finding differences in behavior between clang and GCC especially as it relates -mfloat128 and _Float128 types.

@munroesj52
Copy link
Author

munroesj52 commented Apr 20, 2025

Ok why are you wasting my time. I have the files generated by clang ice. But this tool keeps telling me that those file types are not allowed.

So do you want this information or not.

@munroesj52
Copy link
Author

No description provided.

@munroesj52
Copy link
Author

WTF: clang -m64 -O3 -mcpu=power8 -mvsx -mfloat128 -c clang_ice.c -o clang_ice.o

generates:

clang_ice.c:149:25: error: use of '__int128' with '__vector bool' requires VSX support enabled (on POWER10 or later)
149 | typedef __vector __bool __int128 vb128_t;
| ^
1 error generated.

When I compile with -mcpu=power10, I get the ICE which produced the files clang_ice-c97d52.c and clang_ice-c97d52.sh that github will not allow me to attach.

This is clang-18

PVECLIB supports all quadword integer operations (including) for P7/8/9/10 and GCC compiles this code for all -mvsx platforms.

@hubert-reinterpretcast
Copy link
Collaborator

When I compile with -mcpu=power10, I get the ICE which produced the files clang_ice-c97d52.c and clang_ice-c97d52.sh that github will not allow me to attach.

GitHub is annoying about attachment support, yes. Can you try renaming them to use the txt extension and attaching them that way?

@munroesj52
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants