diff options
author | Giorgio Arena <giorgio.arena@arm.com> | 2018-01-17 16:13:46 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:43:42 +0000 |
commit | a0d1183a15c6788676a12160f56e4c576ee1a84b (patch) | |
tree | 9f404c3addc837ddcc333cea7000a79a17b4c9f3 /src/core/CL/cl_kernels/activation_layer_qa8.cl | |
parent | 51a673020af96273ab9d760ea7473a62aad5460f (diff) | |
download | ComputeLibrary-a0d1183a15c6788676a12160f56e4c576ee1a84b.tar.gz |
COMPMID-751 QASYMM8 ActivationLayer optimisation: don't requantize if not necessary
Change-Id: Iea8a21f7c71025bfde6fdf7c7a7c92ba749b189b
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/116673
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/cl_kernels/activation_layer_qa8.cl')
-rw-r--r-- | src/core/CL/cl_kernels/activation_layer_qa8.cl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/CL/cl_kernels/activation_layer_qa8.cl b/src/core/CL/cl_kernels/activation_layer_qa8.cl index 910a93fdc1..02668f7ac1 100644 --- a/src/core/CL/cl_kernels/activation_layer_qa8.cl +++ b/src/core/CL/cl_kernels/activation_layer_qa8.cl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -89,12 +89,16 @@ __kernel void activation_layer_qa8( // Perform activation data = ACTIVATION_OP(ACT, data); +#if defined(O1_VAL) && defined(O2_VAL) && defined(S1_VAL) && defined(S2_VAL) // requantize to output space - float16 fdata = convert_float16(data); - fdata = round((fdata - (float)O1_VAL) * ((float)S1_VAL / (float)S2_VAL) + (float)O2_VAL); - uchar16 qdata = convert_uchar16_sat(fdata); + VEC_DATA_TYPE(float, VEC_SIZE) + fdata = CONVERT(data, VEC_DATA_TYPE(float, VEC_SIZE)); + + fdata = round((fdata - (float)O1_VAL) * ((float)S1_VAL / (float)S2_VAL) + (float)O2_VAL); + data = CONVERT_SAT(fdata, VEC_DATA_TYPE(uchar, VEC_SIZE)); +#endif // defined(O1_VAL) && defined(O2_VAL) && defined(S1_VAL) && defined(S2_VAL) // Store result VSTORE(VEC_SIZE) - (qdata, 0, (__global DATA_TYPE *)output.ptr); + (data, 0, (__global DATA_TYPE *)output.ptr); } |