[llvm] [GlobalISel] Fall back for bf16 conversions. (PR #71470)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 04:22:27 PST 2024
erickq wrote:
> > > > Now an error is reported for a very simple bf16 data addition. Is this modification too violent?
> > > > ```
> > > > #include <arm_neon.h>
> > > > bfloat16_t test(bfloat16_t gpara1, bfloat16_t gpara2)
> > > > {
> > > > return gpara1+gpara2;
> > > > }
> > > > ```
> > >
> > >
> > > No, this is exactly the kind of case that is supposed to be rejected
> >
> >
> > clang -O0 -march=armv8.2-a+bf16 test.c
> > I don't really understand that at this point our hardware already supports the bf16 data type.
>
> I just tried that test case and I see the crash. The crash is in SelectionDAG because there's incomplete support for bf16 in the backend. Previously clang was silently miscompiling this to FP16 because GlobalISel didn't know it was bf16.
>
> Also, bf16 in ARM doesn't provide you native support for general purpose FP arithmetic with bf16. It only adds some MLA/dotprod and conversions IIRC, so trying to add two bf16s would have to be done by promoting to float32 and then truncating back down.
Okay, thank you. I got it. It seems that this needs to be supported slowly in the follow-up work. Do you have any plans?
https://github.com/llvm/llvm-project/pull/71470
More information about the llvm-commits
mailing list