/* * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifdef __aarch64__ #include #include #include #include namespace arm_gemm { void a64_sgemm_native_16x4(const float *A, int lda, const float *B, int ldb, float *C, int ldc, float beta, int M, int N, int K) { const int oddk = ((K % 8) >= 4) ? 1 : 0; const int beta0 = (beta == 0.0f) ? 1 : 0; const int oddones = (K % 4); float dummy_buffer[16]; std::memset(dummy_buffer, 0, sizeof(dummy_buffer)); /* For now, very naive with no blocking */ for (int y=0; y 1) ? (a_ptr0_base + lda) : dummy_buffer; const float * const a_ptr2_base = (activerows > 2) ? (a_ptr1_base + lda) : dummy_buffer; const float * const a_ptr3_base = (activerows > 3) ? (a_ptr2_base + lda) : dummy_buffer; const unsigned long a_incr1 = (activerows > 1) ? 32 : 0; const unsigned long a_incr2 = (activerows > 2) ? 32 : 0; const unsigned long a_incr3 = (activerows > 3) ? 32 : 0; float *c_ptr0 = C + (y * ldc); float *c_ptr1 = (activerows > 1) ? c_ptr0 + ldc : dummy_buffer; float *c_ptr2 = (activerows > 2) ? c_ptr1 + ldc : dummy_buffer; float *c_ptr3 = (activerows > 3) ? c_ptr2 + ldc : dummy_buffer; for (int x0=0; x0