From 5f707736413aeac77818c42838296966f8dc6761 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Tue, 3 Jul 2018 16:22:02 +0100 Subject: COMPMID-1369: Revert accidental formatting of RSH's repo Pulled latest fixes from David's repo: commit f43ebe932c84083332b0b1a0348241b69dda63a7 Author: David Mansell 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 Reviewed-by: Georgios Pinitas Reviewed-by: Gian Marco Iodice Reviewed-by: David Mansell Reviewed-by: Anthony Barbier --- src/core/NEON/kernels/arm_gemm/mergeresults.hpp | 37 +++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/core/NEON/kernels/arm_gemm/mergeresults.hpp') 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 -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 +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(0)) { + p = (alpha * in[row * width + col]); + } else { + p = (p * beta) + (alpha * in[row * width + col]); + } } } -- cgit v1.2.1