Skip to main content

ClikaRT::dtype::float4_e2m1_t

struct

Header: ClikaRT/compute/scalar_types.h

FP4 E2M1: 1 sign + 2 exponent + 1 mantissa, bias 1. The 16 values are {0, ±0.5, ±1, ±1.5, ±2, ±3, ±4, ±6}; eps 0.5. Low 4 bits of a byte.

Static member functions

from_bits()

static constexpr float4_e2m1_t from_bits(std::uint8_t b) noexcept

Reinterpret the low 4 bits of b as an encoding without converting.

Declared in ClikaRT/compute/scalar_types.h, line 331

Member functions

float4_e2m1_t()

constexpr constexpr float4_e2m1_t() noexcept=default

Declared in ClikaRT/compute/scalar_types.h, line 322

float4_e2m1_t(float)

explicit float4_e2m1_t(float f) noexcept

Convert from fp32 (round-to-nearest-even; saturates on overflow).

Declared in ClikaRT/compute/scalar_types.h, line 325

operator float()

operator float() const noexcept

Convert to fp32 (lossless).

Declared in ClikaRT/compute/scalar_types.h, line 328

Data members

bits

std::uint8_t bits = 0

Raw encoding in the low 4 bits (the storage/ABI form).

Declared in ClikaRT/compute/scalar_types.h, line 320

Friends

operator==

friend bool operator==(float4_e2m1_t a, float4_e2m1_t b) noexcept

Compares a and b by dequantized value.

Declared in ClikaRT/compute/scalar_types.h, line 333

operator!=

friend bool operator!=(float4_e2m1_t a, float4_e2m1_t b) noexcept

Compares a and b by dequantized value.

Declared in ClikaRT/compute/scalar_types.h, line 334

operator<

friend bool operator<(float4_e2m1_t a, float4_e2m1_t b) noexcept

Compares a and b by dequantized value.

Declared in ClikaRT/compute/scalar_types.h, line 335

operator<=

friend bool operator<=(float4_e2m1_t a, float4_e2m1_t b) noexcept

Compares a and b by dequantized value.

Declared in ClikaRT/compute/scalar_types.h, line 336

operator>

friend bool operator>(float4_e2m1_t a, float4_e2m1_t b) noexcept

Compares a and b by dequantized value.

Declared in ClikaRT/compute/scalar_types.h, line 337

operator>=

friend bool operator>=(float4_e2m1_t a, float4_e2m1_t b) noexcept

Compares a and b by dequantized value.

Declared in ClikaRT/compute/scalar_types.h, line 338