Data types

oneDNN supports multiple data types. However, the 32-bit IEEE floating-point data type (f32) is the fundamental type in oneDNN. It is the only data type that must be supported by an implementation. All the other types discussed below are optional.

Primitives operating on the f32 data type consume data, produce, and store intermediate results in the f32 data type.

Moreover, the f32 data type is often used for intermediate results in the mixed precision computations because it provides better accuracy. For example, the elementwise primitive and elementwise post-ops always use f32 internally.

oneDNN defines the following data types:

enum dnnl::memory::data_type

Data type specification.

Values:

enumerator undef

Undefined data type (used for empty memory descriptors).

enumerator f16

16-bit/half-precision floating point.

enumerator bf16

non-standard 16-bit floating point with 7-bit mantissa.

enumerator f32

32-bit/single-precision floating point.

enumerator s32

32-bit signed integer.

enumerator s8

8-bit signed integer.

enumerator u8

8-bit unsigned integer.

oneDNN supports training and inference with the following data types:

Usage mode

Data types

Inference

f32, bf16, f16, s8/u8

Training

f32, bf16

Note

Using lower precision arithmetic may require changes in the deep learning model implementation.

Individual primitives may have additional limitations with respect to data type support based on the precision requirements. The list of data types supported by each primitive is included in the corresponding sections of the specification guide.