From 2aa7fd011a4baff52dceb00a71b3674f819df8fc Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Wed, 18 Sep 2019 13:39:00 +0100 Subject: COMPMID-2601 [CL] add mixed precision support to PoolingLayer * PoolingLayerInfo is updated with a new flag. * CL Kernel is updated to use FP32 accumulation. * CL pooling layer testscases are added for mixed precision. * Reference pooling layer is updated to use FP32 accumulation. Change-Id: I4ab2167cc7f86c86293cf50a0ca5119c04dc9c7e Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/1973 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: VidhyaSudhan Loganathan --- src/core/CL/kernels/CLPoolingLayerKernel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/core/CL/kernels/CLPoolingLayerKernel.cpp') diff --git a/src/core/CL/kernels/CLPoolingLayerKernel.cpp b/src/core/CL/kernels/CLPoolingLayerKernel.cpp index 8eaf5bf76f..8e69157fdb 100644 --- a/src/core/CL/kernels/CLPoolingLayerKernel.cpp +++ b/src/core/CL/kernels/CLPoolingLayerKernel.cpp @@ -236,6 +236,12 @@ void CLPoolingLayerKernel::configure(const ICLTensor *input, ICLTensor *output, build_opts.add_option_if(data_type == DataType::F16, "-DFP16"); + const auto use_fp_mixed_precision = (data_type == DataType::F16) && pool_info.fp_mixed_precision(); + const auto use_wider_accumulator = use_fp_mixed_precision && (pool_type != PoolingType::MAX); + const auto acc_data_type = get_cl_type_from_data_type(use_wider_accumulator ? DataType::F32 : data_type); + build_opts.add_option("-DACC_DATA_TYPE=" + acc_data_type); + build_opts.add_option_if(use_wider_accumulator, "-DFP_MIXED_PRECISION"); + // Create kernel switch(data_layout) { -- cgit v1.2.1