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 #define FUNCPTR_T dotv_fp
39 typedef void (*FUNCPTR_T)(
40 conj_t conjx,
41 conj_t conjy,
42 dim_t n,
43 void* x, inc_t incx,
44 void* y, inc_t incy,
45 void* rho
46 );
48 // If some mixed datatype functions will not be compiled, we initialize
49 // the corresponding elements of the function array to NULL.
50 #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT
51 static FUNCPTR_T GENARRAY3_ALL(ftypes,dotv_kernel_void);
52 #else
53 #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
54 static FUNCPTR_T GENARRAY3_EXT(ftypes,dotv_kernel_void);
55 #else
56 static FUNCPTR_T GENARRAY3_MIN(ftypes,dotv_kernel_void);
57 #endif
58 #endif
61 void bli_dotv_kernel( obj_t* x,
62 obj_t* y,
63 obj_t* rho )
64 {
65 num_t dt_x = bli_obj_datatype( *x );
66 num_t dt_y = bli_obj_datatype( *y );
67 num_t dt_rho = bli_obj_datatype( *rho );
69 conj_t conjx = bli_obj_conj_status( *x );
70 conj_t conjy = bli_obj_conj_status( *y );
71 dim_t n = bli_obj_vector_dim( *x );
73 inc_t inc_x = bli_obj_vector_inc( *x );
74 void* buf_x = bli_obj_buffer_at_off( *x );
76 inc_t inc_y = bli_obj_vector_inc( *y );
77 void* buf_y = bli_obj_buffer_at_off( *y );
79 void* buf_rho = bli_obj_buffer_at_off( *rho );
81 FUNCPTR_T f;
83 // Index into the type combination array to extract the correct
84 // function pointer.
85 f = ftypes[dt_x][dt_y][dt_rho];
87 // Invoke the function.
88 f( conjx,
89 conjy,
90 n,
91 buf_x, inc_x,
92 buf_y, inc_y,
93 buf_rho );
94 }
97 #undef GENTFUNC3
98 #define GENTFUNC3( ctype_x, ctype_y, ctype_r, chx, chy, chr, varname, kername ) \
99 \
100 void PASTEMAC3(chx,chy,chr,varname)( \
101 conj_t conjx, \
102 conj_t conjy, \
103 dim_t n, \
104 void* x, inc_t incx, \
105 void* y, inc_t incy, \
106 void* rho \
107 ) \
108 { \
109 PASTEMAC3(chx,chy,chr,kername)( conjx, \
110 conjy, \
111 n, \
112 x, incx, \
113 y, incy, \
114 rho ); \
115 }
117 // Define the basic set of functions unconditionally, and then also some
118 // mixed datatype functions if requested.
119 INSERT_GENTFUNC3_BASIC( dotv_kernel_void, DOTV_KERNEL )
121 #ifdef BLIS_ENABLE_MIXED_DOMAIN_SUPPORT
122 INSERT_GENTFUNC3_MIX_D( dotv_kernel_void, DOTV_KERNEL )
123 #endif
125 #ifdef BLIS_ENABLE_MIXED_PRECISION_SUPPORT
126 INSERT_GENTFUNC3_MIX_P( dotv_kernel_void, DOTV_KERNEL )
127 #endif