blob: 52ef01da7be5c0dae139b29b75d159dead3f7086 [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
50class TinyMatMulDataset final : public MatMulDataset
51{
52public:
53 TinyMatMulDataset()
54 {
55 add_config(TensorShape(1U), TensorShape(1U), TensorShape(1U));
56 add_config(TensorShape(2U, 2U), TensorShape(2U, 2U), TensorShape(2U, 2U));
57 }
58};
59
Ramy Elgammalb531b752023-03-20 10:19:10 +000060class SmallMatMulDatasetRhsExportToCLImageRhsT final : public MatMulDataset
61{
62public:
63 // Some considerations:
64 // 1) K dimension should be a multiple of 4
65 // See (2), (3), and (4) in SmallMatMulDatasetRhsExportToCLImageRhsNT
66 SmallMatMulDatasetRhsExportToCLImageRhsT()
67 {
68 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));
69 }
70};
71
Gunes Bayirbbeef722023-03-20 10:19:10 +000072class SmallMatMulDatasetRhsExportToCLImageRhsNT final : public MatMulDataset
73{
74public:
75 // Some considerations:
76 // (1) N (Dimension 0 of Rhs matrix) dimension should be a multiple of 4
77 // (2) Having N=20 enables us to test all possible N0 values, i.e. 4, 8, 16
78 // (3) It's important to have more than one loop iterations in the K dimension
79 // K has been chosen in accordance with K0
80 // (4) The 5-th dimension has been chosen as non-unit because export_to_cl_iamge checks
81 // were using dim1 * dim2 * dim3 to calculate the CLImage height; however, in our case
82 // the tensor can be > 4D. To stress that case, the fifth dimension is chosen to be non-unit as well
83 SmallMatMulDatasetRhsExportToCLImageRhsNT()
84 {
85 add_config(TensorShape(7U, 3U, 2U, 1U, 2U), TensorShape(20U, 7U, 2U, 1U, 2U), TensorShape(20U, 3U, 2U, 1U, 2U));
86 }
87};
Ramy Elgammal2b6ebfe2023-03-09 21:15:37 +000088} // namespace datasets
89} // namespace test
90} // namespace arm_compute
Gunes Bayir8918b232023-03-17 13:52:21 +000091#endif /* ACL_TESTS_DATASETS_SMALLMATMULDATASET */