Skip to main content

Module bf16

Module bf16 

Source
Expand description

Conversion to bf16 from a source wider than f32.

A backend converts to bf16 from f32 with one rounding, but from an f64 or a 32- or 64-bit integer it goes through the nearest f32 and rounds twice: a value just past a bf16 tie can round onto the tie in f32, then to even the wrong way. LowerWideBf16Cast narrows such a source to f32 by rounding to odd instead, which f32’s width keeps exact for the conversion to bf16 that follows.

Structs§

LowerWideBf16Cast
Rewrites a cast to bf16 from a source wider than f32 as the cast from an f32 rounded to odd, which the backend converts natively with the one rounding the source needs.

Type Aliases§

LowerWideBf16CastPass