Quarter precision floating-point type definitions for IPU software.
The quarter type is a single byte floating-point format internal to Poplar. The format is fully defined at runtime using an independently allocated metadata variable. Typically, a single metadata variable is used to define the format for an arbitrary number of elements of type quarter. The metadata is of type
QuarterMetadata and it includes the following information:
An enumeration that defines the number of bits of the quarter data that is used for sign, mantissa and exponent.
A signed scale factor.
The scale factor is applied when converting from quarter to float or vice-versa. In the following code,
d is of type float,
q is of type quarter, and
QuarterMetadata has scale factor
d = q * pow(2, s) q = d * pow(2, -s)
Poplar classes and functions.
- #include <Quarter.hpp>
Quarter metadata type.
The floating-point format for data of type quarter is determined at IPU runtime. This runtime format definition is called “metadata”. The sign, mantissa, exponent and scaling of the underlying quarter data type are fully defined by the metadata and are encoded in the underlying value in the way expected by poplar runtime. No arithmetic operations are supported on this type.
QuarterMetadata() = default
inline explicit QuarterMetadata(unsigned char value)
inline unsigned char getBinary() const
inline unsigned char &data()
inline const unsigned char &data() const
signed char getScale() const
unsigned char value
- QuarterMetadata() = default
- class QuarterMetadata