aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2019-06-26 17:18:11 +0100
committerGian Marco Iodice <gianmarco.iodice@arm.com>2019-06-28 13:51:34 +0000
commit7026b303d636e7639f8877ae8d5eff54f39c1121 (patch)
treed30d5969706dc688d84e276132c02cdd4c046e09 /tests
parent49f83497526816932e76e9e5f90a1799d50f15ba (diff)
downloadComputeLibrary-7026b303d636e7639f8877ae8d5eff54f39c1121.tar.gz
COMPMID-1979: Fuse Activation Function in CLGEMM - part 1
Implementing a new struct to contains the information for the OpenCL GEMM kernels Change-Id: I6c641c312f9c3b025a7c69dd0df3b730d2d2c2cb Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/1434 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/validation/CL/GEMMMatrixMultiplyNative.cpp12
-rw-r--r--tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp13
-rw-r--r--tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp13
-rw-r--r--tests/validation/fixtures/GEMMFixture.h55
4 files changed, 78 insertions, 15 deletions
diff --git a/tests/validation/CL/GEMMMatrixMultiplyNative.cpp b/tests/validation/CL/GEMMMatrixMultiplyNative.cpp
index b0d1fd2ad1..031b807ef8 100644
--- a/tests/validation/CL/GEMMMatrixMultiplyNative.cpp
+++ b/tests/validation/CL/GEMMMatrixMultiplyNative.cpp
@@ -22,6 +22,7 @@
* SOFTWARE.
*/
#include "arm_compute/core/CL/kernels/CLGEMMMatrixMultiplyNativeKernel.h"
+#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
@@ -128,7 +129,11 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
rhs_info.n0 = n0_value;
rhs_info.k0 = k0_value;
- GEMMReshapeInfo gemm_info(M, N, K, false, false, 0, false, broadcast_bias);
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.broadcast_bias = broadcast_bias;
const TensorShape lhs_shape(K, M, b_value);
const TensorShape rhs_shape(N, K, b_value);
@@ -137,7 +142,8 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
broadcast_bias? 1 : b_value);
const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, data_type),
TensorInfo(rhs_shape, 1, data_type),
- gemm_info);
+ kernel_info);
+
// Create tensors
CLTensor lhs = create_tensor<CLTensor>(lhs_shape, data_type);
CLTensor rhs = create_tensor<CLTensor>(rhs_shape, data_type);
@@ -151,7 +157,7 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
// Create and configure function
CLGEMMMatrixMultiplyNative gemm;
- gemm.configure(&lhs, &rhs, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, gemm_info);
+ gemm.configure(&lhs, &rhs, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, kernel_info);
}
} // namespace
diff --git a/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp b/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp
index 69e58303f3..bd70ddbe8c 100644
--- a/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp
+++ b/tests/validation/CL/GEMMMatrixMultiplyReshaped.cpp
@@ -24,6 +24,7 @@
#include "arm_compute/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.h"
+#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
@@ -157,7 +158,13 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
rhs_info.interleave = i_value_rhs;
rhs_info.transpose = true;
- GEMMReshapeInfo gemm_info(M, N, K, false, false, 0, false, broadcast_bias);
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = 0;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = broadcast_bias;
const TensorShape lhs_shape(K, M, b_value);
const TensorShape lhs_shape_reshaped = compute_lhs_reshaped_shape(TensorInfo(lhs_shape, 1, data_type),
@@ -170,7 +177,7 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape_reshaped, 1, data_type),
TensorInfo(rhs_shape_reshaped, 1, data_type),
- gemm_info);
+ kernel_info);
const TensorShape bias_shape(N,
broadcast_bias? 1 : M,
@@ -189,7 +196,7 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
// Create and configure function
CLGEMMMatrixMultiplyReshaped gemm;
- gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, gemm_info);
+ gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, kernel_info);
}
} // namespace
diff --git a/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp b/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp
index 133170e2d3..6c34fc870a 100644
--- a/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp
+++ b/tests/validation/CL/GEMMMatrixMultiplyReshapedOnlyRHS.cpp
@@ -23,6 +23,7 @@
*/
#include "arm_compute/core/CL/kernels/CLGEMMMatrixMultiplyReshapedOnlyRHSKernel.h"
#include "arm_compute/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.h"
+#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/Types.h"
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "arm_compute/runtime/CL/CLTensor.h"
@@ -144,7 +145,13 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
rhs_info.interleave = i_value_rhs;
rhs_info.transpose = t_value_rhs;
- GEMMReshapeInfo gemm_info(M, N, K, false, false, 0, false, broadcast_bias);
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = 0;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = broadcast_bias;
const TensorShape lhs_shape(K, M, b_value);
const TensorShape rhs_shape(N, K, b_value);
@@ -153,7 +160,7 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
const TensorShape dst_shape = compute_mm_shape(TensorInfo(lhs_shape, 1, data_type),
TensorInfo(rhs_shape_reshaped, 1, data_type),
- gemm_info);
+ kernel_info);
const TensorShape bias_shape(N,
broadcast_bias? 1 : M,
@@ -172,7 +179,7 @@ void validate_configuration(unsigned int m_value, unsigned int n_value, unsigned
// Create and configure function
CLGEMMMatrixMultiplyReshapedOnlyRHS gemm;
- gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, gemm_info);
+ gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, 1.0f, 1.0f, lhs_info, rhs_info, kernel_info);
}
} // namespace
diff --git a/tests/validation/fixtures/GEMMFixture.h b/tests/validation/fixtures/GEMMFixture.h
index b721d841f7..a225c71ab7 100644
--- a/tests/validation/fixtures/GEMMFixture.h
+++ b/tests/validation/fixtures/GEMMFixture.h
@@ -24,6 +24,7 @@
#ifndef ARM_COMPUTE_TEST_GEMM_FIXTURE
#define ARM_COMPUTE_TEST_GEMM_FIXTURE
+#include "arm_compute/core/KernelDescriptors.h"
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"
#include "tests/AssetsLibrary.h"
@@ -210,6 +211,13 @@ protected:
const unsigned int M = lhs_shape[1];
const unsigned int N = rhs_shape[0];
const unsigned int K = lhs_shape[0];
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = 0;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = broadcast_bias;
// The output tensor will be auto-initialized within the function
@@ -219,7 +227,7 @@ protected:
GEMMFunctionType gemm;
reshape_lhs.configure(&lhs, &lhs_reshaped, lhs_info);
reshape_rhs.configure(&rhs, &rhs_reshaped, rhs_info);
- gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, GEMMReshapeInfo(M, N, K, 1, 1, 0, false, broadcast_bias));
+ gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -346,6 +354,13 @@ protected:
const unsigned int M = lhs_shape[1];
const unsigned int N = rhs_shape[0];
const unsigned int K = lhs_shape[0];
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = m_h;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = true;
// The output tensor will be auto-initialized within the function
@@ -355,7 +370,7 @@ protected:
GEMMFunctionType gemm;
reshape_lhs.configure(&lhs, &lhs_reshaped, lhs_info);
reshape_rhs.configure(&rhs, &rhs_reshaped, rhs_info);
- gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, GEMMReshapeInfo(M, N, K, 1, 1, m_h, false, true));
+ gemm.configure(&lhs_reshaped, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -479,6 +494,13 @@ protected:
const unsigned int M = lhs_shape[1];
const unsigned int N = rhs_shape[0];
const unsigned int K = lhs_shape[0];
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = 0;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = broadcast_bias;
// The output tensor will be auto-initialized within the function
@@ -486,7 +508,7 @@ protected:
ReshapeRHSFunctionType reshape_rhs;
GEMMFunctionType gemm;
reshape_rhs.configure(&rhs, &rhs_reshaped, rhs_info);
- gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, GEMMReshapeInfo(M, N, K, 1, 1, 0, false, broadcast_bias));
+ gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -606,6 +628,13 @@ protected:
const unsigned int M = lhs_shape[1];
const unsigned int N = rhs_shape[0];
const unsigned int K = lhs_shape[0];
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = m_h;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = true;
// The output tensor will be auto-initialized within the function
@@ -613,7 +642,7 @@ protected:
ReshapeRHSFunctionType reshape_rhs;
GEMMFunctionType gemm;
reshape_rhs.configure(&rhs, &rhs_reshaped, rhs_info);
- gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, GEMMReshapeInfo(M, N, K, 1, 1, m_h, false, true));
+ gemm.configure(&lhs, &rhs_reshaped, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -729,10 +758,17 @@ protected:
const unsigned int M = lhs_shape[1];
const unsigned int N = rhs_shape[0];
const unsigned int K = lhs_shape[0];
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = 0;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = broadcast_bias;
// Create and configure function
GEMMFunctionType gemm;
- gemm.configure(&lhs, &rhs, &bias, &dst, alpha, beta, lhs_info, rhs_info, GEMMReshapeInfo(M, N, K, 1, 1, 0, false, broadcast_bias));
+ gemm.configure(&lhs, &rhs, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -843,12 +879,19 @@ protected:
const unsigned int M = lhs_shape[1];
const unsigned int N = rhs_shape[0];
const unsigned int K = lhs_shape[0];
+ GEMMKernelInfo kernel_info;
+ kernel_info.m = M;
+ kernel_info.n = N;
+ kernel_info.k = K;
+ kernel_info.depth_output_gemm3d = m_h;
+ kernel_info.reinterpret_input_as_3d = false;
+ kernel_info.broadcast_bias = true;
// The output tensor will be auto-initialized within the function
// Create and configure function
GEMMFunctionType gemm;
- gemm.configure(&lhs, &rhs, &bias, &dst, alpha, beta, lhs_info, rhs_info, GEMMReshapeInfo(M, N, K, 1, 1, m_h, false, true));
+ gemm.configure(&lhs, &rhs, &bias, &dst, alpha, beta, lhs_info, rhs_info, kernel_info);
ARM_COMPUTE_EXPECT(lhs.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(rhs.info()->is_resizable(), framework::LogLevel::ERRORS);