blob: bb4cdad54b8a6a61740ff5c56fc19b779a293718 [file] [log] [blame]
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +00001/*
2 * Copyright (c) 2023 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 */
Gunes Bayir8918b232023-03-17 13:52:21 +000024#ifndef ACL_TESTS_DATASETS_SMALLMATMULDATASET
25#define ACL_TESTS_DATASETS_SMALLMATMULDATASET
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +000026
27#include "arm_compute/core/TensorShape.h"
28#include "arm_compute/core/Types.h"
Gunes Bayir8918b232023-03-17 13:52:21 +000029#include "tests/datasets/MatMulDataset.h"
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +000030
31namespace arm_compute
32{
33namespace test
34{
35namespace datasets
36{
Gunes Bayir8918b232023-03-17 13:52:21 +000037class SmallMatMulDataset final : public MatMulDataset
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +000038{
39public:
Gunes Bayir8918b232023-03-17 13:52:21 +000040 SmallMatMulDataset()
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +000041 {
42 add_config(TensorShape(3U, 4U, 2U, 2U), TensorShape(2U, 3U, 2U, 2U), TensorShape(2U, 4U, 2U, 2U));
43 add_config(TensorShape(9U, 6U), TensorShape(5U, 9U), TensorShape(5U, 6U));
44 add_config(TensorShape(31U, 1U), TensorShape(23U, 31U), TensorShape(23U, 1U));
45 add_config(TensorShape(8U, 4U, 2U), TensorShape(16U, 8U, 2U), TensorShape(16U, 4U, 2U));
46 add_config(TensorShape(32U, 2U), TensorShape(17U, 32U), TensorShape(17U, 2U));
47 }
48};
Gunes Bayir8918b232023-03-17 13:52:21 +000049
Viet-Hoa Do9c7c2d22023-04-11 17:16:27 +010050class SmallerMatMulDataset final : public MatMulDataset
51{
52public:
53 SmallerMatMulDataset()
54 {
55 add_config(TensorShape(9U, 6U), TensorShape(5U, 9U), TensorShape(5U, 6U));
56 add_config(TensorShape(8U, 4U, 2U), TensorShape(16U, 8U, 2U), TensorShape(16U, 4U, 2U));
57 add_config(TensorShape(32U, 2U), TensorShape(17U, 32U), TensorShape(17U, 2U));
58 }
59};
60
Gunes Bayir8918b232023-03-17 13:52:21 +000061class TinyMatMulDataset final : public MatMulDataset
62{
63public:
64 TinyMatMulDataset()
65 {
66 add_config(TensorShape(1U), TensorShape(1U), TensorShape(1U));
67 add_config(TensorShape(2U, 2U), TensorShape(2U, 2U), TensorShape(2U, 2U));
68 }
69};
70
Ramy Elgammalb531b752023-03-20 10:19:10 +000071class SmallMatMulDatasetRhsExportToCLImageRhsT final : public MatMulDataset
72{
73public:
74 // Some considerations:
75 // 1) K dimension should be a multiple of 4
76 // See (2), (3), and (4) in SmallMatMulDatasetRhsExportToCLImageRhsNT
77 SmallMatMulDatasetRhsExportToCLImageRhsT()
78 {
79 add_config(TensorShape(8U /*K*/, 3U /*M*/, 2U, 1U, 2U), TensorShape(20U /*N*/, 8U /*K*/, 2U, 1U, 2U), TensorShape(20U /*N*/, 3U /*M*/, 2U, 1U, 2U));
80 }
81};
82
Gunes Bayirbbeef722023-03-20 10:19:10 +000083class SmallMatMulDatasetRhsExportToCLImageRhsNT final : public MatMulDataset
84{
85public:
86 // Some considerations:
87 // (1) N (Dimension 0 of Rhs matrix) dimension should be a multiple of 4
88 // (2) Having N=20 enables us to test all possible N0 values, i.e. 4, 8, 16
89 // (3) It's important to have more than one loop iterations in the K dimension
90 // K has been chosen in accordance with K0
91 // (4) The 5-th dimension has been chosen as non-unit because export_to_cl_iamge checks
92 // were using dim1 * dim2 * dim3 to calculate the CLImage height; however, in our case
93 // the tensor can be > 4D. To stress that case, the fifth dimension is chosen to be non-unit as well
94 SmallMatMulDatasetRhsExportToCLImageRhsNT()
95 {
96 add_config(TensorShape(7U, 3U, 2U, 1U, 2U), TensorShape(20U, 7U, 2U, 1U, 2U), TensorShape(20U, 3U, 2U, 1U, 2U));
97 }
98};
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +000099} // namespace datasets
100} // namespace test
101} // namespace arm_compute
Gunes Bayir8918b232023-03-17 13:52:21 +0000102#endif /* ACL_TESTS_DATASETS_SMALLMATMULDATASET */