From: Shubham Gupta/System SW /SRI-Bangalore/Engineer/삼성전자 Date: Tue, 16 Oct 2018 01:23:26 +0000 (+0530) Subject: Removing function overhead of pow in Squarediff kernel (#3130) X-Git-Tag: 0.3~638 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ebe115e58ea9bc5e00fdfd1df5efae0401f7d99d;p=platform%2Fcore%2Fml%2Fnnfw.git Removing function overhead of pow in Squarediff kernel (#3130) This patch will remove function overhead of pow since pow(x,2) can be wirtten as x*x Signed-off-by: shubham --- diff --git a/libs/ARMComputeEx/src/core/CL/cl_kernels/squared_difference.cl b/libs/ARMComputeEx/src/core/CL/cl_kernels/squared_difference.cl index 7c12626..de8602d 100644 --- a/libs/ARMComputeEx/src/core/CL/cl_kernels/squared_difference.cl +++ b/libs/ARMComputeEx/src/core/CL/cl_kernels/squared_difference.cl @@ -58,7 +58,12 @@ __kernel void squared_difference( Tensor3D input2 = CONVERT_TO_TENSOR3D_STRUCT(input2); Tensor3D output = CONVERT_TO_TENSOR3D_STRUCT(output); + VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE) + diff = VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)input1.ptr)- VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)input2.ptr); + + VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE) + sq_diff = diff * diff; + VSTORE(VEC_SIZE) - (pow(VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)input1.ptr) - VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)input2.ptr), 2), - 0, (__global DATA_TYPE *)output.ptr); + (sq_diff, 0, (__global DATA_TYPE *)output.ptr); }