---
title: "ClikaRT::dtype"
sidebar_label: "dtype"
description: "Namespace ClikaRT::dtype"
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--namespace">namespace</span>

The dtype-system helpers: classification predicates, size arithmetic, and the readable name. [`DataType`](../../index.md#DataType) itself stays at [`ClikaRT`](../../index.md)`::` (the one name every signature spells); everything ABOUT a dtype lives here.

## Namespaces

| Name | Description |
| --- | --- |
| [`ClikaRT::dtype::pack`](./pack/index.md) | Pack several sub-byte values into one storage byte. |
| [`ClikaRT::dtype::unpack`](./unpack/index.md) | Extract the i-th sub-byte value from a packed storage byte. |

## Classes

| Name | Description |
| --- | --- |
| [`bfloat16_t`](./bfloat16_t.md) | Truncated fp32 (brain float): 1 sign + 8 exponent + 7 mantissa, bias 127; the top 16 bits of an fp32. Range ±3.39e38 (= fp32), eps 2^-7. 16-bit storage. Conversion from fp32 is round-to-nearest-even; [`from_truncated`](./bfloat16_t.md#from_truncated) drops the low 16 bits without rounding. |
| [`dtype_of`](./dtype_of.md) | Primary template undefined: an unmapped type is a hard compile error. |
| [`dtype_of\<bfloat16_t\>`](./dtype_of.bfloat16_t.md) |  |
| [`dtype_of\<bool\>`](./dtype_of.bool.md) |  |
| [`dtype_of\<double\>`](./dtype_of.double.md) |  |
| [`dtype_of\<float\>`](./dtype_of.float.md) |  |
| [`dtype_of\<float16_t\>`](./dtype_of.float16_t.md) |  |
| [`dtype_of\<float4_e2m1_t\>`](./dtype_of.float4_e2m1_t.md) |  |
| [`dtype_of\<float6_e2m3_t\>`](./dtype_of.float6_e2m3_t.md) |  |
| [`dtype_of\<float6_e3m2_t\>`](./dtype_of.float6_e3m2_t.md) |  |
| [`dtype_of\<float8_e4m3fn_t\>`](./dtype_of.float8_e4m3fn_t.md) |  |
| [`dtype_of\<float8_e4m3fnuz_t\>`](./dtype_of.float8_e4m3fnuz_t.md) |  |
| [`dtype_of\<float8_e5m2_t\>`](./dtype_of.float8_e5m2_t.md) |  |
| [`dtype_of\<float8_e5m2fnuz_t\>`](./dtype_of.float8_e5m2fnuz_t.md) |  |
| [`dtype_of\<float8_e8m0_t\>`](./dtype_of.float8_e8m0_t.md) |  |
| [`dtype_of\<int2_t\>`](./dtype_of.int2_t.md) |  |
| [`dtype_of\<int4_t\>`](./dtype_of.int4_t.md) |  |
| [`dtype_of\<std::int16_t\>`](./dtype_of.std.int16_t.md) |  |
| [`dtype_of\<std::int32_t\>`](./dtype_of.std.int32_t.md) |  |
| [`dtype_of\<std::int64_t\>`](./dtype_of.std.int64_t.md) |  |
| [`dtype_of\<std::int8_t\>`](./dtype_of.std.int8_t.md) |  |
| [`dtype_of\<std::uint16_t\>`](./dtype_of.std.uint16_t.md) |  |
| [`dtype_of\<std::uint32_t\>`](./dtype_of.std.uint32_t.md) |  |
| [`dtype_of\<std::uint64_t\>`](./dtype_of.std.uint64_t.md) |  |
| [`dtype_of\<std::uint8_t\>`](./dtype_of.std.uint8_t.md) |  |
| [`dtype_of\<uint1_t\>`](./dtype_of.uint1_t.md) |  |
| [`dtype_of\<uint2_t\>`](./dtype_of.uint2_t.md) |  |
| [`dtype_of\<uint4_t\>`](./dtype_of.uint4_t.md) |  |
| [`dtype_traits`](./dtype_traits.md) | Primary template undefined; specializations carry `scalar` (byte-aligned only) and/or `host` (all storage dtypes). |
| [`float16_t`](./float16_t.md) | IEEE 754 binary16: 1 sign + 5 exponent + 10 mantissa, bias 15. Range ±65504, smallest normal 2^-14, eps 2^-10. 16-bit storage. |
| [`float4_e2m1_t`](./float4_e2m1_t.md) | 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. |
| [`float6_e2m3_t`](./float6_e2m3_t.md) | FP6 E2M3: 1 sign + 2 exponent + 3 mantissa, bias 1. Range ±7.5, smallest normal 1.0, eps 0.125. Low 6 bits of a byte. |
| [`float6_e3m2_t`](./float6_e3m2_t.md) | FP6 E3M2: 1 sign + 3 exponent + 2 mantissa, bias 3. Range ±28, smallest normal 2^-2, eps 2^-2. Low 6 bits of a byte. |
| [`float8_e4m3fn_t`](./float8_e4m3fn_t.md) | FP8 E4M3 (FN: finite, NaN-only): 1 sign + 4 exponent + 3 mantissa, bias 7. Range ±448, smallest normal 2^-6, eps 2^-3. NaN at exp+mantissa all-ones; no infinity. Conversion from fp32 saturates on overflow. 8-bit storage. |
| [`float8_e4m3fnuz_t`](./float8_e4m3fnuz_t.md) | FP8 E4M3 FNUZ: 1 sign + 4 exponent + 3 mantissa, bias 8 (rebased). FNUZ = finite, NaN, unsigned-zero: one NaN at 0x80, no infinity, no -0. Range ±240, smallest normal 2^-7, eps 2^-3. 8-bit storage. |
| [`float8_e5m2_t`](./float8_e5m2_t.md) | FP8 E5M2: 1 sign + 5 exponent + 2 mantissa, bias 15. Range ±57344, smallest normal 2^-14, eps 2^-2. IEEE-style: includes ±Inf and NaN. 8-bit storage. |
| [`float8_e5m2fnuz_t`](./float8_e5m2fnuz_t.md) | FP8 E5M2 FNUZ: 1 sign + 5 exponent + 2 mantissa, bias 16 (rebased). FNUZ = finite, NaN, unsigned-zero: one NaN at 0x80, no infinity, no -0. Range ±57344, smallest normal 2^-15, eps 2^-2. 8-bit storage. |
| [`float8_e8m0_t`](./float8_e8m0_t.md) | FP8 E8M0 block-scale: 8 exponent bits, 0 mantissa, no sign. Bias 127; pure powers of two from 2^-127 to 2^127, one NaN at 0xFF. Used as the per-block scale in MX block formats. Conversion from fp32 takes the biased exponent of `|f|`; magnitudes below 2^-126 saturate to the smallest scale. 8-bit storage. |
| [`FloatInfo`](./FloatInfo.md) | Numeric properties of a floating-point [`DataType`](../../index.md#DataType). |
| [`int2_t`](./int2_t.md) | Signed 2-bit integer, range \[-2, 1\]. Low 2 bits of a byte. |
| [`int4_t`](./int4_t.md) | Signed 4-bit integer, range \[-8, 7\]. Low nibble of a byte. |
| [`IntInfo`](./IntInfo.md) | Numeric properties of an integer [`DataType`](../../index.md#DataType). [`bits`](./IntInfo.md#bits) counts VALUE bits, so a sub-byte type reports its packed width (Int4 -\> 4). |
| [`nf4_t`](./nf4_t.md) | [nf4\_t](./nf4_t.md): a 4-bit index into a 16-entry table of standard-normal quantiles scaled to \[-1, +1\]. No exponent/mantissa structure; purely a lookup quantizer. Callers normalize their data to roughly \[-1, +1\] (e.g. per-block max-abs scaling) before quantizing; out-of-range inputs saturate to ±1. The table is monotonic, so the stored index orders the same as the dequantized value. Low 4 bits of a byte. |
| [`tfloat32_t`](./tfloat32_t.md) | TensorFloat-32: 1 sign + 8 exponent + 10 effective mantissa, bias 127, stored in a 32-bit container with the low 13 mantissa bits zeroed. Range = fp32, precision ≈ fp16. Conversion from fp32 round-to-nearest-even-narrows the low 13 bits; conversion to fp32 is identity. [`from_truncated`](./tfloat32_t.md#from_truncated) drops the bits without rounding. |
| [`uint1_t`](./uint1_t.md) | Unsigned 1-bit integer, range \{0, 1\}. Low bit of a byte. |
| [`uint2_t`](./uint2_t.md) | Unsigned 2-bit integer, range \[0, 3\]. Low 2 bits of a byte. |
| [`uint4_t`](./uint4_t.md) | Unsigned 4-bit integer, range \[0, 15\]. Low nibble of a byte. |

## Type aliases

### using scalar\_type\_t {#scalar_type_t}

<div class="api-signature">

`using` **`scalar_type_t`** `=` `typename` [`dtype_traits`](./dtype_traits.md)`<DT>::scalar`

</div>

Storage C++ type of a dtype (byte-aligned only; a sub-byte dtype is a hard error).

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 118

</div>

### using host\_type\_t {#host_type_t}

<div class="api-signature">

`using` **`host_type_t`** `=` `typename` [`dtype_traits`](./dtype_traits.md)`<DT>::host`

</div>

Widened compute host type of a dtype (`float` for narrow floats, native integer otherwise, `double` for Float64).

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 122

</div>

## Variables

### dtype\_of\_v {#dtype_of_v}

<div class="api-signature">

[`DataType`](../../index.md#DataType) **`dtype_of_v`** `=` [`dtype_of`](./dtype_of.md)`<T>::value`

</div>

[`DataType`](../../index.md#DataType) a host C++ type stores as ([`dtype_of_v`](./index.md#dtype_of_v)`<float> == `[`DataType::Float32`](../../index.md#DataType)).

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 66

</div>

### has\_scalar\_type\_v {#has_scalar_type_v}

<div class="api-signature">

`bool` **`has_scalar_type_v`** `= detail::has_scalar_type<DT>::value`

</div>

True iff `DT` has a byte-aligned storage scalar (false for the sub-byte dtypes).

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 131

</div>

## Functions

### data\_type\_name() {#data_type_name}

<div class="api-signature">

`const char*` **`data_type_name`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

A short, human-readable name for `dt` (e.g. "Float32"). Never null; an unrecognized value yields "Undefined".

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 73

</div>

### is\_floating\_point() {#is_floating_point}

<div class="api-signature">

`bool` **`is_floating_point`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

True for the IEEE-style and narrow floating formats (Float16/BFloat16/ Float32/Float64 and the FP8/FP6/FP4 families).

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 108

</div>

### bits\_per\_element() {#bits_per_element}

<div class="api-signature">

`constexpr` `int` **`bits_per_element`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Bits per stored element. Sub-byte types return their packed-bit width (Int4 -\> 4, Float6\_E2M3 -\> 6). `Undefined` -\> 0.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 130

</div>

### bytes\_per\_element() {#bytes_per_element}

<div class="api-signature">

`constexpr` `int` **`bytes_per_element`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Bytes per element when storage is byte-aligned (\>= 1 byte). Returns 0 for the sub-byte types (Int2/4, UInt1/2/4, FP4, FP6); use [`packed_bytes`](./index.md#packed_bytes) for those.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 154

</div>

### packed\_bytes() {#packed_bytes}

<div class="api-signature">

`constexpr` `std::int64_t` **`packed_bytes`**(`std::int64_t` `num_elements`, [`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Storage bytes for `num_elements` of `dt` in dense packed form (bit-packs the sub-byte types). 0 for an empty count or an unsized dtype.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 173

</div>

### is\_sub\_byte() {#is_sub_byte}

<div class="api-signature">

`constexpr` `bool` **`is_sub_byte`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

True for the bit-packed sub-byte types: Int2/4, UInt1/2/4, FP4, and FP6.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 180

</div>

### is\_signed\_integer() {#is_signed_integer}

<div class="api-signature">

`constexpr` `bool` **`is_signed_integer`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Signed integers, sub-byte included: Int2/4, Int8/16/32/64.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 193

</div>

### is\_unsigned\_integer() {#is_unsigned_integer}

<div class="api-signature">

`constexpr` `bool` **`is_unsigned_integer`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Unsigned integers, sub-byte included: UInt1/2/4, UInt8/16/32/64.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 204

</div>

### is\_integer() {#is_integer}

<div class="api-signature">

`constexpr` `bool` **`is_integer`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Any integer (signed or unsigned), sub-byte included.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 215

</div>

### is\_byte\_aligned\_integer() {#is_byte_aligned_integer}

<div class="api-signature">

`constexpr` `bool` **`is_byte_aligned_integer`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Byte-aligned integers only: Int8/16/32/64 + UInt8/16/32/64 (excludes sub-byte). Use when a kernel addresses elements at byte granularity.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 221

</div>

### is\_standard\_float() {#is_standard_float}

<div class="api-signature">

`constexpr` `bool` **`is_standard_float`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

The standard IEEE / brain-float family: Float16, Float32, Float64, BFloat16 (excludes the FP8 / FP6 / FP4 narrow formats).

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 234

</div>

### is\_reduced\_float() {#is_reduced_float}

<div class="api-signature">

`constexpr` `bool` **`is_reduced_float`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Reduced-precision floats with no native arithmetic: Float16 and BFloat16 (arithmetic runs in a widened float accumulator).

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 245

</div>

### is\_fp8() {#is_fp8}

<div class="api-signature">

`constexpr` `bool` **`is_fp8`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

The FP8 family: Float8\_E4M3 / E5M2 / E4M3FNUZ / E5M2FNUZ / E8M0.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 250

</div>

### is\_fp6() {#is_fp6}

<div class="api-signature">

`constexpr` `bool` **`is_fp6`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

The FP6 family: Float6\_E2M3 and Float6\_E3M2 (bit-packed sub-byte floats).

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 261

</div>

### is\_sub\_byte\_float() {#is_sub_byte_float}

<div class="api-signature">

`constexpr` `bool` **`is_sub_byte_float`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

The bit-packed sub-byte floats: Float4\_E2M1, Float6\_E2M3, Float6\_E3M2.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 266

</div>

### is\_byte\_aligned() {#is_byte_aligned}

<div class="api-signature">

`constexpr` `bool` **`is_byte_aligned`**([`DataType`](../../index.md#DataType) `dt`) `noexcept`

</div>

Storage is byte-aligned (\>= 1 byte per element) for every type except the bit-packed sub-byte ones.

<div class="api-declared">

Declared in `ClikaRT/compute/data_type.h`, line 272

</div>

### CLIKART\_DTYPE\_TRAIT(Bool, bool, bool) {#CLIKART_DTYPE_TRAIT}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Bool`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 80

</div>

### CLIKART\_DTYPE\_TRAIT(Int8, int8\_t, int8\_t) {#CLIKART_DTYPE_TRAIT-2}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Int8`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int8_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int8_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 81

</div>

### CLIKART\_DTYPE\_TRAIT(Int16, int16\_t, int16\_t) {#CLIKART_DTYPE_TRAIT-3}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Int16`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int16_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int16_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 82

</div>

### CLIKART\_DTYPE\_TRAIT(Int32, int32\_t, int32\_t) {#CLIKART_DTYPE_TRAIT-4}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Int32`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int32_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int32_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 83

</div>

### CLIKART\_DTYPE\_TRAIT(Int64, int64\_t, int64\_t) {#CLIKART_DTYPE_TRAIT-5}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Int64`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int64_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::int64_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 84

</div>

### CLIKART\_DTYPE\_TRAIT(UInt8, uint8\_t, uint8\_t) {#CLIKART_DTYPE_TRAIT-6}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`UInt8`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint8_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint8_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 85

</div>

### CLIKART\_DTYPE\_TRAIT(UInt16, uint16\_t, uint16\_t) {#CLIKART_DTYPE_TRAIT-7}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`UInt16`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint16_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint16_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 86

</div>

### CLIKART\_DTYPE\_TRAIT(UInt32, uint32\_t, uint32\_t) {#CLIKART_DTYPE_TRAIT-8}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`UInt32`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint32_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint32_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 87

</div>

### CLIKART\_DTYPE\_TRAIT(UInt64, uint64\_t, uint64\_t) {#CLIKART_DTYPE_TRAIT-9}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`UInt64`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint64_t`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::uint64_t`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 88

</div>

### CLIKART\_DTYPE\_TRAIT(Float16, float16\_t, float) {#CLIKART_DTYPE_TRAIT-10}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float16`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`float16_t`](./float16_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 89

</div>

### CLIKART\_DTYPE\_TRAIT(BFloat16, bfloat16\_t, float) {#CLIKART_DTYPE_TRAIT-11}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`BFloat16`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`bfloat16_t`](./bfloat16_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 90

</div>

### CLIKART\_DTYPE\_TRAIT(Float32, float, float) {#CLIKART_DTYPE_TRAIT-12}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float32`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 91

</div>

### CLIKART\_DTYPE\_TRAIT(Float64, double, double) {#CLIKART_DTYPE_TRAIT-13}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float64`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 92

</div>

### CLIKART\_DTYPE\_TRAIT(Float8\_E4M3, float8\_e4m3fn\_t, float) {#CLIKART_DTYPE_TRAIT-14}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float8_E4M3`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`float8_e4m3fn_t`](./float8_e4m3fn_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 93

</div>

### CLIKART\_DTYPE\_TRAIT(Float8\_E5M2, float8\_e5m2\_t, float) {#CLIKART_DTYPE_TRAIT-15}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float8_E5M2`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`float8_e5m2_t`](./float8_e5m2_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 94

</div>

### CLIKART\_DTYPE\_TRAIT(Float8\_E4M3FNUZ, float8\_e4m3fnuz\_t, float) {#CLIKART_DTYPE_TRAIT-16}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float8_E4M3FNUZ`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`float8_e4m3fnuz_t`](./float8_e4m3fnuz_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 95

</div>

### CLIKART\_DTYPE\_TRAIT(Float8\_E5M2FNUZ, float8\_e5m2fnuz\_t, float) {#CLIKART_DTYPE_TRAIT-17}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float8_E5M2FNUZ`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`float8_e5m2fnuz_t`](./float8_e5m2fnuz_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 96

</div>

### CLIKART\_DTYPE\_TRAIT(Float8\_E8M0, float8\_e8m0\_t, float) {#CLIKART_DTYPE_TRAIT-18}

<div class="api-signature">

**`CLIKART_DTYPE_TRAIT`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Float8_E8M0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`float8_e8m0_t`](./float8_e8m0_t.md),<br />
&nbsp;&nbsp;&nbsp;&nbsp;`float`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 97

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(UInt1, uint8\_t) {#CLIKART_DTYPE_HOST_ONLY}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`UInt1`, `std::uint8_t`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 106

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(UInt2, uint8\_t) {#CLIKART_DTYPE_HOST_ONLY-2}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`UInt2`, `std::uint8_t`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 107

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(Int2, int8\_t) {#CLIKART_DTYPE_HOST_ONLY-3}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`Int2`, `std::int8_t`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 108

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(UInt4, uint8\_t) {#CLIKART_DTYPE_HOST_ONLY-4}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`UInt4`, `std::uint8_t`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 109

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(Int4, int8\_t) {#CLIKART_DTYPE_HOST_ONLY-5}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`Int4`, `std::int8_t`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 110

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(Float4\_E2M1, float) {#CLIKART_DTYPE_HOST_ONLY-6}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`Float4_E2M1`, `float`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 111

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(Float6\_E2M3, float) {#CLIKART_DTYPE_HOST_ONLY-7}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`Float6_E2M3`, `float`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 112

</div>

### CLIKART\_DTYPE\_HOST\_ONLY(Float6\_E3M2, float) {#CLIKART_DTYPE_HOST_ONLY-8}

<div class="api-signature">

**`CLIKART_DTYPE_HOST_ONLY`**(`Float6_E3M2`, `float`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 113

</div>

### finfo() {#finfo}

<div class="api-signature">

[`FloatInfo`](./FloatInfo.md) **`finfo`**([`DataType`](../../index.md#DataType) `dt`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/finfo.h`, line 54

</div>

### iinfo() {#iinfo}

<div class="api-signature">

[`IntInfo`](./IntInfo.md) **`iinfo`**([`DataType`](../../index.md#DataType) `dt`)

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/finfo.h`, line 60

</div>

### promote\_types() {#promote_types}

<div class="api-signature">

[`DataType`](../../index.md#DataType) **`promote_types`**([`DataType`](../../index.md#DataType) `a`, [`DataType`](../../index.md#DataType) `b`) `noexcept`

</div>

The dtype `a` and `b` promote to, per the standard type-promotion lattice, extended to the sub-byte and narrow-float formats. Total over the storage dtypes; returns [`DataType::Undefined`](../../index.md#DataType) for a sentinel input.

<div class="api-declared">

Declared in `ClikaRT/compute/promotion.h`, line 16

</div>

### dominant\_dtype() {#dominant_dtype}

<div class="api-signature">

`template <``class...` `Rest``>`<br />[`DataType`](../../index.md#DataType) **`dominant_dtype`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `a`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `b`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`Rest...` `rest`<br />
) `noexcept`

</div>

Folds `a`, `b`, and `rest...` pairwise to one dominant dtype.

The common dtype of N operands, a fold of [`promote_types`](./index.md#promote_types) (\>= 2 args). Handy for a variadic / ternary op: `dominant_dtype(cond, a, b)`.

<div class="api-declared">

Declared in `ClikaRT/compute/promotion.h`, line 22

</div>

## `ClikaRT/compute/data_type.h` {#data_type-h}

```cpp
#include <ClikaRT/compute/data_type.h>
```

Element data type of a tensor.

## `ClikaRT/compute/dtype_traits.h` {#dtype_traits-h}

```cpp
#include <ClikaRT/compute/dtype_traits.h>
```

Compile-time mapping between a host C++ scalar type and the `DataType` enum, in both directions.

- `dtype_of_v<T>` / `dtype_of<T>::value`: the `DataType` a host C++ type stores as (`dtype_of_v<bfloat16_t>` -\> `DataType::BFloat16`). Covers the native scalars and every [`scalar_types.h`](./pack/index.md#scalar_types-h) struct that has a storage slot; an unmapped type is a hard compile error.
- `scalar_type_t<DataType>`: the storage C++ type for a dtype (`scalar_type_t<DataType::BFloat16>` -\> `bfloat16_t`). Byte-aligned only; instantiating it for a sub-byte dtype is a hard error (sub-byte storage goes through the packed-bit path). `has_scalar_type_v<DataType>` is the predicate.
- `host_type_t<DataType>`: the widened compute "host" type a value decodes to for arithmetic: `float` for every narrow / sub-byte float, the native integer for the integer family, `double` for Float64. Defined for all storage dtypes.

`tfloat32_t` and `nf4_t` have no `dtype_of`; they are compute / quantization types, not tensor storage dtypes (so no `DataType` slot).

### Macros

#### \#define CLIKART\_DTYPE\_TRAIT {#CLIKART_DTYPE_TRAIT-19}

<div class="api-signature">

`#define` **`CLIKART_DTYPE_TRAIT(ENUM, SCALAR, HOST)`** `template <> struct dtype_traits<DataType::ENUM> { \     using scalar = SCALAR;                       \     using host   = HOST;                         \ }`

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 74

</div>

#### \#define CLIKART\_DTYPE\_HOST\_ONLY {#CLIKART_DTYPE_HOST_ONLY-9}

<div class="api-signature">

`#define` **`CLIKART_DTYPE_HOST_ONLY(ENUM, HOST)`** `template <> struct dtype_traits<DataType::ENUM> { using host = HOST; }`

</div>

<div class="api-declared">

Declared in `ClikaRT/compute/dtype_traits.h`, line 103

</div>

## `ClikaRT/compute/finfo.h` {#finfo-h}

```cpp
#include <ClikaRT/compute/finfo.h>
```

Numeric limits of a `DataType`: `finfo` describes a floating-point format (bit layout, `eps`, smallest-normal, min/max, NaN/Inf), `iinfo` an integer format (bit width, signedness, min/max). Runtime queries keyed on a `DataType`; for a dtype of the wrong category (e.g. `finfo` of an integer) the call fails.

## `ClikaRT/compute/promotion.h` {#promotion-h}

```cpp
#include <ClikaRT/compute/promotion.h>
```

Type promotion over `DataType`: the dtype two (or more) operands combine to.
