Skip to main content

Mojo function

e8m0_to_bf16_broadcast

e8m0_to_bf16_broadcast(scale_byte: UInt8) -> UInt32

Convert an e8m0 scale byte to a bf16 value broadcast into both halves of a uint32.

e8m0 format: value = 2^(byte - 127). The bf16 representation is obtained by left-shifting the 8-bit exponent by 7 to place it in the bf16 exponent field (bits 7-14), with sign=0 and mantissa=0. Broadcasting into both halves of a uint32 prepares the value for use with the packed bf16x2 multiply instruction.

Returns:

UInt32

Was this page helpful?