1 /* 2 3 BLIS 4 An object-based framework for developing high-performance BLAS-like 5 libraries. 6 7 Copyright (C) 2014, 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 // Guard the function definitions so that they are only compiled when 36 // #included from files that define the typed API macros. 37 #ifdef BLIS_ENABLE_TAPI 38 39 // 40 // Define BLAS-like interfaces with typed operands. 41 // 42 43 #undef GENTFUNC 44 #define GENTFUNC( ctype, ch, opname, kerid ) \ 45 \ 46 void PASTEMAC2(ch,opname,EX_SUF) \ 47 ( \ 48 conj_t conjx, \ 49 conj_t conjy, \ 50 dim_t n, \ 51 ctype* alphax, \ 52 ctype* alphay, \ 53 ctype* x, inc_t incx, \ 54 ctype* y, inc_t incy, \ 55 ctype* z, inc_t incz \ 56 BLIS_TAPI_EX_PARAMS \ 57 ) \ 58 { \ 59 bli_init_once(); \ 60 \ 61 BLIS_TAPI_EX_DECLS \ 62 \ 63 const num_t dt = PASTEMAC(ch,type); \ 64 \ 65 /* Obtain a valid context from the gks if necessary. */ \ 66 if ( cntx == NULL ) cntx = bli_gks_query_cntx(); \ 67 \ 68 PASTECH2(ch,opname,_ker_ft) f = bli_cntx_get_l1f_ker_dt( dt, kerid, cntx ); \ 69 \ 70 f \ 71 ( \ 72 conjx, \ 73 conjy, \ 74 n, \ 75 alphax, \ 76 alphay, \ 77 x, incx, \ 78 y, incy, \ 79 z, incz, \ 80 cntx \ 81 ); \ 82 } 83 84 INSERT_GENTFUNC_BASIC( axpy2v, BLIS_AXPY2V_KER ) 85 86 87 #undef GENTFUNC 88 #define GENTFUNC( ctype, ch, opname, kerid ) \ 89 \ 90 void PASTEMAC2(ch,opname,EX_SUF) \ 91 ( \ 92 conj_t conja, \ 93 conj_t conjx, \ 94 dim_t m, \ 95 dim_t b_n, \ 96 ctype* alpha, \ 97 ctype* a, inc_t inca, inc_t lda, \ 98 ctype* x, inc_t incx, \ 99 ctype* y, inc_t incy \ 100 BLIS_TAPI_EX_PARAMS \ 101 ) \ 102 { \ 103 bli_init_once(); \ 104 \ 105 BLIS_TAPI_EX_DECLS \ 106 \ 107 const num_t dt = PASTEMAC(ch,type); \ 108 \ 109 /* Obtain a valid context from the gks if necessary. */ \ 110 if ( cntx == NULL ) cntx = bli_gks_query_cntx(); \ 111 \ 112 PASTECH2(ch,opname,_ker_ft) f = bli_cntx_get_l1f_ker_dt( dt, kerid, cntx ); \ 113 \ 114 f \ 115 ( \ 116 conja, \ 117 conjx, \ 118 m, \ 119 b_n, \ 120 alpha, \ 121 a, inca, lda, \ 122 x, incx, \ 123 y, incy, \ 124 cntx \ 125 ); \ 126 } 127 128 INSERT_GENTFUNC_BASIC( axpyf, BLIS_AXPYF_KER ) 129 130 131 #undef GENTFUNC 132 #define GENTFUNC( ctype, ch, opname, kerid ) \ 133 \ 134 void PASTEMAC2(ch,opname,EX_SUF) \ 135 ( \ 136 conj_t conjxt, \ 137 conj_t conjx, \ 138 conj_t conjy, \ 139 dim_t n, \ 140 ctype* alpha, \ 141 ctype* x, inc_t incx, \ 142 ctype* y, inc_t incy, \ 143 ctype* rho, \ 144 ctype* z, inc_t incz \ 145 BLIS_TAPI_EX_PARAMS \ 146 ) \ 147 { \ 148 bli_init_once(); \ 149 \ 150 BLIS_TAPI_EX_DECLS \ 151 \ 152 const num_t dt = PASTEMAC(ch,type); \ 153 \ 154 /* Obtain a valid context from the gks if necessary. */ \ 155 if ( cntx == NULL ) cntx = bli_gks_query_cntx(); \ 156 \ 157 PASTECH2(ch,opname,_ker_ft) f = bli_cntx_get_l1f_ker_dt( dt, kerid, cntx ); \ 158 \ 159 f \ 160 ( \ 161 conjxt, \ 162 conjx, \ 163 conjy, \ 164 n, \ 165 alpha, \ 166 x, incx, \ 167 y, incy, \ 168 rho, \ 169 z, incz, \ 170 cntx \ 171 ); \ 172 } 173 174 INSERT_GENTFUNC_BASIC( dotaxpyv, BLIS_DOTAXPYV_KER ) 175 176 177 #undef GENTFUNC 178 #define GENTFUNC( ctype, ch, opname, kerid ) \ 179 \ 180 void PASTEMAC2(ch,opname,EX_SUF) \ 181 ( \ 182 conj_t conjat, \ 183 conj_t conja, \ 184 conj_t conjw, \ 185 conj_t conjx, \ 186 dim_t m, \ 187 dim_t b_n, \ 188 ctype* alpha, \ 189 ctype* a, inc_t inca, inc_t lda, \ 190 ctype* w, inc_t incw, \ 191 ctype* x, inc_t incx, \ 192 ctype* beta, \ 193 ctype* y, inc_t incy, \ 194 ctype* z, inc_t incz \ 195 BLIS_TAPI_EX_PARAMS \ 196 ) \ 197 { \ 198 bli_init_once(); \ 199 \ 200 BLIS_TAPI_EX_DECLS \ 201 \ 202 const num_t dt = PASTEMAC(ch,type); \ 203 \ 204 /* Obtain a valid context from the gks if necessary. */ \ 205 if ( cntx == NULL ) cntx = bli_gks_query_cntx(); \ 206 \ 207 PASTECH2(ch,opname,_ker_ft) f = bli_cntx_get_l1f_ker_dt( dt, kerid, cntx ); \ 208 \ 209 f \ 210 ( \ 211 conjat, \ 212 conja, \ 213 conjw, \ 214 conjx, \ 215 m, \ 216 b_n, \ 217 alpha, \ 218 a, inca, lda, \ 219 w, incw, \ 220 x, incx, \ 221 beta, \ 222 y, incy, \ 223 z, incz, \ 224 cntx \ 225 ); \ 226 } 227 228 INSERT_GENTFUNC_BASIC( dotxaxpyf, BLIS_DOTXAXPYF_KER ) 229 230 231 #undef GENTFUNC 232 #define GENTFUNC( ctype, ch, opname, kerid ) \ 233 \ 234 void PASTEMAC2(ch,opname,EX_SUF) \ 235 ( \ 236 conj_t conjat, \ 237 conj_t conjx, \ 238 dim_t m, \ 239 dim_t b_n, \ 240 ctype* alpha, \ 241 ctype* a, inc_t inca, inc_t lda, \ 242 ctype* x, inc_t incx, \ 243 ctype* beta, \ 244 ctype* y, inc_t incy \ 245 BLIS_TAPI_EX_PARAMS \ 246 ) \ 247 { \ 248 bli_init_once(); \ 249 \ 250 BLIS_TAPI_EX_DECLS \ 251 \ 252 const num_t dt = PASTEMAC(ch,type); \ 253 \ 254 /* Obtain a valid context from the gks if necessary. */ \ 255 if ( cntx == NULL ) cntx = bli_gks_query_cntx(); \ 256 \ 257 PASTECH2(ch,opname,_ker_ft) f = bli_cntx_get_l1f_ker_dt( dt, kerid, cntx ); \ 258 \ 259 f \ 260 ( \ 261 conjat, \ 262 conjx, \ 263 m, \ 264 b_n, \ 265 alpha, \ 266 a, inca, lda, \ 267 x, incx, \ 268 beta, \ 269 y, incy, \ 270 cntx \ 271 ); \ 272 } 273 274 INSERT_GENTFUNC_BASIC( dotxf, BLIS_DOTXF_KER ) 275 276 277 #endif 278 279