Quarter
#include <poplar/Quarter.hpp>
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 s
:
d = q * pow(2, s)
q = d * pow(2, -s)
-
namespace poplar
Poplar classes and functions.
Functions
-
std::ostream &operator<<(std::ostream &os, const QuarterMetadata &md)
-
class QuarterMetadata
- #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.
Public Types
Public Functions
-
QuarterMetadata() = default
-
inline explicit QuarterMetadata(unsigned char value)
-
inline QuarterMetadata(const QuarterMetadata &other)
-
QuarterMetadata &operator=(const QuarterMetadata &other)
-
bool operator==(const QuarterMetadata other) const
-
bool operator!=(const QuarterMetadata other) const
-
inline unsigned char getBinary() const
-
inline unsigned char &data()
-
inline const unsigned char &data() const
-
signed char getScale() const
Private Members
-
unsigned char value
-
QuarterMetadata() = default
-
std::ostream &operator<<(std::ostream &os, const QuarterMetadata &md)