CHROMA
qphix_vec_traits.h
Go to the documentation of this file.
1 #ifndef QPHIX_VEC_TRAITS_H
2 #define QPHIX_VEC_TRAITS_H
3 
4 #include "chroma_config.h"
5 
6 #ifdef BUILD_QPHIX
7 namespace Chroma {
8  namespace QPhiXVecTraits {
9 
10  template<typename T>
11  struct VecTraits {
12  static const int Vec=1;
13  static const int Soa=1;
14  static const bool compress12=false;
15  };
16 
17  template<typename TOuter,typename TInner>
18  struct MixedVecTraits {
19  static const int Vec=1;
20  static const int Soa=1;
21  static const bool compress12=false;
22  static const int VecInner=1;
23  static const int SoaInner=1;
24 
25  };
26 
27 #if defined(CHROMA_QPHIX_ARCH_SSE)
28 #warning QPHIX for SSE
29  // AVX Traits:
30  template<>
31  struct VecTraits<float> {
32  static const int Vec=4;
33  static const int Soa=CHROMA_QPHIX_SOALEN;
34  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
35  };
36 
37  template<>
38  struct VecTraits<double> {
39  static const int Vec=2;
40  static const int Soa=CHROMA_QPHIX_SOALEN;
41  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
42 
43  };
44 
45  // SSE Traits:
46  template<>
47  struct MixedVecTraits<double,double> {
48  static const int Vec=2;
49  static const int Soa=CHROMA_QPHIX_SOALEN;
50  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
51  static const int VecInner=2;
52  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
53  };
54 
55  template<>
56  struct MixedVecTraits<double,float> {
57  static const int Vec=2;
58  static const int Soa=CHROMA_QPHIX_SOALEN;
59  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
60  static const int VecInner=4;
61  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
62  };
63 
64  template<>
65  struct MixedVecTraits<float,float> {
66  static const int Vec=4;
67  static const int Soa=CHROMA_QPHIX_SOALEN;
68  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
69  static const int VecInner=4;
70  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
71  };
72 
73 #endif
74 
75  // Templates
76 #if defined(CHROMA_QPHIX_ARCH_AVX) || defined(CHROMA_QPHIX_ARCH_AVX2)
77 #warning QPHIX for AVX and AVX2
78  // AVX Traits:
79  template<>
80  struct VecTraits<float> {
81  static const int Vec=8;
82  static const int Soa=CHROMA_QPHIX_SOALEN;
83  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
84  };
85 
86  template<>
87  struct VecTraits<double> {
88  static const int Vec=4;
89  static const int Soa=CHROMA_QPHIX_SOALEN;
90  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
91 
92  };
93 
94  // AVX Traits:
95  template<>
96  struct MixedVecTraits<double,double> {
97  static const int Vec=4;
98  static const int Soa=CHROMA_QPHIX_SOALEN;
99  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
100  static const int VecInner=4;
101  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
102  };
103 
104  template<>
105  struct MixedVecTraits<double,float> {
106  static const int Vec=4;
107  static const int Soa=CHROMA_QPHIX_SOALEN;
108  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
109  static const int VecInner=8;
110  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
111  };
112 
113  template<>
114  struct MixedVecTraits<float,float> {
115  static const int Vec=8;
116  static const int Soa=CHROMA_QPHIX_SOALEN;
117  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
118  static const int VecInner=8;
119  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
120  };
121 
122 
123 #endif
124 
125 #if defined(CHROMA_QPHIX_ARCH_MIC) || defined(CHROMA_QPHIX_ARCH_AVX512)
126 #warning QPhiX for MIC or AVX512
127  // MIC Traits
128  template<>
129  struct VecTraits<float> {
130  static const int Vec=16;
131  static const int Soa=CHROMA_QPHIX_SOALEN;
132  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
133  };
134 
135  template<>
136  struct VecTraits<double> {
137  static const int Vec=8;
138  static const int Soa=CHROMA_QPHIX_SOALEN;
139  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
140  };
141 
142  // MIC Traits
143  template<>
144  struct MixedVecTraits<double,double> {
145  static const int Vec=8;
146  static const int Soa=CHROMA_QPHIX_SOALEN;
147  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
148  static const int VecInner=8;
149  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
150 
151  };
152  template<>
153  struct MixedVecTraits<double,float> {
154  static const int Vec=8;
155  static const int Soa=CHROMA_QPHIX_SOALEN;
156  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
157  static const int VecInner=16;
158  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
159  };
160  template<>
161  struct MixedVecTraits<double,QPhiX::half> {
162  static const int Vec=8;
163  static const int Soa=CHROMA_QPHIX_SOALEN;
164  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
165  static const int VecInner=16;
166  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
167  };
168  template<>
169  struct MixedVecTraits<float,float> {
170  static const int Vec=16;
171  static const int Soa=CHROMA_QPHIX_SOALEN;
172  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
173  static const int VecInner=16;
174  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
175 
176  };
177  template<>
178  struct MixedVecTraits<float,QPhiX::half> {
179  static const int Vec=16;
180  static const int Soa=CHROMA_QPHIX_SOALEN;
181  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
182  static const int VecInner=16;
183  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
184  };
185 
186 #endif
187 
188 #if defined CHROMA_QPHIX_ARCH_QPX
189 #warning QPhiX for QPX
190  // QPX Traits
191  template<>
192  struct VecTraits<double> {
193  static const int Vec=4;
194  static const int Soa=CHROMA_QPHIX_SOALEN;
195  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
196  };
197 
198  template<>
199  struct MixedVecTraits<double,double> {
200  static const int Vec=4;
201  static const int Soa=CHROMA_QPHIX_SOALEN;
202  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
203  static const int VecInner=4;
204  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
205 
206  };
207  template<>
208  struct MixedVecTraits<double,float> {
209  static const int Vec=4;
210  static const int Soa=CHROMA_QPHIX_SOALEN;
211  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
212  static const int VecInner=4;
213  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
214 
215  };
216 
217  template<>
218  struct MixedVecTraits<float,float> {
219  static const int Vec=4;
220  static const int Soa=CHROMA_QPHIX_SOALEN;
221  static const bool compress12=CHROMA_QPHIX_COMPRESS12;
222  static const int VecInner=4;
223  static const int SoaInner=CHROMA_QPHIX_INNER_SOALEN;
224 
225  };
226 
227 #endif
228 
229 
230  }; // namespace QPhiXVecTraits
231 }; // namespace Chroma
232 
233 
234 #endif // BUILD_QPHIX
235 
236 
237 #endif
238 
239 
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10