blob: 70952f4f038128ee0ecdd4b179b899bcaa12fff8 [file] [log] [blame]
Jonathan Deakina668f9f2024-01-24 09:15:38 +00001/*
2 * Copyright (c) 2024 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#pragma once
25
26#ifdef ARM_COMPUTE_ENABLE_SME2
27
28#include <cstdint>
29#include "../std_transforms_sme.hpp"
30
31namespace arm_gemm
32{
33
34// Implementations
35void sme2_interleaved_nomerge_s8qfp32_mopa_4VLx1VL(const int8_t *const A, const int8_t *const B, float *const C, int ldc, const int M, const int N, const int K, const int32_t *const bias, const DequantizeFloat &dq, const float *const late_bias, const Activation act, bool accumulate, int32_t *const accumulator_buffer);
36
37class cls_sme2_interleaved_nomerge_s8qfp32_mopa_4VLx1VL
38{
39public:
40 typedef int8_t operand_type;
41 typedef float result_type;
42
43 typedef void (*kern_type)(const int8_t *const A, const int8_t *const B, float *const C, int ldc, const int M, const int N, const int K, const int32_t *const bias, const DequantizeFloat &dq, const float *const late_bias, const Activation act, bool accumulate, int32_t *const accumulator_buffer);
44
45 /* Kernel blocking parameters */
46 static unsigned int out_height()
47 {
48 return sme::get_vector_length<int32_t>() * 4;
49 }
50
51 static unsigned int out_width()
52 {
53 return sme::get_vector_length<int32_t>() * 1;
54 }
55
56 static constexpr unsigned int k_unroll()
57 {
58 return 4;
59 }
60
61 static constexpr bool supports_accumulate()
62 {
63 return true;
64 }
65
66 static constexpr bool supports_bias()
67 {
68 return true;
69 }
70
71 static constexpr bool supports_activation()
72 {
73 return true;
74 }
75
76 static constexpr bool is_sme()
77 {
78 return true;
79 }
80
81 // Default to the generic kernel
82 kern_type kernel = sme2_interleaved_nomerge_s8qfp32_mopa_4VLx1VL;
83
84 StdTransformsSME<operand_type, result_type, 4, 1, 4> transforms = {};
85
86 cls_sme2_interleaved_nomerge_s8qfp32_mopa_4VLx1VL(const CPUInfo *)
87 {
88 }
89};
90
91} // namespace arm_gemm
92
93#endif // ARM_COMPUTE_ENABLE_SME2