]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/blob - blis/config/pnacl/bli_kernel.h
Consolidate all git repos of linalg into one.
[dense-linear-algebra-libraries/linalg.git] / blis / config / pnacl / bli_kernel.h
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 #ifndef BLIS_KERNEL_H
36 #define BLIS_KERNEL_H
38 /*
39  * SIMD-enabled (SP only) PNaCl shipped in Chrome 36 and it is not backward-compatible.
40  * Therefore, if compilation targets an older Chrome release, we use scalar kernels.
41  * The target Chrome version is indicated by PPAPI_MACRO defined in the header below.
42  */
43 #include <ppapi/c/pp_macros.h>
45 // -- LEVEL-3 MICRO-KERNEL CONSTANTS -------------------------------------------
47 // -- Cache blocksizes --
49 //
50 // Constraints:
51 //
52 // (1) MC must be a multiple of:
53 //     (a) MR (for zero-padding purposes)
54 //     (b) NR (for zero-padding purposes when MR and NR are "swapped")
55 // (2) NC must be a multiple of
56 //     (a) NR (for zero-padding purposes)
57 //     (b) MR (for zero-padding purposes when MR and NR are "swapped")
58 // (3) KC must be a multiple of
59 //     (a) MR and
60 //     (b) NR (for triangular operations such as trmm and trsm).
61 //
63 #if PPAPI_RELEASE >= 36
64 #define BLIS_DEFAULT_MC_S              256
65 #define BLIS_DEFAULT_KC_S              256
66 #define BLIS_DEFAULT_NC_S              8192
67 #else
68 #define BLIS_DEFAULT_MC_S              252
69 #define BLIS_DEFAULT_KC_S              264
70 #define BLIS_DEFAULT_NC_S              8196
71 #endif
73 #define BLIS_DEFAULT_MC_D              1080
74 #define BLIS_DEFAULT_KC_D              120
75 #define BLIS_DEFAULT_NC_D              8400
77 #if PPAPI_RELEASE >= 36
78 #define BLIS_DEFAULT_MC_C              128
79 #define BLIS_DEFAULT_KC_C              256
80 #define BLIS_DEFAULT_NC_C              4096
81 #else
82 #define BLIS_DEFAULT_MC_C              120
83 #define BLIS_DEFAULT_KC_C              264
84 #define BLIS_DEFAULT_NC_C              4092
85 #endif
87 #define BLIS_DEFAULT_MC_Z              60
88 #define BLIS_DEFAULT_KC_Z              264
89 #define BLIS_DEFAULT_NC_Z              2040
91 // -- Register blocksizes --
93 #if PPAPI_RELEASE >= 36
94 #define BLIS_DEFAULT_MR_S              8
95 #define BLIS_DEFAULT_NR_S              4
96 #else
97 #define BLIS_DEFAULT_MR_S              4
98 #define BLIS_DEFAULT_NR_S              3 
99 #endif
101 #define BLIS_DEFAULT_MR_D              4
102 #define BLIS_DEFAULT_NR_D              3
104 #if PPAPI_RELEASE >= 36
105 #define BLIS_DEFAULT_MR_C              4
106 #define BLIS_DEFAULT_NR_C              4
107 #else
108 #define BLIS_DEFAULT_MR_C              2
109 #define BLIS_DEFAULT_NR_C              3
110 #endif
112 #define BLIS_DEFAULT_MR_Z              2
113 #define BLIS_DEFAULT_NR_Z              3
115 // NOTE: If the micro-kernel, which is typically unrolled to a factor
116 // of f, handles leftover edge cases (ie: when k % f > 0) then these
117 // register blocksizes in the k dimension can be defined to 1.
119 //#define BLIS_DEFAULT_KR_S              1
120 //#define BLIS_DEFAULT_KR_D              1
121 //#define BLIS_DEFAULT_KR_C              1
122 //#define BLIS_DEFAULT_KR_Z              1
124 // -- Maximum cache blocksizes (for optimizing edge cases) --
126 // NOTE: These cache blocksize "extensions" have the same constraints as
127 // the corresponding default blocksizes above. When these values are
128 // larger than the default blocksizes, blocksizes used at edge cases are
129 // enlarged if such an extension would encompass the remaining portion of
130 // the matrix dimension.
132 //#define BLIS_MAXIMUM_MC_S              (BLIS_DEFAULT_MC_S + BLIS_DEFAULT_MC_S/4)
133 //#define BLIS_MAXIMUM_KC_S              (BLIS_DEFAULT_KC_S + BLIS_DEFAULT_KC_S/4)
134 //#define BLIS_MAXIMUM_NC_S              (BLIS_DEFAULT_NC_S + BLIS_DEFAULT_NC_S/4)
136 //#define BLIS_MAXIMUM_MC_D              (BLIS_DEFAULT_MC_D + BLIS_DEFAULT_MC_D/4)
137 //#define BLIS_MAXIMUM_KC_D              (BLIS_DEFAULT_KC_D + BLIS_DEFAULT_KC_D/4)
138 //#define BLIS_MAXIMUM_NC_D              (BLIS_DEFAULT_NC_D + BLIS_DEFAULT_NC_D/4)
140 //#define BLIS_MAXIMUM_MC_C              (BLIS_DEFAULT_MC_C + BLIS_DEFAULT_MC_C/4)
141 //#define BLIS_MAXIMUM_KC_C              (BLIS_DEFAULT_KC_C + BLIS_DEFAULT_KC_C/4)
142 //#define BLIS_MAXIMUM_NC_C              (BLIS_DEFAULT_NC_C + BLIS_DEFAULT_NC_C/4)
144 //#define BLIS_MAXIMUM_MC_Z              (BLIS_DEFAULT_MC_Z + BLIS_DEFAULT_MC_Z/4)
145 //#define BLIS_MAXIMUM_KC_Z              (BLIS_DEFAULT_KC_Z + BLIS_DEFAULT_KC_Z/4)
146 //#define BLIS_MAXIMUM_NC_Z              (BLIS_DEFAULT_NC_Z + BLIS_DEFAULT_NC_Z/4)
148 // -- Packing register blocksize (for packed micro-panels) --
150 // NOTE: These register blocksize "extensions" determine whether the
151 // leading dimensions used within the packed micro-panels are equal to
152 // or greater than their corresponding register blocksizes above.
154 //#define BLIS_PACKDIM_MR_S              (BLIS_DEFAULT_MR_S + ...)
155 //#define BLIS_PACKDIM_NR_S              (BLIS_DEFAULT_NR_S + ...)
157 //#define BLIS_PACKDIM_MR_D              (BLIS_DEFAULT_MR_D + ...)
158 //#define BLIS_PACKDIM_NR_D              (BLIS_DEFAULT_NR_D + ...)
160 //#define BLIS_PACKDIM_MR_C              (BLIS_DEFAULT_MR_C + ...)
161 //#define BLIS_PACKDIM_NR_C              (BLIS_DEFAULT_NR_C + ...)
163 //#define BLIS_PACKDIM_MR_Z              (BLIS_DEFAULT_MR_Z + ...)
164 //#define BLIS_PACKDIM_NR_Z              (BLIS_DEFAULT_NR_Z + ...)
168 // -- LEVEL-2 KERNEL CONSTANTS -------------------------------------------------
173 // -- LEVEL-1F KERNEL CONSTANTS ------------------------------------------------
178 // -- LEVEL-3 KERNEL DEFINITIONS -----------------------------------------------
180 // -- gemm --
182 #if PPAPI_RELEASE >= 36
183 #define BLIS_SGEMM_UKERNEL         bli_sgemm_opt
184 #define BLIS_CGEMM_UKERNEL         bli_cgemm_opt
185 #endif
187 // -- trsm-related --
192 // -- LEVEL-1M KERNEL DEFINITIONS ----------------------------------------------
194 // -- packm --
196 // -- unpackm --
201 // -- LEVEL-1F KERNEL DEFINITIONS ----------------------------------------------
203 // -- axpy2v --
205 // -- dotaxpyv --
207 // -- axpyf --
209 // -- dotxf --
211 // -- dotxaxpyf --
216 // -- LEVEL-1V KERNEL DEFINITIONS ----------------------------------------------
218 // -- addv --
220 // -- axpyv --
221 #if PPAPI_RELEASE >= 36
222 #define BLIS_SAXPYV_KERNEL         bli_saxpyv_opt
223 #define BLIS_CAXPYV_KERNEL         bli_caxpyv_opt
224 #endif
226 // -- copyv --
228 // -- dotv --
229 #define BLIS_SDOTV_KERNEL          bli_sdotv_opt
230 #define BLIS_DDOTV_KERNEL          bli_ddotv_opt
231 #define BLIS_CDOTV_KERNEL          bli_cdotv_opt
232 #define BLIS_ZDOTV_KERNEL          bli_zdotv_opt
234 // -- dotxv --
236 // -- invertv --
238 // -- scal2v --
240 // -- scalv --
242 // -- setv --
244 // -- subv --
246 // -- swapv --
250 #endif