--allow_hf32

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Description

This option is reserved and is not supported in the current version.

Enables the function of automatically replacing the float32 data type with the HF32 data type. In the current version, this option takes effect only for Conv and Matmul operators.

HF32 is a single-precision floating-point type of Ascend for internal computation of operators. The following figure shows the comparison of HF32 with other common data types. HF32 shares the same value range with float32, but its mantissa precision (11 bits) is close to FP16 (10 bits). Replacing the original float32 single-precision data type with the HF32 single-precision data type by precision reduction can greatly reduce the space occupied by data and achieve performance improvement.
Figure 1 Comparison of HF32 with other data types

See Also

  • For the same operator, if enable_hi_float_32_execution or enable_float_32_execution is configured using --op_precision_mode, you are not advised using this option together with --allow_hf32. If they are used together, the priority is as follows:

    op_precision_mode(ByNodeName) > allow_hf32 > op_precision_mode(ByOpType)

  • --allow_hf32 automatically replaces float32 with HF32. To make this option take effect, ensure that the input or output type of the enabled operator is float32. The default value of --precision_mode_v2 is fp16. If the operator type in the original network model is float32, it will be forcibly converted to float16. In this case, --allow_hf32 does not take effect. You are advised to change the value of --precision_mode_v2 to origin. The default value of --precision_mode is force_fp16, and you are advised to change the value to must_keep_origin_dtype or force_fp32.

Argument

Argument:

  • true: Enable the function of automatically converting the FP32 data type to the HF32 data type for Conv and Matmul operators.

    For details about the operators for which this function is enabled, see opp/built-in/op_impl/ai_core/tbe/impl_mode/allow_hf32_matmul_t_conv_t.ini in the file storage path after the CANN software is installed. This file cannot be modified by users.

  • false: Disable the function of automatically converting the FP32 data type to the HF32 data type for Conv and Matmul operators.

    For details about the operators for which this function is disabled, see opp/built-in/op_impl/ai_core/tbe/impl_mode/allow_hf32_matmul_f_conv_f.ini in the file storage path after the CANN software is installed. This file cannot be modified by users.

Default: Enable FP32-to-HF32 conversion for Conv operators; disable FP32-to-HF32 conversion for Matmul operators.

Suggestions and Benefits

None

Example

--allow_hf32=true

If ge.exec.allow_hf32 can be found in the model conversion log, the parameter settings are effective.

Dependencies and Restrictions

None