Visible to Intel only — GUID: GUID-8501925D-0AD3-4CCB-AC94-99E9B2EE5A81
Visible to Intel only — GUID: GUID-8501925D-0AD3-4CCB-AC94-99E9B2EE5A81
Primitive Attributes: rounding mode
The default numerical behavior of oneDNN with respect to rounding (described in Data Types) can be altered to allow the use of non-standard rounding mode upon down-conversion.
When passed to a primitive descriptor creation, the dnnl::rounding_mode primitive attribute specifies which rounding mode to use when a given argument is down-converted.
The dnnl::rounding_mode primitive attribute accepts:
environment (default): For floating-point primitives (as defined in Data Types), the rounding behavior is controlled by the C/C++ floating-point environment non-SYCL/non-OpenCL devices, or by SYCL/OpenCL language defaults otherwise.
stochastic : In this mode, a random bias is generated in a deterministic way, and gets added to the mantissa bits of the destination before truncation to destination datatype precision. The seed for the random number generator has to be passed as an execution argument with DNNL_ARG_ATTR_ROUNDING_SEED argument kind. This is a single-value s32 input buffer.
The stochastic rounding mode is of particular interest to avoid vanishing gradients during low-precision training. As such, it is only supported for and arguments for primitive supporting propagation kind, and for for Matmul primitive.