| 1 | /* |
| 2 | |
| 3 | BLIS |
| 4 | An object-based framework for developing high-performance BLAS-like |
| 5 | libraries. |
| 6 | |
| 7 | Copyright (C) 2023, The University of Texas at Austin |
| 8 | |
| 9 | Redistribution and use in source and binary forms, with or without |
| 10 | modification, are permitted provided that the following conditions are |
| 11 | met: |
| 12 | - Redistributions of source code must retain the above copyright |
| 13 | notice, this list of conditions and the following disclaimer. |
| 14 | - Redistributions in binary form must reproduce the above copyright |
| 15 | notice, this list of conditions and the following disclaimer in the |
| 16 | documentation and/or other materials provided with the distribution. |
| 17 | - Neither the name(s) of the copyright holder(s) nor the names of its |
| 18 | contributors may be used to endorse or promote products derived |
| 19 | from this software without specific prior written permission. |
| 20 | |
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | |
| 33 | */ |
| 34 | |
| 35 | #include "bli_rviv_utils.h" |
| 36 | |
| 37 | void bli_zgemm_rviv_asm_4vx4 |
| 38 | ( |
| 39 | intptr_t k, |
| 40 | const void* alpha, |
| 41 | const void* a, |
| 42 | const void* b, |
| 43 | const void* beta, |
| 44 | void* c, intptr_t rs_c, intptr_t cs_c |
| 45 | ); |
| 46 | |
| 47 | |
| 48 | void bli_zgemm_rviv_4vx4 |
| 49 | ( |
| 50 | dim_t m, |
| 51 | dim_t n, |
| 52 | dim_t k, |
| 53 | const void* alpha, |
| 54 | const void* a, |
| 55 | const void* b, |
| 56 | const void* beta, |
| 57 | void* c, inc_t rs_c, inc_t cs_c, |
| 58 | const auxinfo_t* data, |
| 59 | const cntx_t* cntx |
| 60 | ) |
| 61 | { |
| 62 | // The assembly kernels always take native machine-sized integer arguments. |
| 63 | // dim_t and inc_t are normally defined as being machine-sized. If larger, assert. |
| 64 | bli_static_assert( sizeof(dim_t) <= sizeof(intptr_t) && |
| 65 | sizeof(inc_t) <= sizeof(intptr_t) ); |
| 66 | |
| 67 | // Extract vector-length dependent mr, nr that are fixed at configure time. |
| 68 | const inc_t mr = bli_cntx_get_blksz_def_dt( BLIS_DCOMPLEX, BLIS_MR, cntx ); |
| 69 | const inc_t nr = 4; |
| 70 | |
| 71 | GEMM_UKR_SETUP_CT( z, mr, nr, false ); |
| 72 | |
| 73 | // The kernel assumes rs_c == 1, and the context should not deviate from it. |
| 74 | assert( rs_c == 1 ); |
| 75 | |
| 76 | bli_zgemm_rviv_asm_4vx4( k, alpha, a, b, beta, c, |
| 77 | get_vlenb() * 2, cs_c * sizeof(dcomplex) ); |
| 78 | |
| 79 | GEMM_UKR_FLUSH_CT( z ); |
| 80 | } |