blob: 045d334896ce856f0ce9164d3921f1edcc809c9d [file] [log] [blame]
Pablo Tello299025a2017-09-29 11:30:12 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
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/Types.h"
25#include "arm_compute/runtime/NEON/functions/NEGEMMLowp.h"
26#include "arm_compute/runtime/Tensor.h"
27#include "arm_compute/runtime/TensorAllocator.h"
28#include "tests/NEON/Accessor.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"
Pablo Tellobf2fb952017-09-29 16:43:25 +010033#include "tests/validation/fixtures/GEMMInterleaveBlockedFixture.h"
Pablo Tello299025a2017-09-29 11:30:12 +010034#include "tests/validation/fixtures/GEMMLowpFixture.h"
35
Pablo Tellobf2fb952017-09-29 16:43:25 +010036#include "arm_compute/core/NEON/kernels/NEGEMMInterleaveBlockedKernel.h"
37#include "tests/NEON/Helper.h"
38
Pablo Tello299025a2017-09-29 11:30:12 +010039namespace arm_compute
40{
41namespace test
42{
43namespace validation
44{
45namespace
46{
47constexpr AbsoluteTolerance<float> tolerance_f(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */
48
Pablo Tellobf2fb952017-09-29 16:43:25 +010049const auto data_mnk = framework::dataset::make("M", 12, 20) * framework::dataset::make("N", 12, 20) * framework::dataset::make("K", 12, 15);
Pablo Tello299025a2017-09-29 11:30:12 +010050const auto data_offsets = framework::dataset::make("a", -3, 3) * framework::dataset::make("b", -1, 2) * framework::dataset::make("c", 1, 3) * framework::dataset::make("cm", 0,
51 3)
52 * framework::dataset::make("shift", 0, 4);
53
Pablo Tellobf2fb952017-09-29 16:43:25 +010054const auto data_int_blk = framework::dataset::make("M", 8, 12) * framework::dataset::make("N", 8, 12) * framework::dataset::make("by", 8, 13) * framework::dataset::make("block", 4, 9);
55
56const auto data_int_blk_tr = framework::dataset::make("M", 8, 17) * framework::dataset::make("N", 8, 14) * framework::dataset::make("by", 12) * framework::dataset::make("block", 4);
57
Pablo Tello299025a2017-09-29 11:30:12 +010058} // namespace
59
60TEST_SUITE(NEON)
61TEST_SUITE(GEMMLowp)
62
63TEST_SUITE(U8)
Pablo Tellobf2fb952017-09-29 16:43:25 +010064
65TEST_SUITE(INTERLEAVE_BLOCKED)
66
67using NEInterleaveBlocked = NESynthetizeFunction<NEGEMMInterleaveBlockedKernel>;
68using NEGEMMInterleaveBlockedFixture = GEMMInterleaveBlockedValidationFixture<Tensor, Accessor, NEInterleaveBlocked>;
69FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMInterleaveBlockedFixture, framework::DatasetMode::PRECOMMIT, data_int_blk)
70{
71 // Validate output
72 validate(Accessor(_target), _reference, tolerance_f);
73}
74TEST_SUITE_END()
75
76TEST_SUITE(INTERLEAVE_BLOCKED_TRANSPOSED)
77using NEInterleaveBlockedTransposed = NESynthetizeFunction<NEGEMMInterleaveBlockedKernel>;
78using NEGEMMInterleaveBlockedTransposedFixture = GEMMInterleaveBlockedValidationFixture<Tensor, Accessor, NEInterleaveBlockedTransposed, true>;
79FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMInterleaveBlockedTransposedFixture, framework::DatasetMode::PRECOMMIT, data_int_blk_tr)
80{
81 // Validate output
82 validate(Accessor(_target), _reference, tolerance_f);
83}
84
85TEST_SUITE_END()
86
Pablo Tello299025a2017-09-29 11:30:12 +010087using NEGEMMLowpOffsetFixture = GEMMLowpOffsetValidationFixture<Tensor, Accessor, NEGEMMLowp>;
88FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpOffsetFixture, framework::DatasetMode::PRECOMMIT, data_mnk *data_offsets)
89{
90 // Validate output
91 validate(Accessor(_target), _reference, tolerance_f);
92}
93TEST_SUITE_END()
94
Pablo Tellobf2fb952017-09-29 16:43:25 +010095#if defined(__aarch64__)
96TEST_SUITE(U32)
97using NEGEMMLowpFixture = GEMMLowpValidationFixture<Tensor, Accessor, NEGEMMLowp>;
98FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMLowpFixture, framework::DatasetMode::PRECOMMIT, framework::dataset::make("M", 12, 20) * framework::dataset::make("N", 12, 20) * framework::dataset::make("K",
99 16))
100{
101 // Validate output
102 validate(Accessor(_target), _reference, tolerance_f);
103}
104TEST_SUITE_END()
105#endif // defined(__aarch64__)
Pablo Tello299025a2017-09-29 11:30:12 +0100106TEST_SUITE_END()
107TEST_SUITE_END()
108} // namespace validation
109} // namespace test
110} // namespace arm_compute