[PATCH] D130964: [X86][BF16] Enable __bf16 for x86 targets.
Freddy, Ye via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 2 18:18:59 PDT 2022
FreddyYe added a comment.
In D130964#3694540 <https://reviews.llvm.org/D130964#3694540>, @bkramer wrote:
> In D130964#3694473 <https://reviews.llvm.org/D130964#3694473>, @rjmccall wrote:
>
>> How are you actually implementing `__bf16` on these targets? There isn't even hardware support for conversions.
>
> `bf16` -> `float` is really just a bit shift. The other direction gets lowered to a libcall, compiler-rt has a conversion function with proper rounding. I added some support to make the backend promote all other arithmetic to float, but I think that's only enabled on x86 so far.
Yes, we can view x86 backend has been dealing with `__bf16`. And with https://reviews.llvm.org/D130832, it will complete follow psABI. About hardware support, x86 actually has supported bf16 since AVX512BF16 (https://reviews.llvm.org/D60552), which has vector conversion support between float and bf16. However, at that time we chose a `typedef short` as C type. In the future, we can support backend lowering for those instructions: VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130964/new/
https://reviews.llvm.org/D130964
More information about the cfe-commits
mailing list