From f2c022e54ae65467cca4bc698b5b94e5b3c62c47 Mon Sep 17 00:00:00 2001 From: cfRod Date: Fri, 5 Nov 2021 11:29:53 +0000 Subject: Enable fast_math in CpuFullyConnected ONCPUML-529 * Add support for passing fast_math for fullyconnected layers via fc_info. * Add support for passing fast_math to run ACL benchmark graphs. * Add validation test and accuracy tests (updated fixtures). Note: abs and rel. tolerance for fast math mode are set based on experimental data. Signed-off-by: cfRod change-Id: Ib107d6264d3ae5e36555334f39a13e678f8618df Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6521 Reviewed-by: SiCong Li Reviewed-by: Gian Marco Iodice Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- arm_compute/graph/nodes/FullyConnectedLayerNode.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'arm_compute/graph/nodes') diff --git a/arm_compute/graph/nodes/FullyConnectedLayerNode.h b/arm_compute/graph/nodes/FullyConnectedLayerNode.h index a7712f46b9..9ade62bf4a 100644 --- a/arm_compute/graph/nodes/FullyConnectedLayerNode.h +++ b/arm_compute/graph/nodes/FullyConnectedLayerNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -39,10 +39,22 @@ public: * @param[in] num_outputs Number of neurons in the layer * @param[in] out_quant_info (Optional) Output quantization info * @param[in] fc_info (Optional) Additional information about the fully connected layer + * @param[in] fast_math_hint (Optional) Fast math hint */ FullyConnectedLayerNode(unsigned int num_outputs, QuantizationInfo out_quant_info = QuantizationInfo(), - FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo()); + FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(), + FastMathHint fast_math_hint = FastMathHint::Disabled); + /** Sets the fast math fast hint + * + * @param[in] hint Hint to use for fullyconnected layer + */ + void set_fast_math_hint(FastMathHint hint); + /** Fast math hint accessor + * + * @return Fast math hint to be used by the node + */ + FastMathHint fast_math_hint() const; /** Sets fused activation * * @param[in] fused_activation Fused activation to set @@ -94,6 +106,7 @@ private: unsigned int _num_outputs; QuantizationInfo _out_quant_info; FullyConnectedLayerInfo _info; + FastMathHint _fast_math_hint; }; } // namespace graph } // namespace arm_compute -- cgit v1.2.1