Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
system
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
43
#include <
blaze/config/Vectorization.h
>
44
#include <
blaze/util/StaticAssert.h
>
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
63
//*************************************************************************************************
64
65
66
//*************************************************************************************************
68
#ifdef __AVX2__
69
# ifndef __AVX__
70
# define __AVX__
71
# endif
72
#endif
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
103
//*************************************************************************************************
104
105
106
107
108
//=================================================================================================
109
//
110
// SSE/AVX/MIC MODE CONFIGURATION
111
//
112
//=================================================================================================
113
114
//*************************************************************************************************
123
#if BLAZE_USE_VECTORIZATION && ( defined(__SSE__) || defined(_M_AMD64) || defined(_M_X64) || ( _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__) || defined(_M_AMD64) || defined(_M_X64) || ( _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
//*************************************************************************************************
363
#if BLAZE_USE_VECTORIZATION && BLAZE_USE_SLEEF
364
# define BLAZE_SLEEF_MODE 1
365
#else
366
# define BLAZE_SLEEF_MODE 0
367
#endif
368
//*************************************************************************************************
369
370
371
//*************************************************************************************************
380
#if BLAZE_USE_VECTORIZATION && BLAZE_USE_XSIMD
381
# define BLAZE_XSIMD_MODE 1
382
#else
383
# define BLAZE_XSIMD_MODE 0
384
#endif
385
//*************************************************************************************************
386
387
388
//=================================================================================================
389
//
390
// COMPILE TIME CONSTRAINTS
391
//
392
//=================================================================================================
393
394
//*************************************************************************************************
396
namespace
{
397
398
BLAZE_STATIC_ASSERT
( !
BLAZE_SSE2_MODE
||
BLAZE_SSE_MODE
);
399
BLAZE_STATIC_ASSERT
( !
BLAZE_SSE3_MODE
||
BLAZE_SSE2_MODE
);
400
BLAZE_STATIC_ASSERT
( !
BLAZE_SSSE3_MODE
||
BLAZE_SSE3_MODE
);
401
BLAZE_STATIC_ASSERT
( !
BLAZE_SSE4_MODE
||
BLAZE_SSSE3_MODE
);
402
BLAZE_STATIC_ASSERT
( !
BLAZE_AVX_MODE
||
BLAZE_SSE4_MODE
);
403
BLAZE_STATIC_ASSERT
( !
BLAZE_AVX2_MODE
||
BLAZE_AVX_MODE
);
404
BLAZE_STATIC_ASSERT
( !
BLAZE_AVX512F_MODE
||
BLAZE_AVX2_MODE
);
405
BLAZE_STATIC_ASSERT
( !
BLAZE_AVX512BW_MODE
||
BLAZE_AVX512F_MODE
);
406
BLAZE_STATIC_ASSERT
( !
BLAZE_AVX512DQ_MODE
||
BLAZE_AVX512F_MODE
);
407
408
}
410
//*************************************************************************************************
411
412
413
414
415
//=================================================================================================
416
//
417
// SSE/AVX/MIC INCLUDE FILE CONFIGURATION
418
//
419
//=================================================================================================
420
421
#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE || BLAZE_AVX2_MODE || BLAZE_AVX_MODE
422
# include <immintrin.h>
423
#elif BLAZE_SSE4_MODE
424
# include <smmintrin.h>
425
#elif BLAZE_SSSE3_MODE
426
# include <tmmintrin.h>
427
#elif BLAZE_SSE3_MODE
428
# include <pmmintrin.h>
429
#elif BLAZE_SSE2_MODE
430
# include <emmintrin.h>
431
#elif BLAZE_SSE_MODE
432
# include <xmmintrin.h>
433
#endif
434
435
#if BLAZE_XSIMD_MODE
436
# include <xsimd/xsimd.hpp>
437
#endif
438
439
#endif
StaticAssert.h
Compile time assertion.
Vectorization.h
Configuration of the vectorization policy of the Blaze library.
BLAZE_STATIC_ASSERT
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition
StaticAssert.h:112
BLAZE_AVX_MODE
#define BLAZE_AVX_MODE
Compilation switch for the AVX mode.
Definition
Vectorization.h:211
BLAZE_AVX512F_MODE
#define BLAZE_AVX512F_MODE
Compilation switch for the AVX512F mode.
Definition
Vectorization.h:246
BLAZE_SSE4_MODE
#define BLAZE_SSE4_MODE
Compilation switch for the SSE4 mode.
Definition
Vectorization.h:194
BLAZE_AVX512BW_MODE
#define BLAZE_AVX512BW_MODE
Compilation switch for the AVX512BW mode.
Definition
Vectorization.h:264
BLAZE_AVX2_MODE
#define BLAZE_AVX2_MODE
Compilation switch for the AVX2 mode.
Definition
Vectorization.h:228
BLAZE_SSE_MODE
#define BLAZE_SSE_MODE
Compilation switch for the SSE mode.
Definition
Vectorization.h:126
BLAZE_SSSE3_MODE
#define BLAZE_SSSE3_MODE
Compilation switch for the SSSE3 mode.
Definition
Vectorization.h:177
BLAZE_SSE3_MODE
#define BLAZE_SSE3_MODE
Compilation switch for the SSE3 mode.
Definition
Vectorization.h:160
BLAZE_AVX512DQ_MODE
#define BLAZE_AVX512DQ_MODE
Compilation switch for the AVX512DQ mode.
Definition
Vectorization.h:282
BLAZE_SSE2_MODE
#define BLAZE_SSE2_MODE
Compilation switch for the SSE2 mode.
Definition
Vectorization.h:143
Generated by
1.18.0