Vectorization.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_SYSTEM_VECTORIZATION_H_
36 #define _BLAZE_SYSTEM_VECTORIZATION_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
45 
46 
47 
48 
49 //=================================================================================================
50 //
51 // SSE/AVX MACRO DEFINITIONS
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
57 #ifdef __AVX512F__
58 # ifndef __AVX2__
59 # define __AVX2__
60 # endif
61 #endif
62 
63 //*************************************************************************************************
64 
65 
66 //*************************************************************************************************
68 #ifdef __AVX2__
69 # ifndef __AVX__
70 # define __AVX__
71 # endif
72 #endif
73 
74 //*************************************************************************************************
75 
76 
77 //*************************************************************************************************
79 #ifdef __AVX__
80 # ifndef __MMX__
81 # define __MMX__
82 # endif
83 # ifndef __SSE__
84 # define __SSE__
85 # endif
86 # ifndef __SSE2__
87 # define __SSE2__
88 # endif
89 # ifndef __SSE3__
90 # define __SSE3__
91 # endif
92 # ifndef __SSSE3__
93 # define __SSSE3__
94 # endif
95 # ifndef __SSE4_1__
96 # define __SSE4_1__
97 # endif
98 # ifndef __SSE4_2__
99 # define __SSE4_2__
100 # endif
101 #endif
102 
103 //*************************************************************************************************
104 
105 
106 
107 
108 //=================================================================================================
109 //
110 // SSE/AVX/MIC MODE CONFIGURATION
111 //
112 //=================================================================================================
113 
114 //*************************************************************************************************
123 #if BLAZE_USE_VECTORIZATION && ( defined(__SSE__) || ( _M_IX86_FP > 0 ) )
124 # define BLAZE_SSE_MODE 1
125 #else
126 # define BLAZE_SSE_MODE 0
127 #endif
128 //*************************************************************************************************
129 
130 
131 //*************************************************************************************************
140 #if BLAZE_USE_VECTORIZATION && ( defined(__SSE2__) || ( _M_IX86_FP > 1 ) )
141 # define BLAZE_SSE2_MODE 1
142 #else
143 # define BLAZE_SSE2_MODE 0
144 #endif
145 //*************************************************************************************************
146 
147 
148 //*************************************************************************************************
157 #if BLAZE_USE_VECTORIZATION && defined(__SSE3__)
158 # define BLAZE_SSE3_MODE 1
159 #else
160 # define BLAZE_SSE3_MODE 0
161 #endif
162 //*************************************************************************************************
163 
164 
165 //*************************************************************************************************
174 #if BLAZE_USE_VECTORIZATION && defined(__SSSE3__)
175 # define BLAZE_SSSE3_MODE 1
176 #else
177 # define BLAZE_SSSE3_MODE 0
178 #endif
179 //*************************************************************************************************
180 
181 
182 //*************************************************************************************************
191 #if BLAZE_USE_VECTORIZATION && ( defined(__SSE4_2__) || defined(__SSE4_1__) )
192 # define BLAZE_SSE4_MODE 1
193 #else
194 # define BLAZE_SSE4_MODE 0
195 #endif
196 //*************************************************************************************************
197 
198 
199 //*************************************************************************************************
208 #if BLAZE_USE_VECTORIZATION && defined(__AVX__)
209 # define BLAZE_AVX_MODE 1
210 #else
211 # define BLAZE_AVX_MODE 0
212 #endif
213 //*************************************************************************************************
214 
215 
216 //*************************************************************************************************
225 #if BLAZE_USE_VECTORIZATION && defined(__AVX2__)
226 # define BLAZE_AVX2_MODE 1
227 #else
228 # define BLAZE_AVX2_MODE 0
229 #endif
230 //*************************************************************************************************
231 
232 
233 //*************************************************************************************************
243 #if BLAZE_USE_VECTORIZATION && defined(__AVX512F__)
244 # define BLAZE_AVX512F_MODE 1
245 #else
246 # define BLAZE_AVX512F_MODE 0
247 #endif
248 //*************************************************************************************************
249 
250 
251 //*************************************************************************************************
261 #if BLAZE_USE_VECTORIZATION && defined(__AVX512BW__)
262 # define BLAZE_AVX512BW_MODE 1
263 #else
264 # define BLAZE_AVX512BW_MODE 0
265 #endif
266 //*************************************************************************************************
267 
268 
269 //*************************************************************************************************
279 #if BLAZE_USE_VECTORIZATION && defined(__AVX512DQ__)
280 # define BLAZE_AVX512DQ_MODE 1
281 #else
282 # define BLAZE_AVX512DQ_MODE 0
283 #endif
284 //*************************************************************************************************
285 
286 
287 //*************************************************************************************************
296 #if BLAZE_USE_VECTORIZATION && defined(__MIC__)
297 # define BLAZE_MIC_MODE 1
298 #else
299 # define BLAZE_MIC_MODE 0
300 #endif
301 //*************************************************************************************************
302 
303 
304 
305 
306 //=================================================================================================
307 //
308 // FMA MODE CONFIGURATION
309 //
310 //=================================================================================================
311 
312 //*************************************************************************************************
321 #if BLAZE_USE_VECTORIZATION && defined(__FMA__)
322 # define BLAZE_FMA_MODE 1
323 #else
324 # define BLAZE_FMA_MODE 0
325 #endif
326 //*************************************************************************************************
327 
328 
329 
330 
331 //=================================================================================================
332 //
333 // SVML MODE CONFIGURATION
334 //
335 //=================================================================================================
336 
337 //*************************************************************************************************
346 #if BLAZE_USE_VECTORIZATION && ( defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) )
347 # define BLAZE_SVML_MODE 1
348 #else
349 # define BLAZE_SVML_MODE 0
350 #endif
351 //*************************************************************************************************
352 
353 
354 
355 
356 //=================================================================================================
357 //
358 // COMPILE TIME CONSTRAINTS
359 //
360 //=================================================================================================
361 
362 //*************************************************************************************************
364 namespace {
365 
375 
376 }
378 //*************************************************************************************************
379 
380 
381 
382 
383 //=================================================================================================
384 //
385 // SSE/AVX/MIC INCLUDE FILE CONFIGURATION
386 //
387 //=================================================================================================
388 
389 #if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE || BLAZE_AVX2_MODE || BLAZE_AVX_MODE
390 # include <immintrin.h>
391 #elif BLAZE_SSE4_MODE
392 # include <smmintrin.h>
393 #elif BLAZE_SSSE3_MODE
394 # include <tmmintrin.h>
395 #elif BLAZE_SSE3_MODE
396 # include <pmmintrin.h>
397 #elif BLAZE_SSE2_MODE
398 # include <emmintrin.h>
399 #elif BLAZE_SSE_MODE
400 # include <xmmintrin.h>
401 #endif
402 
403 #endif
#define BLAZE_AVX512F_MODE
Compilation switch for the AVX512F mode.This compilation switch enables/disables the AVX512F mode...
Definition: Vectorization.h:246
#define BLAZE_AVX512BW_MODE
Compilation switch for the AVX512BW mode.This compilation switch enables/disables the AVX512BW mode...
Definition: Vectorization.h:264
#define BLAZE_AVX2_MODE
Compilation switch for the AVX2 mode.This compilation switch enables/disables the AVX2 mode...
Definition: Vectorization.h:228
#define BLAZE_AVX512DQ_MODE
Compilation switch for the AVX512DQ mode.This compilation switch enables/disables the AVX512DQ mode...
Definition: Vectorization.h:282
#define BLAZE_SSE3_MODE
Compilation switch for the SSE3 mode.This compilation switch enables/disables the SSE3 mode...
Definition: Vectorization.h:160
#define BLAZE_SSSE3_MODE
Compilation switch for the SSSE3 mode.This compilation switch enables/disables the SSSE3 mode...
Definition: Vectorization.h:177
Compile time assertion.
#define BLAZE_SSE_MODE
Compilation switch for the SSE mode.This compilation switch enables/disables the SSE mode...
Definition: Vectorization.h:126
#define BLAZE_SSE4_MODE
Compilation switch for the SSE4 mode.This compilation switch enables/disables the SSE4 mode...
Definition: Vectorization.h:194
#define BLAZE_AVX_MODE
Compilation switch for the AVX mode.This compilation switch enables/disables the AVX mode...
Definition: Vectorization.h:211
Configuration of the vectorization policy of the Blaze library.
#define BLAZE_SSE2_MODE
Compilation switch for the SSE2 mode.This compilation switch enables/disables the SSE2 mode...
Definition: Vectorization.h:143
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112