From 5a7e776eee2e9147eab12631f5717847fb6cac5c Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 1 Dec 2017 16:27:29 +0000 Subject: COMPMID-556: Rename CPP folder to reference Change-Id: I147644349547c4e3804a80b564a9ad95131ad2d0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/111560 Reviewed-by: Michalis Spyrou Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com --- tests/validation/CPP/GEMM.cpp | 122 ------------------------------------------ 1 file changed, 122 deletions(-) delete mode 100644 tests/validation/CPP/GEMM.cpp (limited to 'tests/validation/CPP/GEMM.cpp') diff --git a/tests/validation/CPP/GEMM.cpp b/tests/validation/CPP/GEMM.cpp deleted file mode 100644 index 77d025ec8e..0000000000 --- a/tests/validation/CPP/GEMM.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#include "GEMM.h" - -#include "arm_compute/core/Types.h" -#include "tests/validation/FixedPoint.h" - -namespace arm_compute -{ -namespace test -{ -namespace validation -{ -namespace reference -{ -template ::value, int>::type> -SimpleTensor gemm(const SimpleTensor &a, const SimpleTensor &b, const SimpleTensor &c, float alpha, float beta) -{ - // Create reference - SimpleTensor dst{ c.shape(), c.data_type(), 1, c.fixed_point_position() }; - - // Compute reference - const int M = dst.shape().y(); - const int N = dst.shape().x(); - const int K = a.shape().x(); - - for(int row = 0; row < M; ++row) - { - for(int col = 0; col < N; ++col) - { - T acc(0); - - for(int k = 0; k < K; ++k) - { - acc += a[row * K + k] * b[k * N + col]; - } - - // Finalize the result: alpha * A * B + beta * C - dst[col + row * N] = alpha * acc + beta * c[col + row * N]; - } - } - - return dst; -} - -template ::value, int>::type> -SimpleTensor gemm(const SimpleTensor &a, const SimpleTensor &b, const SimpleTensor &c, float alpha, float beta) -{ - using namespace fixed_point_arithmetic; - - // Create reference - SimpleTensor dst{ c.shape(), c.data_type(), 1, c.fixed_point_position() }; - - // Compute reference - using promoted_type = fixed_point_arithmetic::traits::promote_t; - - const int M = dst.shape().y(); - const int N = dst.shape().x(); - const int K = a.shape().x(); - const int fixed_point_position = a.fixed_point_position(); - - const fixed_point alpha_q(alpha, fixed_point_position); - const fixed_point beta_q(beta, fixed_point_position); - - for(int row = 0; row < M; ++row) - { - for(int col = 0; col < N; ++col) - { - fixed_point acc_q(0, fixed_point_position); - - for(int k = 0; k < K; ++k) - { - const fixed_point a0_q(a[row * K + k], fixed_point_position, true); - const fixed_point b0_q(b[k * N + col], fixed_point_position, true); - - acc_q = acc_q + (a0_q * b0_q); - } - - // Finalize the result: alpha * A * B + beta * C - const fixed_point c0_q(c[col + row * N], fixed_point_position, true); - - fixed_point res_q(acc_q); - res_q = alpha_q * res_q; - res_q = res_q + (beta_q * c0_q); - - // Store the result - dst[col + row * N] = res_q.raw(); - } - } - - return dst; -} - -template SimpleTensor gemm(const SimpleTensor &a, const SimpleTensor &b, const SimpleTensor &c, float alpha, float beta); -template SimpleTensor gemm(const SimpleTensor &a, const SimpleTensor &b, const SimpleTensor &c, float alpha, float beta); -template SimpleTensor gemm(const SimpleTensor &a, const SimpleTensor &b, const SimpleTensor &c, float alpha, float beta); -template SimpleTensor gemm(const SimpleTensor &a, const SimpleTensor &b, const SimpleTensor &c, float alpha, float beta); -} // namespace reference -} // namespace validation -} // namespace test -} // namespace arm_compute -- cgit v1.2.1