[PATCH] D98143: [HIP] Diagnose aggregate args containing half types

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 30 13:17:49 PDT 2021


yaxunl added a comment.

In D98143#3034419 <https://reviews.llvm.org/D98143#3034419>, @tra wrote:

> Is this patch still relevant? Looks like I've missed it.
>
> What exactly is the difference between gcc and clang regarding fp16 and why does it matter for aggregate arguments?
> On a trivial example both clang and gcc appear to treat _Float16 similarly: https://godbolt.org/z/8WxK95zTj

On gcc11 and below, since gcc does not support fp16, it is common practice to use short to pass fp16 in struct. Then gcc and clang has different ABI: https://godbolt.org/z/zqhT7x7qo

Basically if one compiles a function with struct type arg containing _Float16 with clang, then compiles a caller with struct type arg containing short with gcc, it will not work.

If use gcc trunk with _Float16, then there will not be such issue since the ABI is the same.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98143/new/

https://reviews.llvm.org/D98143



More information about the cfe-commits mailing list