1 /*
3 BLIS
4 An object-based framework for developing high-performance BLAS-like
5 libraries.
7 Copyright (C) 2014, The University of Texas at Austin
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 of The University of Texas at Austin nor the names
18 of its contributors may be used to endorse or promote products
19 derived from this software without specific prior written permission.
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.
33 */
35 #include "blis.h"
38 //
39 // Define BLAS-to-BLIS interfaces.
40 //
41 #undef GENTFUNC
42 #define GENTFUNC( ftype, ch, blasname, blisname ) \
43 \
44 void PASTEF77(ch,blasname)( \
45 f77_char* side, \
46 f77_char* uploa, \
47 f77_int* m, \
48 f77_int* n, \
49 ftype* alpha, \
50 ftype* a, f77_int* lda, \
51 ftype* b, f77_int* ldb, \
52 ftype* beta, \
53 ftype* c, f77_int* ldc \
54 ) \
55 { \
56 side_t blis_side; \
57 uplo_t blis_uploa; \
58 dim_t m0, n0; \
59 inc_t rs_a, cs_a; \
60 inc_t rs_b, cs_b; \
61 inc_t rs_c, cs_c; \
62 err_t init_result; \
63 \
64 /* Initialize BLIS (if it is not already initialized). */ \
65 bli_init_auto( &init_result ); \
66 \
67 /* Perform BLAS parameter checking. */ \
68 PASTEBLACHK(blasname)( MKSTR(ch), \
69 MKSTR(blasname), \
70 side, \
71 uploa, \
72 m, \
73 n, \
74 lda, \
75 ldb, \
76 ldc ); \
77 \
78 /* Map BLAS chars to their corresponding BLIS enumerated type value. */ \
79 bli_param_map_netlib_to_blis_side( *side, &blis_side ); \
80 bli_param_map_netlib_to_blis_uplo( *uploa, &blis_uploa ); \
81 \
82 /* Convert/typecast negative values of m and n to zero. */ \
83 bli_convert_blas_dim1( *m, m0 ); \
84 bli_convert_blas_dim1( *n, n0 ); \
85 \
86 /* Set the row and column strides of the matrix operands. */ \
87 rs_a = 1; \
88 cs_a = *lda; \
89 rs_b = 1; \
90 cs_b = *ldb; \
91 rs_c = 1; \
92 cs_c = *ldc; \
93 \
94 /* Call BLIS interface. */ \
95 PASTEMAC(ch,blisname)( blis_side, \
96 blis_uploa, \
97 BLIS_NO_CONJUGATE, \
98 BLIS_NO_TRANSPOSE, \
99 m0, \
100 n0, \
101 alpha, \
102 a, rs_a, cs_a, \
103 b, rs_b, cs_b, \
104 beta, \
105 c, rs_c, cs_c ); \
106 \
107 /* Finalize BLIS (if it was initialized above). */ \
108 bli_finalize_auto( init_result ); \
109 }
111 #ifdef BLIS_ENABLE_BLAS2BLIS
112 INSERT_GENTFUNC_BLAS( symm, symm )
113 #endif