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 #undef FUNCPTR_T
38 #define FUNCPTR_T trsm_ukr_fp
40 typedef void (*FUNCPTR_T)(
41 void* a,
42 void* b,
43 void* c, inc_t rs_c, inc_t cs_c,
44 auxinfo_t* data
45 );
47 static FUNCPTR_T GENARRAY(ftypes_l,trsm_l_ukernel_void);
48 static FUNCPTR_T GENARRAY(ftypes_u,trsm_u_ukernel_void);
51 void bli_trsm_ukernel( obj_t* a,
52 obj_t* b,
53 obj_t* c )
54 {
55 num_t dt = bli_obj_datatype( *c );
57 void* buf_a = bli_obj_buffer_at_off( *a );
59 void* buf_b = bli_obj_buffer_at_off( *b );
61 void* buf_c = bli_obj_buffer_at_off( *c );
62 inc_t rs_c = bli_obj_row_stride( *c );
63 inc_t cs_c = bli_obj_col_stride( *c );
65 FUNCPTR_T f;
67 auxinfo_t data;
70 // Fill the auxinfo_t struct in case the micro-kernel uses it.
71 bli_auxinfo_set_next_a( buf_a, data );
72 bli_auxinfo_set_next_b( buf_b, data );
74 // Index into the type combination array to extract the correct
75 // function pointer.
76 if ( bli_obj_is_lower( *a ) ) f = ftypes_l[dt];
77 else f = ftypes_u[dt];
79 // Invoke the function.
80 f( buf_a,
81 buf_b,
82 buf_c, rs_c, cs_c,
83 &data );
84 }
87 #undef GENTFUNC
88 #define GENTFUNC( ctype, ch, varname, ukrname ) \
89 \
90 void PASTEMAC(ch,varname)( \
91 void* a, \
92 void* b, \
93 void* c, inc_t rs_c, inc_t cs_c, \
94 auxinfo_t* data \
95 ) \
96 { \
97 PASTEMAC(ch,ukrname)( a, \
98 b, \
99 c, rs_c, cs_c, \
100 data ); \
101 }
103 INSERT_GENTFUNC_BASIC( trsm_l_ukernel_void, TRSM_L_UKERNEL )
104 INSERT_GENTFUNC_BASIC( trsm_u_ukernel_void, TRSM_U_UKERNEL )