blob: 4597d79d43d762536085f771acf634709b6ee212 [file] [log] [blame]
Gian Marco Iodice926afe12019-03-19 11:44:13 +00001/*
2 * Copyright (c) 2019 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/CL/gemm/CLGEMMHelpers.h"
25
26#include <utility>
27
28namespace arm_compute
29{
30namespace cl_gemm
31{
32std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_lhs_rhs_info(unsigned int m, unsigned int n, unsigned int m0, unsigned int n0, unsigned int k0, unsigned int v0, unsigned int h0,
33 bool lhs_interleave, bool rhs_interleave, bool lhs_transpose, bool rhs_transpose)
34{
35 GEMMLHSMatrixInfo lhs_info;
36 GEMMRHSMatrixInfo rhs_info;
37
38 // Configure GEMMLHSMatrixInfo
39 lhs_info.m0 = m0;
40 lhs_info.k0 = k0;
41 lhs_info.v0 = ((m / (lhs_info.m0 * v0)) == 0) ? 1 : v0;
42 lhs_info.interleave = lhs_interleave;
43 lhs_info.transpose = lhs_transpose;
44
45 // Configure GEMMRHSMatrixInfo
46 rhs_info.n0 = n0;
47 rhs_info.k0 = lhs_info.k0;
48 rhs_info.h0 = ((n / (rhs_info.n0 * h0)) == 0) ? 1 : h0;
49 rhs_info.interleave = rhs_interleave;
50 rhs_info.transpose = rhs_transpose;
51
52 return std::make_pair(lhs_info, rhs_info);
53}
54} // namespace cl_gemm
55} // namespace arm_compute