This is an archive of the discontinued LLVM Phabricator instance.

[HIP] fix long double size
ClosedPublic

Authored by yaxunl on Jun 14 2022, 11:01 AM.

Details

Summary

For amdgpu target long double type is the same as double type.
The width and align of long double type was incorrectly
overridden when copying aux target properties, which
caused assertion in codegen when emitting global
variables with long double type.

This patch fix that by saving and restoring width
and align of long double type.

Diff Detail

Event Timeline

yaxunl created this revision.Jun 14 2022, 11:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 11:01 AM
yaxunl requested review of this revision.Jun 14 2022, 11:01 AM
tra accepted this revision.Jun 14 2022, 11:27 AM

AFAICT, the test case you've added works fine with the compiler at HEAD: https://cuda.godbolt.org/z/q3xYMfdeb
I guess it only shows up in assertion-enabled builds. Can you check what happens if you run the test case compiled as CUDA? I suspect it will have the same issue -- we don't override setAuxTarget at all.

This revision is now accepted and ready to land.Jun 14 2022, 11:27 AM

AFAICT, the test case you've added works fine with the compiler at HEAD: https://cuda.godbolt.org/z/q3xYMfdeb
I guess it only shows up in assertion-enabled builds. Can you check what happens if you run the test case compiled as CUDA? I suspect it will have the same issue -- we don't override setAuxTarget at all.

The assertion only happens with assertion-enabled builds. However, the test is able to detect the issue with assertion-disabled builds since it checks the sizeof(long double). In the old build it is 16.

The lit test contains run line for nvptx. It seems nvptx is not subject to this issue since sizeof(long double)==8.

This revision was landed with ongoing or failed builds.Jun 14 2022, 6:58 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 6:58 PM