From bf2fb95c99ebd215b3c0d93cb970461185ef9716 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Fri, 29 Sep 2017 16:43:25 +0100 Subject: COMPMID-481: Add gemmlowp_aarch64_v8p4 kernel. Change-Id: I15496b16ffd636f5bff76572e750df7e15c80830 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/90532 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- tests/validation/CPP/GEMMLowp.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/validation/CPP/GEMMLowp.cpp') diff --git a/tests/validation/CPP/GEMMLowp.cpp b/tests/validation/CPP/GEMMLowp.cpp index d172a773b6..06926e631e 100644 --- a/tests/validation/CPP/GEMMLowp.cpp +++ b/tests/validation/CPP/GEMMLowp.cpp @@ -34,6 +34,42 @@ namespace validation { namespace reference { +SimpleTensor gemmlowp(const SimpleTensor &a, const SimpleTensor &b, SimpleTensor &c) +{ + ARM_COMPUTE_UNUSED(a); + ARM_COMPUTE_UNUSED(b); + ARM_COMPUTE_UNUSED(c); + const int K = a.shape().x(); + const int b_width = b.shape().x(); + const int rows = c.shape().y(); //M + const int cols = c.shape().x(); //N + std::vector acc; + acc.resize(cols); + for(int i = 0; i < rows; ++i) + { + for(int j = 0; j < cols; ++j) + { + acc[j] = 0; + } + for(int k = 0; k < K; ++k) + { + auto tmp_a = static_cast(a[k + i * K]); + for(int j = 0; j < b_width; ++j) + { + auto tmp_b = static_cast(b[j + k * b_width]); + const int32_t mult_as_int = tmp_a * tmp_b; + acc[j] += mult_as_int; + } + } + for(int j = 0; j < cols; ++j) + { + c[j + i * cols] = acc[j]; + } + } + + return c; +} + template SimpleTensor gemmlowp(const SimpleTensor &a, const SimpleTensor &b, SimpleTensor &c, int32_t a_offset, int32_t b_offset, int32_t c_offset, int32_t c_mult_int, int32_t out_shift) -- cgit v1.2.1