C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 5

daal_kernel_defines.h
Go to the documentation of this file.
1 /* file: daal_kernel_defines.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Common definitions.
19 //--
20 */
21 
22 #ifndef __DAAL_KERNEL_DEFINES_H__
23 #define __DAAL_KERNEL_DEFINES_H__
24 
30 #define DAAL_KERNEL_SSSE3
31 #define DAAL_KERNEL_SSE42
32 #define DAAL_KERNEL_AVX
33 #define DAAL_KERNEL_AVX2
34 #define DAAL_KERNEL_AVX512_MIC
35 #define DAAL_KERNEL_AVX512
36 
37 #define DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, cpuType, ...) ContainerTemplate<__VA_ARGS__, cpuType>
38 #define DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, cpuType,...)\
39  case cpuType: _cntr = (new DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, cpuType, __VA_ARGS__)(daalEnv)); break;
40 
41 #if defined(DAAL_KERNEL_SSSE3)
42  #define DAAL_KERNEL_SSSE3_ONLY(something) , something
43  #define DAAL_KERNEL_SSSE3_ONLY_CODE(...) __VA_ARGS__
44  #define DAAL_KERNEL_SSSE3_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, ssse3, __VA_ARGS__)
45  #define DAAL_KERNEL_SSSE3_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, ssse3, __VA_ARGS__)
46 #else
47  #define DAAL_KERNEL_SSSE3_ONLY(something)
48  #define DAAL_KERNEL_SSSE3_ONLY_CODE(...)
49  #define DAAL_KERNEL_SSSE3_CONTAINER(ContainerTemplate, ...)
50  #define DAAL_KERNEL_SSSE3_CONTAINER_CASE(ContainerTemplate, ...)
51 #endif
52 
53 #if defined(DAAL_KERNEL_SSE42)
54  #define DAAL_KERNEL_SSE42_ONLY(something) , something
55  #define DAAL_KERNEL_SSE42_ONLY_CODE(...) __VA_ARGS__
56  #define DAAL_KERNEL_SSE42_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, sse42, __VA_ARGS__)
57  #define DAAL_KERNEL_SSE42_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, sse42, __VA_ARGS__)
58 #else
59  #define DAAL_KERNEL_SSE42_ONLY(something)
60  #define DAAL_KERNEL_SSE42_ONLY_CODE(...)
61  #define DAAL_KERNEL_SSE42_CONTAINER(ContainerTemplate, ...)
62  #define DAAL_KERNEL_SSE42_CONTAINER_CASE(ContainerTemplate, ...)
63 #endif
64 
65 #if defined(DAAL_KERNEL_AVX)
66  #define DAAL_KERNEL_AVX_ONLY(something) , something
67  #define DAAL_KERNEL_AVX_ONLY_CODE(...) __VA_ARGS__
68  #define DAAL_KERNEL_AVX_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx, __VA_ARGS__)
69  #define DAAL_KERNEL_AVX_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx, __VA_ARGS__)
70 #else
71  #define DAAL_KERNEL_AVX_ONLY(something)
72  #define DAAL_KERNEL_AVX_ONLY_CODE(...)
73  #define DAAL_KERNEL_AVX_CONTAINER(ContainerTemplate, ...)
74  #define DAAL_KERNEL_AVX_CONTAINER_CASE(ContainerTemplate, ...)
75 #endif
76 
77 #if defined(DAAL_KERNEL_AVX2)
78  #define DAAL_KERNEL_AVX2_ONLY(something) , something
79  #define DAAL_KERNEL_AVX2_ONLY_CODE(...) __VA_ARGS__
80  #define DAAL_KERNEL_AVX2_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx2, __VA_ARGS__)
81  #define DAAL_KERNEL_AVX2_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx2, __VA_ARGS__)
82 #else
83  #define DAAL_KERNEL_AVX2_ONLY(something)
84  #define DAAL_KERNEL_AVX2_ONLY_CODE(...)
85  #define DAAL_KERNEL_AVX2_CONTAINER(ContainerTemplate, ...)
86  #define DAAL_KERNEL_AVX2_CONTAINER_CASE(ContainerTemplate, ...)
87 #endif
88 
89 #if defined(DAAL_KERNEL_AVX512_MIC)
90  #define DAAL_KERNEL_AVX512_MIC_ONLY(something) , something
91  #define DAAL_KERNEL_AVX512_MIC_ONLY_CODE(...) __VA_ARGS__
92  #define DAAL_KERNEL_AVX512_MIC_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx512_mic, __VA_ARGS__)
93  #define DAAL_KERNEL_AVX512_MIC_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx512_mic, __VA_ARGS__)
94 #else
95  #define DAAL_KERNEL_AVX512_MIC_ONLY(something)
96  #define DAAL_KERNEL_AVX512_MIC_ONLY_CODE(...)
97  #define DAAL_KERNEL_AVX512_MIC_CONTAINER(ContainerTemplate, ...)
98  #define DAAL_KERNEL_AVX512_MIC_CONTAINER_CASE(ContainerTemplate, ...)
99 #endif
100 
101 #if defined(DAAL_KERNEL_AVX512)
102  #define DAAL_KERNEL_AVX512_ONLY(something) , something
103  #define DAAL_KERNEL_AVX512_ONLY_CODE(...) __VA_ARGS__
104  #define DAAL_KERNEL_AVX512_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx512, __VA_ARGS__)
105  #define DAAL_KERNEL_AVX512_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx512, __VA_ARGS__)
106 #else
107  #define DAAL_KERNEL_AVX512_ONLY(something)
108  #define DAAL_KERNEL_AVX512_ONLY_CODE(...)
109  #define DAAL_KERNEL_AVX512_CONTAINER(ContainerTemplate, ...)
110  #define DAAL_KERNEL_AVX512_CONTAINER_CASE(ContainerTemplate, ...)
111 #endif
112 
114 #endif

For more complete information about compiler optimizations, see our Optimization Notice.