GCC & LLVM Ready With x86 __bf16 Type Support
The compilers have added __bf16 support in compliance with the x86-64 psABI spec. The motivation for this new special type is summed up as:
Currently __bfloat16 is a typedef of short, which creates a problem where the compiler does not raise any alarms if it is used to add, subtract, multiply or divide, but the result of the calculation is actually meaningless. To solve this problem, a real scalar type __Bfloat16 needs to be introduced. It is mainly used for intrinsics, not available for C standard operators. __Bfloat16 will also be used for movement like passing parameter, load and store, vector initialization, vector shuffle, and etc. It creates a need for a corresponding psABI.
On the hardware side, Intel Xeon Scalable Cooper Lake and Sapphire Rapids are the processors so far having native AVX-512 BFloat16 (BF16) instruction support for bolstering their machine learning performance potential.
Last week LLVM landed its __bf16 type support for x86 targets along with several follow-up commits adapting its existing BFloat16 code. Now today in GCC Git there is also the support for the __bf16 type.
This __bf16 type support will in turn be found in the stable GCC 13 and LLVM 16 compilers, both of which will see their formal releases in the early months of next year.