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"
37 //
38 // Define object-based interface.
39 //
40 void bli_her2k( obj_t* alpha,
41 obj_t* a,
42 obj_t* b,
43 obj_t* beta,
44 obj_t* c )
45 {
46 num_t dt = bli_obj_datatype( *c );
48 if ( bli_3mh_is_enabled_dt( dt ) ) bli_her2k3mh_entry( alpha, a, b, beta, c );
49 else if ( bli_3m_is_enabled_dt( dt ) ) bli_her2k3m_entry( alpha, a, b, beta, c );
50 else if ( bli_4mh_is_enabled_dt( dt ) ) bli_her2k4mh_entry( alpha, a, b, beta, c );
51 else if ( bli_4m_is_enabled_dt( dt ) ) bli_her2k4m_entry( alpha, a, b, beta, c );
52 else bli_her2k_entry( alpha, a, b, beta, c );
53 }
56 //
57 // Define BLAS-like interfaces with homogeneous-typed operands.
58 //
59 #undef GENTFUNCR
60 #define GENTFUNCR( ctype, ctype_r, ch, chr, opname, varname ) \
61 \
62 void PASTEMAC(ch,opname)( \
63 uplo_t uploc, \
64 trans_t transa, \
65 trans_t transb, \
66 dim_t m, \
67 dim_t k, \
68 ctype* alpha, \
69 ctype* a, inc_t rs_a, inc_t cs_a, \
70 ctype* b, inc_t rs_b, inc_t cs_b, \
71 ctype_r* beta, \
72 ctype* c, inc_t rs_c, inc_t cs_c \
73 ) \
74 { \
75 const num_t dt_r = PASTEMAC(chr,type); \
76 const num_t dt = PASTEMAC(ch,type); \
77 \
78 obj_t alphao, ao, bo, betao, co; \
79 \
80 dim_t m_a, n_a; \
81 dim_t m_b, n_b; \
82 \
83 bli_set_dims_with_trans( transa, m, k, m_a, n_a ); \
84 bli_set_dims_with_trans( transb, m, k, m_b, n_b ); \
85 \
86 bli_obj_create_1x1_with_attached_buffer( dt, alpha, &alphao ); \
87 bli_obj_create_1x1_with_attached_buffer( dt_r, beta, &betao ); \
88 \
89 bli_obj_create_with_attached_buffer( dt, m_a, n_a, a, rs_a, cs_a, &ao ); \
90 bli_obj_create_with_attached_buffer( dt, m_b, n_b, b, rs_b, cs_b, &bo ); \
91 bli_obj_create_with_attached_buffer( dt, m, m, c, rs_c, cs_c, &co ); \
92 \
93 bli_obj_set_uplo( uploc, co ); \
94 bli_obj_set_conjtrans( transa, ao ); \
95 bli_obj_set_conjtrans( transb, bo ); \
96 \
97 bli_obj_set_struc( BLIS_HERMITIAN, co ); \
98 \
99 PASTEMAC0(opname)( &alphao, \
100 &ao, \
101 &bo, \
102 &betao, \
103 &co ); \
104 }
106 INSERT_GENTFUNCR_BASIC( her2k, her2k )
109 //
110 // Define BLAS-like interfaces with heterogeneous-typed operands.
111 //
112 #undef GENTFUNC3U12
113 #define GENTFUNC3U12( ctype_a, ctype_b, ctype_c, ctype_ab, cha, chb, chc, chab, opname, varname ) \
114 \
115 void PASTEMAC3(cha,chb,chc,opname)( \
116 uplo_t uploc, \
117 trans_t transa, \
118 trans_t transb, \
119 dim_t m, \
120 dim_t k, \
121 ctype_ab* alpha, \
122 ctype_a* a, inc_t rs_a, inc_t cs_a, \
123 ctype_b* b, inc_t rs_b, inc_t cs_b, \
124 ctype_c* beta, \
125 ctype_c* c, inc_t rs_c, inc_t cs_c \
126 ) \
127 { \
128 bli_check_error_code( BLIS_NOT_YET_IMPLEMENTED ); \
129 }
131 INSERT_GENTFUNC3U12_BASIC( her2k, her2k )
133 #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
134 INSERT_GENTFUNC3U12_MIX_D( her2k, her2k )
135 #endif
137 #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT
138 INSERT_GENTFUNC3U12_MIX_P( her2k, her2k )
139 #endif