diff options
author | Anthony Barbier <anthony.barbier@arm.com> | 2018-07-03 16:22:02 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:10 +0000 |
commit | 5f707736413aeac77818c42838296966f8dc6761 (patch) | |
tree | b829ed3243ea5f3085f288836132416c78bc2e72 /src/core/NEON/kernels/arm_gemm/mergeresults.hpp | |
parent | 7485d5a62685cb745ab50e970adb722cb71557ac (diff) | |
download | ComputeLibrary-5f707736413aeac77818c42838296966f8dc6761.tar.gz |
COMPMID-1369: Revert accidental formatting of RSH's repo
Pulled latest fixes from David's repo:
commit f43ebe932c84083332b0b1a0348241b69dda63a7
Author: David Mansell <David.Mansell@arm.com>
Date: Tue Jul 3 18:09:01 2018 +0100
Whitespace tidying, fixed comment in gemv_batched imported from ACL.
Change-Id: Ie37a623f44e90d88072236cb853ac55ac82d5f51
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/138530
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Reviewed-by: David Mansell <david.mansell@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/NEON/kernels/arm_gemm/mergeresults.hpp')
-rw-r--r-- | src/core/NEON/kernels/arm_gemm/mergeresults.hpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/core/NEON/kernels/arm_gemm/mergeresults.hpp b/src/core/NEON/kernels/arm_gemm/mergeresults.hpp index 4a6da3d21c..b1e2ca1daa 100644 --- a/src/core/NEON/kernels/arm_gemm/mergeresults.hpp +++ b/src/core/NEON/kernels/arm_gemm/mergeresults.hpp @@ -30,38 +30,39 @@ #include "asmlib.hpp" #include "utils.hpp" -namespace arm_gemm -{ -template <unsigned int width, unsigned int height, typename Tin, typename Tout> -inline void MergeResults(Tout *out, const Tin *in, int ldc, int y0, int ymax, int x0, int xmax, const Tout alpha, const Tout beta) -{ +namespace arm_gemm { + +template<unsigned int width, unsigned int height, typename Tin, typename Tout> +inline void MergeResults(Tout * out, const Tin * in, int ldc, int y0, int ymax, int x0, int xmax, const Tout alpha, const Tout beta) { int full_y_blocks = (ymax - y0) / height; - int y_remainder = (ymax - y0) % height; - int y_blocks = full_y_blocks + (y_remainder ? 1 : 0); + int y_remainder = (ymax - y0) % height; + int y_blocks = full_y_blocks + (y_remainder ? 1 : 0); int full_x_blocks = (xmax - x0) / width; - int x_remainder = (xmax - x0) % width; - int x_blocks = full_x_blocks + (x_remainder ? 1 : 0); + int x_remainder = (xmax - x0) % width; + int x_blocks = full_x_blocks + (x_remainder ? 1 : 0); - for(int y_block = 0; y_block < y_blocks; y_block++) - { + for (int y_block = 0; y_block < y_blocks; y_block++) { int ybase = y0 + (y_block * height); int fill_rows = (y_block < full_y_blocks) ? height : y_remainder; - for(int x_block = 0; x_block < x_blocks; x_block++) - { + for (int x_block = 0; x_block < x_blocks; x_block++) { int xbase = x0 + (x_block * width); int fill_cols = (x_block < full_x_blocks) ? width : x_remainder; - for(int row = 0; row < fill_rows; row++) - { - for(int col = 0; col < fill_cols; col++) - { + for (int row=0; row < fill_rows; row++) { + for (int col=0; col < fill_cols; col++) { Tout &p = out[(ybase + row) * ldc + xbase + col]; - p = (p * beta) + (alpha * in[row * width + col]); + // Special case for beta==0 - don't read the input; + // (0 * x == 0) is not always true for FP types. + if (beta == static_cast<Tout>(0)) { + p = (alpha * in[row * width + col]); + } else { + p = (p * beta) + (alpha * in[row * width + col]); + } } } |