Floating-point Math Mode

Overview

// enums

enum dnnl_fpmath_mode_t;
enum dnnl::fpmath_mode;

// global functions

dnnl_fpmath_mode_t dnnl::convert_to_c(fpmath_mode mode);
dnnl_status_t DNNL_API dnnl_get_default_fpmath_mode(dnnl_fpmath_mode_t* mode);
dnnl_status_t DNNL_API dnnl_set_default_fpmath_mode(dnnl_fpmath_mode_t mode);

Detailed Documentation

Global Functions

dnnl_fpmath_mode_t dnnl::convert_to_c(fpmath_mode mode)

Converts an fpmath mode enum value from C++ API to C API type.

Parameters:

mode

C++ API fpmath mode enum value.

Returns:

Corresponding C API fpmath mode enum value.

dnnl_status_t DNNL_API dnnl_get_default_fpmath_mode(dnnl_fpmath_mode_t* mode)

Returns the floating-point math mode that will be used by default for all subsequently created primitives.

Parameters:

mode

Output FP math mode.

Returns:

dnnl_success on success and a status describing the error otherwise.

dnnl_status_t DNNL_API dnnl_set_default_fpmath_mode(dnnl_fpmath_mode_t mode)

Sets the floating-point math mode that will be used by default for all subsequently created primitives.

Parameters:

mode

FP math mode. The possible values are: dnnl_fpmath_mode_strict, dnnl_fpmath_mode_bf16, dnnl_fpmath_mode_f16, dnnl_fpmath_mode_tf32, dnnl_fpmath_mode_any.

Returns:

dnnl_success on success and a status describing the error otherwise.