C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

daal_kernel_defines.h
Go to the documentation of this file.
1 /* file: daal_kernel_defines.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Common definitions.
21 //--
22 */
23 
24 #ifndef __DAAL_KERNEL_DEFINES_H__
25 #define __DAAL_KERNEL_DEFINES_H__
26 
32 #define DAAL_KERNEL_SSSE3
33 #define DAAL_KERNEL_SSE42
34 #define DAAL_KERNEL_AVX
35 #define DAAL_KERNEL_AVX2
36 #define DAAL_KERNEL_AVX512_MIC
37 #define DAAL_KERNEL_AVX512
38 
39 #define DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, cpuType, ...) ContainerTemplate<__VA_ARGS__, cpuType>
40 #define DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, cpuType,...)\
41  case cpuType: _cntr = (new DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, cpuType, __VA_ARGS__)(daalEnv)); break;
42 
43  #define DAAL_KERNEL_SSE2_ONLY(something) , something
44  #define DAAL_KERNEL_SSE2_ONLY_CODE(...) __VA_ARGS__
45  #define DAAL_KERNEL_SSE2_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, sse2, __VA_ARGS__)
46  #define DAAL_KERNEL_SSE2_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, sse2, __VA_ARGS__) ;
47  #define DAAL_KERNEL_SSE2_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, sse2, __VA_ARGS__)
48 
49 #if defined(DAAL_KERNEL_SSSE3)
50  #define DAAL_KERNEL_SSSE3_ONLY(something) , something
51  #define DAAL_KERNEL_SSSE3_ONLY_CODE(...) __VA_ARGS__
52  #define DAAL_KERNEL_SSSE3_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, ssse3, __VA_ARGS__)
53  #define DAAL_KERNEL_SSSE3_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, ssse3, __VA_ARGS__) ;
54  #define DAAL_KERNEL_SSSE3_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, ssse3, __VA_ARGS__)
55 #else
56  #define DAAL_KERNEL_SSSE3_ONLY(something)
57  #define DAAL_KERNEL_SSSE3_ONLY_CODE(...)
58  #define DAAL_KERNEL_SSSE3_CONTAINER(ContainerTemplate, ...)
59  #define DAAL_KERNEL_SSSE3_CONTAINER1(ContainerTemplate, ...)
60  #define DAAL_KERNEL_SSSE3_CONTAINER_CASE(ContainerTemplate, ...)
61 #endif
62 
63 #if defined(DAAL_KERNEL_SSE42)
64  #define DAAL_KERNEL_SSE42_ONLY(something) , something
65  #define DAAL_KERNEL_SSE42_ONLY_CODE(...) __VA_ARGS__
66  #define DAAL_KERNEL_SSE42_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, sse42, __VA_ARGS__)
67  #define DAAL_KERNEL_SSE42_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, sse42, __VA_ARGS__) ;
68  #define DAAL_KERNEL_SSE42_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, sse42, __VA_ARGS__)
69 #else
70  #define DAAL_KERNEL_SSE42_ONLY(something)
71  #define DAAL_KERNEL_SSE42_ONLY_CODE(...)
72  #define DAAL_KERNEL_SSE42_CONTAINER(ContainerTemplate, ...)
73  #define DAAL_KERNEL_SSE42_CONTAINER1(ContainerTemplate, ...)
74  #define DAAL_KERNEL_SSE42_CONTAINER_CASE(ContainerTemplate, ...)
75 #endif
76 
77 #if defined(DAAL_KERNEL_AVX)
78  #define DAAL_KERNEL_AVX_ONLY(something) , something
79  #define DAAL_KERNEL_AVX_ONLY_CODE(...) __VA_ARGS__
80  #define DAAL_KERNEL_AVX_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx, __VA_ARGS__)
81  #define DAAL_KERNEL_AVX_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx, __VA_ARGS__) ;
82  #define DAAL_KERNEL_AVX_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx, __VA_ARGS__)
83 #else
84  #define DAAL_KERNEL_AVX_ONLY(something)
85  #define DAAL_KERNEL_AVX_ONLY_CODE(...)
86  #define DAAL_KERNEL_AVX_CONTAINER(ContainerTemplate, ...)
87  #define DAAL_KERNEL_AVX_CONTAINER1(ContainerTemplate, ...)
88  #define DAAL_KERNEL_AVX_CONTAINER_CASE(ContainerTemplate, ...)
89 #endif
90 
91 #if defined(DAAL_KERNEL_AVX2)
92  #define DAAL_KERNEL_AVX2_ONLY(something) , something
93  #define DAAL_KERNEL_AVX2_ONLY_CODE(...) __VA_ARGS__
94  #define DAAL_KERNEL_AVX2_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx2, __VA_ARGS__)
95  #define DAAL_KERNEL_AVX2_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx2, __VA_ARGS__) ;
96  #define DAAL_KERNEL_AVX2_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx2, __VA_ARGS__)
97 #else
98  #define DAAL_KERNEL_AVX2_ONLY(something)
99  #define DAAL_KERNEL_AVX2_ONLY_CODE(...)
100  #define DAAL_KERNEL_AVX2_CONTAINER(ContainerTemplate, ...)
101  #define DAAL_KERNEL_AVX2_CONTAINER1(ContainerTemplate, ...)
102  #define DAAL_KERNEL_AVX2_CONTAINER_CASE(ContainerTemplate, ...)
103 #endif
104 
105 #if defined(DAAL_KERNEL_AVX512_MIC)
106  #define DAAL_KERNEL_AVX512_MIC_ONLY(something) , something
107  #define DAAL_KERNEL_AVX512_MIC_ONLY_CODE(...) __VA_ARGS__
108  #define DAAL_KERNEL_AVX512_MIC_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx512_mic, __VA_ARGS__)
109  #define DAAL_KERNEL_AVX512_MIC_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx512_mic, __VA_ARGS__) ;
110  #define DAAL_KERNEL_AVX512_MIC_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx512_mic, __VA_ARGS__)
111 #else
112  #define DAAL_KERNEL_AVX512_MIC_ONLY(something)
113  #define DAAL_KERNEL_AVX512_MIC_ONLY_CODE(...)
114  #define DAAL_KERNEL_AVX512_MIC_CONTAINER(ContainerTemplate, ...)
115  #define DAAL_KERNEL_AVX512_MIC_CONTAINER1(ContainerTemplate, ...)
116  #define DAAL_KERNEL_AVX512_MIC_CONTAINER_CASE(ContainerTemplate, ...)
117 #endif
118 
119 #if defined(DAAL_KERNEL_AVX512)
120  #define DAAL_KERNEL_AVX512_ONLY(something) , something
121  #define DAAL_KERNEL_AVX512_ONLY_CODE(...) __VA_ARGS__
122  #define DAAL_KERNEL_AVX512_CONTAINER(ContainerTemplate, ...) , DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx512, __VA_ARGS__)
123  #define DAAL_KERNEL_AVX512_CONTAINER1(ContainerTemplate, ...) extern template class DAAL_KERNEL_CONTAINER_TEMPL(ContainerTemplate, avx512, __VA_ARGS__) ;
124  #define DAAL_KERNEL_AVX512_CONTAINER_CASE(ContainerTemplate, ...) DAAL_KERNEL_CONTAINER_CASE(ContainerTemplate, avx512, __VA_ARGS__)
125 #else
126  #define DAAL_KERNEL_AVX512_ONLY(something)
127  #define DAAL_KERNEL_AVX512_ONLY_CODE(...)
128  #define DAAL_KERNEL_AVX512_CONTAINER(ContainerTemplate, ...)
129  #define DAAL_KERNEL_AVX512_CONTAINER1(ContainerTemplate, ...)
130  #define DAAL_KERNEL_AVX512_CONTAINER_CASE(ContainerTemplate, ...)
131 #endif
132 
133 #define DAAL_EXPAND(...) __VA_ARGS__
134 
136 #endif

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