GCC & LLVM Ready With x86 __bf16 Type Support

Written by Michael Larabel in Programming on 18 August 2022 at 02:45 PM EDT. 6 Comments
Following optional "__bf16" support being added to the x86-64 psABI as a special type for representing 16-bit Brain Floating Point Format for deep learning / machine learning applications, the GCC and LLVM compilers have now landed their __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.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week