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