70#undef HAND_STENCIL_LEG
71#undef HAND_STENCIL_LEG_INT
72#undef HAND_STENCIL_LEG_EXT
80#define LOAD_CHIMU(Ptype) \
81 {const SiteSpinor & ref (in[offset]); \
82 Chimu_00=coalescedReadPermute<Ptype>(ref()(0)(0),perm,lane); \
83 Chimu_01=coalescedReadPermute<Ptype>(ref()(0)(1),perm,lane); \
84 Chimu_02=coalescedReadPermute<Ptype>(ref()(0)(2),perm,lane); \
85 Chimu_10=coalescedReadPermute<Ptype>(ref()(1)(0),perm,lane); \
86 Chimu_11=coalescedReadPermute<Ptype>(ref()(1)(1),perm,lane); \
87 Chimu_12=coalescedReadPermute<Ptype>(ref()(1)(2),perm,lane); \
88 Chimu_20=coalescedReadPermute<Ptype>(ref()(2)(0),perm,lane); \
89 Chimu_21=coalescedReadPermute<Ptype>(ref()(2)(1),perm,lane); \
90 Chimu_22=coalescedReadPermute<Ptype>(ref()(2)(2),perm,lane); \
91 Chimu_30=coalescedReadPermute<Ptype>(ref()(3)(0),perm,lane); \
92 Chimu_31=coalescedReadPermute<Ptype>(ref()(3)(1),perm,lane); \
93 Chimu_32=coalescedReadPermute<Ptype>(ref()(3)(2),perm,lane); }
94#define PERMUTE_DIR(dir) ;
96#define LOAD_CHIMU(Ptype) \
97 {const SiteSpinor & ref (in[offset]); \
98 Chimu_00=ref()(0)(0);\
99 Chimu_01=ref()(0)(1);\
100 Chimu_02=ref()(0)(2);\
101 Chimu_10=ref()(1)(0);\
102 Chimu_11=ref()(1)(1);\
103 Chimu_12=ref()(1)(2);\
104 Chimu_20=ref()(2)(0);\
105 Chimu_21=ref()(2)(1);\
106 Chimu_22=ref()(2)(2);\
107 Chimu_30=ref()(3)(0);\
108 Chimu_31=ref()(3)(1);\
109 Chimu_32=ref()(3)(2);}
111#define PERMUTE_DIR(dir) \
112 permute##dir(Chi_00,Chi_00); \
113 permute##dir(Chi_01,Chi_01); \
114 permute##dir(Chi_02,Chi_02); \
115 permute##dir(Chi_10,Chi_10); \
116 permute##dir(Chi_11,Chi_11); \
117 permute##dir(Chi_12,Chi_12);
121#define MULT_2SPIN(A)\
122 {auto & ref(U[sU](A)); \
123 U_00=coalescedRead(ref()(0,0),lane); \
124 U_10=coalescedRead(ref()(1,0),lane); \
125 U_20=coalescedRead(ref()(2,0),lane); \
126 U_01=coalescedRead(ref()(0,1),lane); \
127 U_11=coalescedRead(ref()(1,1),lane); \
128 U_21=coalescedRead(ref()(2,1),lane); \
129 UChi_00 = U_00*Chi_00; \
130 UChi_10 = U_00*Chi_10; \
131 UChi_01 = U_10*Chi_00; \
132 UChi_11 = U_10*Chi_10; \
133 UChi_02 = U_20*Chi_00; \
134 UChi_12 = U_20*Chi_10; \
135 UChi_00+= U_01*Chi_01; \
136 UChi_10+= U_01*Chi_11; \
137 UChi_01+= U_11*Chi_01; \
138 UChi_11+= U_11*Chi_11; \
139 UChi_02+= U_21*Chi_01; \
140 UChi_12+= U_21*Chi_11; \
141 U_00=coalescedRead(ref()(0,2),lane); \
142 U_10=coalescedRead(ref()(1,2),lane); \
143 U_20=coalescedRead(ref()(2,2),lane); \
144 UChi_00+= U_00*Chi_02; \
145 UChi_10+= U_00*Chi_12; \
146 UChi_01+= U_10*Chi_02; \
147 UChi_11+= U_10*Chi_12; \
148 UChi_02+= U_20*Chi_02; \
149 UChi_12+= U_20*Chi_12;}
152 {const SiteHalfSpinor &ref(buf[offset]); \
153 Chi_00 = coalescedRead(ref()(0)(0),lane); \
154 Chi_01 = coalescedRead(ref()(0)(1),lane); \
155 Chi_02 = coalescedRead(ref()(0)(2),lane); \
156 Chi_10 = coalescedRead(ref()(1)(0),lane); \
157 Chi_11 = coalescedRead(ref()(1)(1),lane); \
158 Chi_12 = coalescedRead(ref()(1)(2),lane);}
163 Chi_00 = Chimu_00+timesI(Chimu_30);\
164 Chi_01 = Chimu_01+timesI(Chimu_31);\
165 Chi_02 = Chimu_02+timesI(Chimu_32);\
166 Chi_10 = Chimu_10+timesI(Chimu_20);\
167 Chi_11 = Chimu_11+timesI(Chimu_21);\
168 Chi_12 = Chimu_12+timesI(Chimu_22);
171 Chi_00 = Chimu_00-Chimu_30;\
172 Chi_01 = Chimu_01-Chimu_31;\
173 Chi_02 = Chimu_02-Chimu_32;\
174 Chi_10 = Chimu_10+Chimu_20;\
175 Chi_11 = Chimu_11+Chimu_21;\
176 Chi_12 = Chimu_12+Chimu_22;
179 Chi_00 = Chimu_00+timesI(Chimu_20); \
180 Chi_01 = Chimu_01+timesI(Chimu_21); \
181 Chi_02 = Chimu_02+timesI(Chimu_22); \
182 Chi_10 = Chimu_10-timesI(Chimu_30); \
183 Chi_11 = Chimu_11-timesI(Chimu_31); \
184 Chi_12 = Chimu_12-timesI(Chimu_32);
187 Chi_00 = Chimu_00+Chimu_20; \
188 Chi_01 = Chimu_01+Chimu_21; \
189 Chi_02 = Chimu_02+Chimu_22; \
190 Chi_10 = Chimu_10+Chimu_30; \
191 Chi_11 = Chimu_11+Chimu_31; \
192 Chi_12 = Chimu_12+Chimu_32;
198 Chi_00 = Chimu_00-timesI(Chimu_30);\
199 Chi_01 = Chimu_01-timesI(Chimu_31);\
200 Chi_02 = Chimu_02-timesI(Chimu_32);\
201 Chi_10 = Chimu_10-timesI(Chimu_20);\
202 Chi_11 = Chimu_11-timesI(Chimu_21);\
203 Chi_12 = Chimu_12-timesI(Chimu_22);
206 Chi_00 = Chimu_00+Chimu_30;\
207 Chi_01 = Chimu_01+Chimu_31;\
208 Chi_02 = Chimu_02+Chimu_32;\
209 Chi_10 = Chimu_10-Chimu_20;\
210 Chi_11 = Chimu_11-Chimu_21;\
211 Chi_12 = Chimu_12-Chimu_22;
214 Chi_00 = Chimu_00-timesI(Chimu_20); \
215 Chi_01 = Chimu_01-timesI(Chimu_21); \
216 Chi_02 = Chimu_02-timesI(Chimu_22); \
217 Chi_10 = Chimu_10+timesI(Chimu_30); \
218 Chi_11 = Chimu_11+timesI(Chimu_31); \
219 Chi_12 = Chimu_12+timesI(Chimu_32);
222 Chi_00 = Chimu_00-Chimu_20; \
223 Chi_01 = Chimu_01-Chimu_21; \
224 Chi_02 = Chimu_02-Chimu_22; \
225 Chi_10 = Chimu_10-Chimu_30; \
226 Chi_11 = Chimu_11-Chimu_31; \
227 Chi_12 = Chimu_12-Chimu_32;
234 result_00 = UChi_00;\
235 result_01 = UChi_01;\
236 result_02 = UChi_02;\
237 result_10 = UChi_10;\
238 result_11 = UChi_11;\
239 result_12 = UChi_12;\
240 result_20 = timesMinusI(UChi_10);\
241 result_21 = timesMinusI(UChi_11);\
242 result_22 = timesMinusI(UChi_12);\
243 result_30 = timesMinusI(UChi_00);\
244 result_31 = timesMinusI(UChi_01);\
245 result_32 = timesMinusI(UChi_02);
247#define XP_RECON_ACCUM\
254 result_20-=timesI(UChi_10);\
255 result_21-=timesI(UChi_11);\
256 result_22-=timesI(UChi_12);\
257 result_30-=timesI(UChi_00);\
258 result_31-=timesI(UChi_01);\
259 result_32-=timesI(UChi_02);
262 result_00 = UChi_00;\
263 result_01 = UChi_01;\
264 result_02 = UChi_02;\
265 result_10 = UChi_10;\
266 result_11 = UChi_11;\
267 result_12 = UChi_12;\
268 result_20 = timesI(UChi_10);\
269 result_21 = timesI(UChi_11);\
270 result_22 = timesI(UChi_12);\
271 result_30 = timesI(UChi_00);\
272 result_31 = timesI(UChi_01);\
273 result_32 = timesI(UChi_02);
275#define XM_RECON_ACCUM\
276 result_00+= UChi_00;\
277 result_01+= UChi_01;\
278 result_02+= UChi_02;\
279 result_10+= UChi_10;\
280 result_11+= UChi_11;\
281 result_12+= UChi_12;\
282 result_20+= timesI(UChi_10);\
283 result_21+= timesI(UChi_11);\
284 result_22+= timesI(UChi_12);\
285 result_30+= timesI(UChi_00);\
286 result_31+= timesI(UChi_01);\
287 result_32+= timesI(UChi_02);
289#define YP_RECON_ACCUM\
290 result_00+= UChi_00;\
291 result_01+= UChi_01;\
292 result_02+= UChi_02;\
293 result_10+= UChi_10;\
294 result_11+= UChi_11;\
295 result_12+= UChi_12;\
296 result_20+= UChi_10;\
297 result_21+= UChi_11;\
298 result_22+= UChi_12;\
299 result_30-= UChi_00;\
300 result_31-= UChi_01;\
303#define YM_RECON_ACCUM\
304 result_00+= UChi_00;\
305 result_01+= UChi_01;\
306 result_02+= UChi_02;\
307 result_10+= UChi_10;\
308 result_11+= UChi_11;\
309 result_12+= UChi_12;\
310 result_20-= UChi_10;\
311 result_21-= UChi_11;\
312 result_22-= UChi_12;\
313 result_30+= UChi_00;\
314 result_31+= UChi_01;\
317#define ZP_RECON_ACCUM\
318 result_00+= UChi_00;\
319 result_01+= UChi_01;\
320 result_02+= UChi_02;\
321 result_10+= UChi_10;\
322 result_11+= UChi_11;\
323 result_12+= UChi_12;\
324 result_20-= timesI(UChi_00); \
325 result_21-= timesI(UChi_01); \
326 result_22-= timesI(UChi_02); \
327 result_30+= timesI(UChi_10); \
328 result_31+= timesI(UChi_11); \
329 result_32+= timesI(UChi_12);
331#define ZM_RECON_ACCUM\
332 result_00+= UChi_00;\
333 result_01+= UChi_01;\
334 result_02+= UChi_02;\
335 result_10+= UChi_10;\
336 result_11+= UChi_11;\
337 result_12+= UChi_12;\
338 result_20+= timesI(UChi_00); \
339 result_21+= timesI(UChi_01); \
340 result_22+= timesI(UChi_02); \
341 result_30-= timesI(UChi_10); \
342 result_31-= timesI(UChi_11); \
343 result_32-= timesI(UChi_12);
345#define TP_RECON_ACCUM\
346 result_00+= UChi_00;\
347 result_01+= UChi_01;\
348 result_02+= UChi_02;\
349 result_10+= UChi_10;\
350 result_11+= UChi_11;\
351 result_12+= UChi_12;\
352 result_20+= UChi_00; \
353 result_21+= UChi_01; \
354 result_22+= UChi_02; \
355 result_30+= UChi_10; \
356 result_31+= UChi_11; \
359#define TM_RECON_ACCUM\
360 result_00+= UChi_00;\
361 result_01+= UChi_01;\
362 result_02+= UChi_02;\
363 result_10+= UChi_10;\
364 result_11+= UChi_11;\
365 result_12+= UChi_12;\
366 result_20-= UChi_00; \
367 result_21-= UChi_01; \
368 result_22-= UChi_02; \
369 result_30-= UChi_10; \
370 result_31-= UChi_11; \
373#define HAND_STENCIL_LEGB(PROJ,PERM,DIR,RECON) \
375 SE=st.GetEntry(ptype,DIR,ss); \
376 auto offset = SE->_offset; \
377 auto local = SE->_is_local; \
378 auto perm = SE->_permute; \
388 acceleratorSynchronise(); \
392#define HAND_STENCIL_LEG(PROJ,PERM,DIR,RECON) \
393 { SE=&st_p[DIR+8*ss]; \
394 auto ptype=st_perm[DIR]; \
395 auto offset = SE->_offset; \
396 auto local = SE->_is_local; \
397 auto perm = SE->_permute; \
407 acceleratorSynchronise(); \
411#define HAND_STENCIL_LEGA(PROJ,PERM,DIR,RECON) \
412 { SE=&st_p[DIR+8*ss]; \
413 auto ptype=st_perm[DIR]; \
415 auto offset = SE->_offset; \
416 auto perm = SE->_permute; \
422#define HAND_STENCIL_LEG_INT(PROJ,PERM,DIR,RECON) \
424 SE=st.GetEntry(ptype,DIR,ss); \
425 auto offset = SE->_offset; \
426 auto local = SE->_is_local; \
427 auto perm = SE->_permute; \
434 } else if ( st.same_node[DIR] ) { \
437 acceleratorSynchronise(); \
438 if (local || st.same_node[DIR] ) { \
442 acceleratorSynchronise(); }
444#define HAND_STENCIL_LEG_EXT(PROJ,PERM,DIR,RECON) \
446 SE=st.GetEntry(ptype,DIR,ss); \
447 auto offset = SE->_offset; \
448 if((!SE->_is_local)&&(!st.same_node[DIR]) ) { \
454 acceleratorSynchronise(); }
456#define HAND_RESULT(ss) \
458 SiteSpinor & ref (out[ss]); \
459 coalescedWrite(ref()(0)(0),result_00,lane); \
460 coalescedWrite(ref()(0)(1),result_01,lane); \
461 coalescedWrite(ref()(0)(2),result_02,lane); \
462 coalescedWrite(ref()(1)(0),result_10,lane); \
463 coalescedWrite(ref()(1)(1),result_11,lane); \
464 coalescedWrite(ref()(1)(2),result_12,lane); \
465 coalescedWrite(ref()(2)(0),result_20,lane); \
466 coalescedWrite(ref()(2)(1),result_21,lane); \
467 coalescedWrite(ref()(2)(2),result_22,lane); \
468 coalescedWrite(ref()(3)(0),result_30,lane); \
469 coalescedWrite(ref()(3)(1),result_31,lane); \
470 coalescedWrite(ref()(3)(2),result_32,lane); \
473#define HAND_RESULT_EXT(ss) \
475 SiteSpinor & ref (out[ss]); \
476 coalescedWrite(ref()(0)(0),coalescedRead(ref()(0)(0))+result_00,lane); \
477 coalescedWrite(ref()(0)(1),coalescedRead(ref()(0)(1))+result_01,lane); \
478 coalescedWrite(ref()(0)(2),coalescedRead(ref()(0)(2))+result_02,lane); \
479 coalescedWrite(ref()(1)(0),coalescedRead(ref()(1)(0))+result_10,lane); \
480 coalescedWrite(ref()(1)(1),coalescedRead(ref()(1)(1))+result_11,lane); \
481 coalescedWrite(ref()(1)(2),coalescedRead(ref()(1)(2))+result_12,lane); \
482 coalescedWrite(ref()(2)(0),coalescedRead(ref()(2)(0))+result_20,lane); \
483 coalescedWrite(ref()(2)(1),coalescedRead(ref()(2)(1))+result_21,lane); \
484 coalescedWrite(ref()(2)(2),coalescedRead(ref()(2)(2))+result_22,lane); \
485 coalescedWrite(ref()(3)(0),coalescedRead(ref()(3)(0))+result_30,lane); \
486 coalescedWrite(ref()(3)(1),coalescedRead(ref()(3)(1))+result_31,lane); \
487 coalescedWrite(ref()(3)(2),coalescedRead(ref()(3)(2))+result_32,lane); \
490#define HAND_DECLARATIONS(Simd) \
536#define Chimu_00 Chi_00
537#define Chimu_01 Chi_01
538#define Chimu_02 Chi_02
539#define Chimu_10 Chi_10
540#define Chimu_11 Chi_11
541#define Chimu_12 Chi_12
542#define Chimu_20 UChi_00
543#define Chimu_21 UChi_01
544#define Chimu_22 UChi_02
545#define Chimu_30 UChi_10
546#define Chimu_31 UChi_11
547#define Chimu_32 UChi_12
555 int ss,
int sU,
const SiteSpinor *in, SiteSpinor *out)
558 typedef typename Simd::scalar_type S;
559 typedef typename Simd::vector_type V;
564 const int Nsimd = SiteHalfSpinor::Nsimd();
584 int ss,
int sU,
const FermionFieldView &in, FermionFieldView &out)
586 auto st_p = st._entries_p;
587 auto st_perm = st._permute_type;
589 typedef typename Simd::scalar_type S;
590 typedef typename Simd::vector_type V;
593 const int Nsimd = SiteHalfSpinor::Nsimd();
612 int ss,
int sU,
const FermionFieldView &in, FermionFieldView &out)
614 auto st_p = st._entries_p;
615 auto st_perm = st._permute_type;
616 typedef typename Simd::scalar_type S;
617 typedef typename Simd::vector_type V;
620 const int Nsimd = SiteHalfSpinor::Nsimd();
639 int ss,
int sU,
const FermionFieldView &in, FermionFieldView &out)
644 typedef typename Simd::scalar_type S;
645 typedef typename Simd::vector_type V;
648 const int Nsimd = SiteHalfSpinor::Nsimd();
668 int ss,
int sU,
const FermionFieldView &in, FermionFieldView &out)
672 typedef typename Simd::scalar_type S;
673 typedef typename Simd::vector_type V;
676 const int Nsimd = SiteHalfSpinor::Nsimd();
696 int ss,
int sU,
const FermionFieldView &in, FermionFieldView &out)
701 typedef typename Simd::scalar_type S;
702 typedef typename Simd::vector_type V;
705 const int Nsimd = SiteHalfSpinor::Nsimd();
727 int ss,
int sU,
const FermionFieldView &in, FermionFieldView &out)
731 typedef typename Simd::scalar_type S;
732 typedef typename Simd::vector_type V;
735 const int Nsimd = SiteHalfSpinor::Nsimd();
793#undef HAND_STENCIL_LEG
794#undef HAND_STENCIL_LEG_INT
795#undef HAND_STENCIL_LEG_EXT
797#undef HAND_RESULT_INT
798#undef HAND_RESULT_EXT
799#undef HAND_DECLARATIONS
accelerator_inline int acceleratorSIMTlane(int Nsimd)
#define accelerator_inline
#define NAMESPACE_BEGIN(A)
iScalar< iScalar< iScalar< vtype > > > iSinglet
accelerator_inline vobj coalescedRead(const vobj &__restrict__ vec, int lane=0)
#define HAND_RESULT_EXT(ss)
#define HAND_STENCIL_LEG_EXT(PROJ, PERM, DIR, RECON)
#define HAND_STENCIL_LEG(PROJ, PERM, DIR, RECON)
#define HAND_STENCIL_LEG_INT(PROJ, PERM, DIR, RECON)
#define HAND_DECLARATIONS(Simd)
static INTERNAL_PRECISION U
static accelerator void HandDhopSiteExt(StencilView &st, DoubledGaugeFieldView &U, SiteHalfSpinor *buf, int sF, int sU, const FermionFieldView &in, FermionFieldView &out)
static accelerator void HandDhopSite(StencilView &st, DoubledGaugeFieldView &U, SiteHalfSpinor *buf, int sF, int sU, const FermionFieldView &in, FermionFieldView &out)
static accelerator void HandDhopSiteDagExt(StencilView &st, DoubledGaugeFieldView &U, SiteHalfSpinor *buf, int sF, int sU, const FermionFieldView &in, FermionFieldView &out)
static accelerator void HandDhopSiteInt(StencilView &st, DoubledGaugeFieldView &U, SiteHalfSpinor *buf, int sF, int sU, const FermionFieldView &in, FermionFieldView &out)
static accelerator void HandDhopSiteDagInt(StencilView &st, DoubledGaugeFieldView &U, SiteHalfSpinor *buf, int sF, int sU, const FermionFieldView &in, FermionFieldView &out)
static accelerator void HandDhopSiteDag(StencilView &st, DoubledGaugeFieldView &U, SiteHalfSpinor *buf, int sF, int sU, const FermionFieldView &in, FermionFieldView &out)