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/GraphBuilder.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'arm_compute/graph/GraphBuilder.h') diff --git a/arm_compute/graph/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h index 14ad0571ef..cb88c0e7aa 100644 --- a/arm_compute/graph/GraphBuilder.h +++ b/arm_compute/graph/GraphBuilder.h @@ -295,13 +295,15 @@ public: * @param[in] bias_nid (Optional) Node ID of the bias node data. Defaults to EmptyNodeID * @param[in] fc_info (Optional) Fully connected layer metadata * @param[in] out_quant_info (Optional) Output quantization info + * @param[in] fast_math_hint (Optional) Fast math hint * * @return Node ID of the created node, EmptyNodeID in case of error */ static NodeID add_fully_connected_layer(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_outputs, NodeID weights_nid, NodeID bias_nid = EmptyNodeID, const FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(), - const QuantizationInfo &out_quant_info = QuantizationInfo()); + const QuantizationInfo &out_quant_info = QuantizationInfo(), + FastMathHint fast_math_hint = FastMathHint::Disabled); /** Adds a fully connected layer node to the graph * * @param[in] g Graph to add the layer to @@ -313,6 +315,7 @@ public: * @param[in] fc_info (Optional) Fully connected layer metadata * @param[in] weights_quant_info (Optional) Weights quantization info * @param[in] out_quant_info (Optional) Output quantization info + * @param[in] fast_math_hint (Optional) Fast math hint * * @return Node ID of the created node, EmptyNodeID in case of error */ @@ -320,7 +323,8 @@ public: ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr, const FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(), const QuantizationInfo &weights_quant_info = QuantizationInfo(), - const QuantizationInfo &out_quant_info = QuantizationInfo()); + const QuantizationInfo &out_quant_info = QuantizationInfo(), + FastMathHint fast_math_hint = FastMathHint::Disabled); /** Adds a generate proposals layer node to the graph * * @param[in] g Graph to add the layer to -- cgit v1.2.1