aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CPP/GEMMLowp.cpp
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2017-09-29 16:43:25 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitbf2fb95c99ebd215b3c0d93cb970461185ef9716 (patch)
treeef9ea161a5b4bf04d057681eb435605f3d1fa5ab /tests/validation/CPP/GEMMLowp.cpp
parentdd715f2a88827241a3fb9e4a2d8be82455f649f7 (diff)
downloadComputeLibrary-bf2fb95c99ebd215b3c0d93cb970461185ef9716.tar.gz
COMPMID-481: Add gemmlowp_aarch64_v8p4 kernel.
Change-Id: I15496b16ffd636f5bff76572e750df7e15c80830 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/90532 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation/CPP/GEMMLowp.cpp')
-rw-r--r--tests/validation/CPP/GEMMLowp.cpp36
1 files changed, 36 insertions, 0 deletions
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<uint32_t> gemmlowp(const SimpleTensor<uint8_t> &a, const SimpleTensor<uint8_t> &b, SimpleTensor<uint32_t> &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<int32_t> 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<int32_t>(a[k + i * K]);
+ for(int j = 0; j < b_width; ++j)
+ {
+ auto tmp_b = static_cast<int32_t>(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 <typename T>
SimpleTensor<T> gemmlowp(const SimpleTensor<T> &a, const SimpleTensor<T> &b, SimpleTensor<T> &c,
int32_t a_offset, int32_t b_offset, int32_t c_offset, int32_t c_mult_int, int32_t out_shift)