1 /* 2 * Copyright (c) 2022 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 __aarch64__ 27 28 #include <cstdint> 29 #include "../std_transforms_sme.hpp" 30 31 namespace arm_gemm 32 { 33 34 // Implementations 35 void sme2_interleaved_nomerge_s8s32_mopa_2VLx2VL(const int8_t *const A, const int8_t *const B, int32_t *const C, int ldc, const int M, const int N, const int K, const int32_t *const bias, const Activation act, bool accumulate, int32_t *const accumulator_buffer); 36 37 class cls_sme2_interleaved_nomerge_s8s32_mopa_2VLx2VL 38 { 39 public: 40 typedef int8_t operand_type; 41 typedef int32_t result_type; 42 43 typedef void (*kern_type)(const int8_t *const A, const int8_t *const B, int32_t *const C, int ldc, const int M, const int N, const int K, const int32_t *const bias, const Activation act, bool accumulate, int32_t *const accumulator_buffer); 44 45 /* Kernel blocking parameters */ out_height()46 static unsigned int out_height() 47 { 48 return sme::get_vector_length<int32_t>() * 2; 49 } 50 out_width()51 static unsigned int out_width() 52 { 53 return sme::get_vector_length<int32_t>() * 2; 54 } 55 k_unroll()56 static constexpr unsigned int k_unroll() 57 { 58 return 4; 59 } 60 supports_accumulate()61 static constexpr bool supports_accumulate() 62 { 63 return true; 64 } 65 supports_bias()66 static constexpr bool supports_bias() 67 { 68 return true; 69 } 70 supports_activation()71 static constexpr bool supports_activation() 72 { 73 return false; 74 } 75 is_sme()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_s8s32_mopa_2VLx2VL; 83 84 StdTransformsSME<operand_type, result_type, 2, 2, 4> transforms = {}; 85 cls_sme2_interleaved_nomerge_s8s32_mopa_2VLx2VL(const CPUInfo * ci)86 cls_sme2_interleaved_nomerge_s8s32_mopa_2VLx2VL(const CPUInfo *ci) 87 { 88 ARM_COMPUTE_UNUSED(ci); 89 } 90 }; 91 92 } // namespace arm_gemm 93 94 #endif // __aarch64__ 95