blob: ce000bd8e15a084d6d0b61d7fdd17a6b2fc7457f [file] [log] [blame]
Gian Marco Iodicee7510622019-06-03 17:28:17 +01001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2019-2020 Arm Limited.
Gian Marco Iodicee7510622019-06-03 17:28:17 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/core/CL/kernels/CLGEMMLowpMatrixMultiplyNativeKernel.h"
25#include "arm_compute/core/Types.h"
26#include "arm_compute/core/utils/misc/ShapeCalculator.h"
27#include "tests/CL/CLAccessor.h"
28#include "tests/CL/Helper.h"
29#include "tests/framework/Asserts.h"
30#include "tests/framework/Macros.h"
31#include "tests/framework/datasets/Datasets.h"
32#include "tests/validation/Validation.h"
33#include "tests/validation/fixtures/GEMMLowpFixture.h"
34
35namespace arm_compute
36{
37namespace test
38{
39namespace validation
40{
41using namespace arm_compute::misc::shape_calculator;
42
43// Create function for CLGEMMMatrixMultiplyNativeKernel
44using CLGEMMLowpMatrixMultiplyNative = CLSynthetizeFunction<CLGEMMLowpMatrixMultiplyNativeKernel>;
45
46// Fixture for CLGEMMLowpMatrixMultiplyNative
47using CLGEMMLowpMatrixMultiplyNativeFixture = GEMMLowpMatrixMultiplyNativeValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyNative>;
48
49// Fixture for CLGEMMMatrixMultiplyNative3D
50using CLGEMMLowpMatrixMultiplyNative3DFixture = GEMMLowpMatrixMultiplyNative3DValidationFixture<CLTensor, CLAccessor, CLGEMMLowpMatrixMultiplyNative>;
51
52namespace
53{
54// *INDENT-OFF*
55// clang-format off
56/** M values to test */
57const auto m_values = framework::dataset::make("M", 37);
58
59/** M_W values to test */
60const auto m_w_values = framework::dataset::make("M_W", 5);
61
62/** M_H values to test */
63const auto m_h_values = framework::dataset::make("M_H", 7);
64
65/** N values to test */
66const auto n_values = framework::dataset::make("N", 51);
67
68/** K values to test */
69const auto k_values = framework::dataset::make("K", 23);
70
71/** Batch size values to test */
72const auto b_values = framework::dataset::make("batch_size", 1, 3);
73
74/** M0 values to test - Precommit */
75const auto m0_values_precommit = framework::dataset::make("M0", {4, 6});
76
77/** N0 values to test - Precommit */
Gian Marco Iodiced820db62019-08-05 14:23:23 +010078const auto n0_values_precommit = framework::dataset::make("N0", { 4 });
Gian Marco Iodicee7510622019-06-03 17:28:17 +010079
80/** K0 values to test - Precommit */
Gian Marco Iodiced820db62019-08-05 14:23:23 +010081const auto k0_values_precommit = framework::dataset::make("K0", { 16 });
Gian Marco Iodicee7510622019-06-03 17:28:17 +010082
83/** M0 values to test - Nightly */
SiCong Li738893e2020-05-01 12:55:16 +010084const auto m0_values_nightly = framework::dataset::make("M0", 1, 2, 7);
Gian Marco Iodicee7510622019-06-03 17:28:17 +010085
86/** N0 values to test - Nightly */
SiCong Li738893e2020-05-01 12:55:16 +010087const auto n0_values_nightly = framework::dataset::make("N0", { 1, 2, 3, 4, 8 });
Gian Marco Iodicee7510622019-06-03 17:28:17 +010088
89/** K0 values to test - Nightly */
SiCong Li738893e2020-05-01 12:55:16 +010090const auto k0_values_nightly = framework::dataset::make("K0", { 1, 2, 3, 4, 8, 16 });
Gian Marco Iodicee7510622019-06-03 17:28:17 +010091} // namespace
92
93TEST_SUITE(CL)
94TEST_SUITE(GEMMLowpMatrixMultiplyNative)
95FIXTURE_DATA_TEST_CASE(RunSmall, CLGEMMLowpMatrixMultiplyNativeFixture, framework::DatasetMode::ALL,
96 combine(combine(combine(combine(combine(combine(m_values,
97 n_values),
98 k_values),
99 b_values),
100 m0_values_precommit),
101 n0_values_precommit),
102 k0_values_precommit))
103{
104 // Validate output
105 validate(CLAccessor(_target), _reference);
106}
107
SiCong Li738893e2020-05-01 12:55:16 +0100108FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMLowpMatrixMultiplyNativeFixture, framework::DatasetMode::ALL,
Gian Marco Iodicee7510622019-06-03 17:28:17 +0100109 combine(combine(combine(combine(combine(combine(m_values,
110 n_values),
111 k_values),
112 b_values),
113 m0_values_nightly),
114 n0_values_nightly),
115 k0_values_nightly))
116{
117 // Validate output
118 validate(CLAccessor(_target), _reference);
119}
120
121FIXTURE_DATA_TEST_CASE(RunSmall3D, CLGEMMLowpMatrixMultiplyNative3DFixture, framework::DatasetMode::ALL,
122 combine(combine(combine(combine(combine(combine(combine(m_w_values,
123 m_h_values),
124 n_values),
125 k_values),
126 b_values),
127 m0_values_precommit),
128 n0_values_precommit),
129 k0_values_precommit))
130{
131 // Validate output
132 validate(CLAccessor(_target), _reference);
133}
134
SiCong Li738893e2020-05-01 12:55:16 +0100135FIXTURE_DATA_TEST_CASE(RunLarge3D, CLGEMMLowpMatrixMultiplyNative3DFixture, framework::DatasetMode::ALL,
Gian Marco Iodicee7510622019-06-03 17:28:17 +0100136 combine(combine(combine(combine(combine(combine(combine(m_w_values,
137 m_h_values),
138 n_values),
139 k_values),
140 b_values),
141 m0_values_nightly),
142 n0_values_nightly),
143 k0_values_nightly))
144{
145 // Validate output
146 validate(CLAccessor(_target), _reference);
147}
148TEST_SUITE_END() // GEMMLowpMatrixMultiplyNative
149TEST_SUITE_END() // CL
150} // namespace validation
151} // namespace test
152} // namespace arm_compute