QUDA  v0.7.0
A library for QCD on GPUs
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tmc_fused_exterior_dslash_gt200_core.h
Go to the documentation of this file.
1 #ifdef MULTI_GPU
2 
3 // *** CUDA DSLASH ***
4 
5 #define DSLASH_SHARED_FLOATS_PER_THREAD 0
6 
7 
8 #if ((CUDA_VERSION >= 4010) && (__COMPUTE_CAPABILITY__ >= 200)) // NVVM compiler
9 #define VOLATILE
10 #else // Open64 compiler
11 #define VOLATILE volatile
12 #endif
13 // input spinor
14 #ifdef SPINOR_DOUBLE
15 #define spinorFloat double
16 #define i00_re I0.x
17 #define i00_im I0.y
18 #define i01_re I1.x
19 #define i01_im I1.y
20 #define i02_re I2.x
21 #define i02_im I2.y
22 #define i10_re I3.x
23 #define i10_im I3.y
24 #define i11_re I4.x
25 #define i11_im I4.y
26 #define i12_re I5.x
27 #define i12_im I5.y
28 #define i20_re I6.x
29 #define i20_im I6.y
30 #define i21_re I7.x
31 #define i21_im I7.y
32 #define i22_re I8.x
33 #define i22_im I8.y
34 #define i30_re I9.x
35 #define i30_im I9.y
36 #define i31_re I10.x
37 #define i31_im I10.y
38 #define i32_re I11.x
39 #define i32_im I11.y
40 #define acc00_re accum0.x
41 #define acc00_im accum0.y
42 #define acc01_re accum1.x
43 #define acc01_im accum1.y
44 #define acc02_re accum2.x
45 #define acc02_im accum2.y
46 #define acc10_re accum3.x
47 #define acc10_im accum3.y
48 #define acc11_re accum4.x
49 #define acc11_im accum4.y
50 #define acc12_re accum5.x
51 #define acc12_im accum5.y
52 #define acc20_re accum6.x
53 #define acc20_im accum6.y
54 #define acc21_re accum7.x
55 #define acc21_im accum7.y
56 #define acc22_re accum8.x
57 #define acc22_im accum8.y
58 #define acc30_re accum9.x
59 #define acc30_im accum9.y
60 #define acc31_re accum10.x
61 #define acc31_im accum10.y
62 #define acc32_re accum11.x
63 #define acc32_im accum11.y
64 #else
65 #define spinorFloat float
66 #define i00_re I0.x
67 #define i00_im I0.y
68 #define i01_re I0.z
69 #define i01_im I0.w
70 #define i02_re I1.x
71 #define i02_im I1.y
72 #define i10_re I1.z
73 #define i10_im I1.w
74 #define i11_re I2.x
75 #define i11_im I2.y
76 #define i12_re I2.z
77 #define i12_im I2.w
78 #define i20_re I3.x
79 #define i20_im I3.y
80 #define i21_re I3.z
81 #define i21_im I3.w
82 #define i22_re I4.x
83 #define i22_im I4.y
84 #define i30_re I4.z
85 #define i30_im I4.w
86 #define i31_re I5.x
87 #define i31_im I5.y
88 #define i32_re I5.z
89 #define i32_im I5.w
90 #define acc00_re accum0.x
91 #define acc00_im accum0.y
92 #define acc01_re accum0.z
93 #define acc01_im accum0.w
94 #define acc02_re accum1.x
95 #define acc02_im accum1.y
96 #define acc10_re accum1.z
97 #define acc10_im accum1.w
98 #define acc11_re accum2.x
99 #define acc11_im accum2.y
100 #define acc12_re accum2.z
101 #define acc12_im accum2.w
102 #define acc20_re accum3.x
103 #define acc20_im accum3.y
104 #define acc21_re accum3.z
105 #define acc21_im accum3.w
106 #define acc22_re accum4.x
107 #define acc22_im accum4.y
108 #define acc30_re accum4.z
109 #define acc30_im accum4.w
110 #define acc31_re accum5.x
111 #define acc31_im accum5.y
112 #define acc32_re accum5.z
113 #define acc32_im accum5.w
114 #endif // SPINOR_DOUBLE
115 
116 // gauge link
117 #ifdef GAUGE_FLOAT2
118 #define g00_re G0.x
119 #define g00_im G0.y
120 #define g01_re G1.x
121 #define g01_im G1.y
122 #define g02_re G2.x
123 #define g02_im G2.y
124 #define g10_re G3.x
125 #define g10_im G3.y
126 #define g11_re G4.x
127 #define g11_im G4.y
128 #define g12_re G5.x
129 #define g12_im G5.y
130 #define g20_re G6.x
131 #define g20_im G6.y
132 #define g21_re G7.x
133 #define g21_im G7.y
134 #define g22_re G8.x
135 #define g22_im G8.y
136 
137 #else
138 #define g00_re G0.x
139 #define g00_im G0.y
140 #define g01_re G0.z
141 #define g01_im G0.w
142 #define g02_re G1.x
143 #define g02_im G1.y
144 #define g10_re G1.z
145 #define g10_im G1.w
146 #define g11_re G2.x
147 #define g11_im G2.y
148 #define g12_re G2.z
149 #define g12_im G2.w
150 #define g20_re G3.x
151 #define g20_im G3.y
152 #define g21_re G3.z
153 #define g21_im G3.w
154 #define g22_re G4.x
155 #define g22_im G4.y
156 
157 #endif // GAUGE_DOUBLE
158 
159 // conjugated gauge link
160 #define gT00_re (+g00_re)
161 #define gT00_im (-g00_im)
162 #define gT01_re (+g10_re)
163 #define gT01_im (-g10_im)
164 #define gT02_re (+g20_re)
165 #define gT02_im (-g20_im)
166 #define gT10_re (+g01_re)
167 #define gT10_im (-g01_im)
168 #define gT11_re (+g11_re)
169 #define gT11_im (-g11_im)
170 #define gT12_re (+g21_re)
171 #define gT12_im (-g21_im)
172 #define gT20_re (+g02_re)
173 #define gT20_im (-g02_im)
174 #define gT21_re (+g12_re)
175 #define gT21_im (-g12_im)
176 #define gT22_re (+g22_re)
177 #define gT22_im (-g22_im)
178 
179 // first chiral block of clover term
180 #ifdef CLOVER_DOUBLE
181 #define c00_00_re C0.x
182 #define c01_01_re C0.y
183 #define c02_02_re C1.x
184 #define c10_10_re C1.y
185 #define c11_11_re C2.x
186 #define c12_12_re C2.y
187 #define c01_00_re C3.x
188 #define c01_00_im C3.y
189 #define c02_00_re C4.x
190 #define c02_00_im C4.y
191 #define c10_00_re C5.x
192 #define c10_00_im C5.y
193 #define c11_00_re C6.x
194 #define c11_00_im C6.y
195 #define c12_00_re C7.x
196 #define c12_00_im C7.y
197 #define c02_01_re C8.x
198 #define c02_01_im C8.y
199 #define c10_01_re C9.x
200 #define c10_01_im C9.y
201 #define c11_01_re C10.x
202 #define c11_01_im C10.y
203 #define c12_01_re C11.x
204 #define c12_01_im C11.y
205 #define c10_02_re C12.x
206 #define c10_02_im C12.y
207 #define c11_02_re C13.x
208 #define c11_02_im C13.y
209 #define c12_02_re C14.x
210 #define c12_02_im C14.y
211 #define c11_10_re C15.x
212 #define c11_10_im C15.y
213 #define c12_10_re C16.x
214 #define c12_10_im C16.y
215 #define c12_11_re C17.x
216 #define c12_11_im C17.y
217 #else
218 #define c00_00_re C0.x
219 #define c01_01_re C0.y
220 #define c02_02_re C0.z
221 #define c10_10_re C0.w
222 #define c11_11_re C1.x
223 #define c12_12_re C1.y
224 #define c01_00_re C1.z
225 #define c01_00_im C1.w
226 #define c02_00_re C2.x
227 #define c02_00_im C2.y
228 #define c10_00_re C2.z
229 #define c10_00_im C2.w
230 #define c11_00_re C3.x
231 #define c11_00_im C3.y
232 #define c12_00_re C3.z
233 #define c12_00_im C3.w
234 #define c02_01_re C4.x
235 #define c02_01_im C4.y
236 #define c10_01_re C4.z
237 #define c10_01_im C4.w
238 #define c11_01_re C5.x
239 #define c11_01_im C5.y
240 #define c12_01_re C5.z
241 #define c12_01_im C5.w
242 #define c10_02_re C6.x
243 #define c10_02_im C6.y
244 #define c11_02_re C6.z
245 #define c11_02_im C6.w
246 #define c12_02_re C7.x
247 #define c12_02_im C7.y
248 #define c11_10_re C7.z
249 #define c11_10_im C7.w
250 #define c12_10_re C8.x
251 #define c12_10_im C8.y
252 #define c12_11_re C8.z
253 #define c12_11_im C8.w
254 #endif // CLOVER_DOUBLE
255 
256 #define c00_01_re (+c01_00_re)
257 #define c00_01_im (-c01_00_im)
258 #define c00_02_re (+c02_00_re)
259 #define c00_02_im (-c02_00_im)
260 #define c01_02_re (+c02_01_re)
261 #define c01_02_im (-c02_01_im)
262 #define c00_10_re (+c10_00_re)
263 #define c00_10_im (-c10_00_im)
264 #define c01_10_re (+c10_01_re)
265 #define c01_10_im (-c10_01_im)
266 #define c02_10_re (+c10_02_re)
267 #define c02_10_im (-c10_02_im)
268 #define c00_11_re (+c11_00_re)
269 #define c00_11_im (-c11_00_im)
270 #define c01_11_re (+c11_01_re)
271 #define c01_11_im (-c11_01_im)
272 #define c02_11_re (+c11_02_re)
273 #define c02_11_im (-c11_02_im)
274 #define c10_11_re (+c11_10_re)
275 #define c10_11_im (-c11_10_im)
276 #define c00_12_re (+c12_00_re)
277 #define c00_12_im (-c12_00_im)
278 #define c01_12_re (+c12_01_re)
279 #define c01_12_im (-c12_01_im)
280 #define c02_12_re (+c12_02_re)
281 #define c02_12_im (-c12_02_im)
282 #define c10_12_re (+c12_10_re)
283 #define c10_12_im (-c12_10_im)
284 #define c11_12_re (+c12_11_re)
285 #define c11_12_im (-c12_11_im)
286 
287 // second chiral block of clover term (reuses C0,...,C9)
288 #define c20_20_re c00_00_re
289 #define c21_20_re c01_00_re
290 #define c21_20_im c01_00_im
291 #define c22_20_re c02_00_re
292 #define c22_20_im c02_00_im
293 #define c30_20_re c10_00_re
294 #define c30_20_im c10_00_im
295 #define c31_20_re c11_00_re
296 #define c31_20_im c11_00_im
297 #define c32_20_re c12_00_re
298 #define c32_20_im c12_00_im
299 #define c20_21_re c00_01_re
300 #define c20_21_im c00_01_im
301 #define c21_21_re c01_01_re
302 #define c22_21_re c02_01_re
303 #define c22_21_im c02_01_im
304 #define c30_21_re c10_01_re
305 #define c30_21_im c10_01_im
306 #define c31_21_re c11_01_re
307 #define c31_21_im c11_01_im
308 #define c32_21_re c12_01_re
309 #define c32_21_im c12_01_im
310 #define c20_22_re c00_02_re
311 #define c20_22_im c00_02_im
312 #define c21_22_re c01_02_re
313 #define c21_22_im c01_02_im
314 #define c22_22_re c02_02_re
315 #define c30_22_re c10_02_re
316 #define c30_22_im c10_02_im
317 #define c31_22_re c11_02_re
318 #define c31_22_im c11_02_im
319 #define c32_22_re c12_02_re
320 #define c32_22_im c12_02_im
321 #define c20_30_re c00_10_re
322 #define c20_30_im c00_10_im
323 #define c21_30_re c01_10_re
324 #define c21_30_im c01_10_im
325 #define c22_30_re c02_10_re
326 #define c22_30_im c02_10_im
327 #define c30_30_re c10_10_re
328 #define c31_30_re c11_10_re
329 #define c31_30_im c11_10_im
330 #define c32_30_re c12_10_re
331 #define c32_30_im c12_10_im
332 #define c20_31_re c00_11_re
333 #define c20_31_im c00_11_im
334 #define c21_31_re c01_11_re
335 #define c21_31_im c01_11_im
336 #define c22_31_re c02_11_re
337 #define c22_31_im c02_11_im
338 #define c30_31_re c10_11_re
339 #define c30_31_im c10_11_im
340 #define c31_31_re c11_11_re
341 #define c32_31_re c12_11_re
342 #define c32_31_im c12_11_im
343 #define c20_32_re c00_12_re
344 #define c20_32_im c00_12_im
345 #define c21_32_re c01_12_re
346 #define c21_32_im c01_12_im
347 #define c22_32_re c02_12_re
348 #define c22_32_im c02_12_im
349 #define c30_32_re c10_12_re
350 #define c30_32_im c10_12_im
351 #define c31_32_re c11_12_re
352 #define c31_32_im c11_12_im
353 #define c32_32_re c12_12_re
354 
355 
356 // first chiral block of inverted clover term
357 #ifdef CLOVER_DOUBLE
358 #define cinv00_00_re C0.x
359 #define cinv01_01_re C0.y
360 #define cinv02_02_re C1.x
361 #define cinv10_10_re C1.y
362 #define cinv11_11_re C2.x
363 #define cinv12_12_re C2.y
364 #define cinv01_00_re C3.x
365 #define cinv01_00_im C3.y
366 #define cinv02_00_re C4.x
367 #define cinv02_00_im C4.y
368 #define cinv10_00_re C5.x
369 #define cinv10_00_im C5.y
370 #define cinv11_00_re C6.x
371 #define cinv11_00_im C6.y
372 #define cinv12_00_re C7.x
373 #define cinv12_00_im C7.y
374 #define cinv02_01_re C8.x
375 #define cinv02_01_im C8.y
376 #define cinv10_01_re C9.x
377 #define cinv10_01_im C9.y
378 #define cinv11_01_re C10.x
379 #define cinv11_01_im C10.y
380 #define cinv12_01_re C11.x
381 #define cinv12_01_im C11.y
382 #define cinv10_02_re C12.x
383 #define cinv10_02_im C12.y
384 #define cinv11_02_re C13.x
385 #define cinv11_02_im C13.y
386 #define cinv12_02_re C14.x
387 #define cinv12_02_im C14.y
388 #define cinv11_10_re C15.x
389 #define cinv11_10_im C15.y
390 #define cinv12_10_re C16.x
391 #define cinv12_10_im C16.y
392 #define cinv12_11_re C17.x
393 #define cinv12_11_im C17.y
394 #else
395 #define cinv00_00_re C0.x
396 #define cinv01_01_re C0.y
397 #define cinv02_02_re C0.z
398 #define cinv10_10_re C0.w
399 #define cinv11_11_re C1.x
400 #define cinv12_12_re C1.y
401 #define cinv01_00_re C1.z
402 #define cinv01_00_im C1.w
403 #define cinv02_00_re C2.x
404 #define cinv02_00_im C2.y
405 #define cinv10_00_re C2.z
406 #define cinv10_00_im C2.w
407 #define cinv11_00_re C3.x
408 #define cinv11_00_im C3.y
409 #define cinv12_00_re C3.z
410 #define cinv12_00_im C3.w
411 #define cinv02_01_re C4.x
412 #define cinv02_01_im C4.y
413 #define cinv10_01_re C4.z
414 #define cinv10_01_im C4.w
415 #define cinv11_01_re C5.x
416 #define cinv11_01_im C5.y
417 #define cinv12_01_re C5.z
418 #define cinv12_01_im C5.w
419 #define cinv10_02_re C6.x
420 #define cinv10_02_im C6.y
421 #define cinv11_02_re C6.z
422 #define cinv11_02_im C6.w
423 #define cinv12_02_re C7.x
424 #define cinv12_02_im C7.y
425 #define cinv11_10_re C7.z
426 #define cinv11_10_im C7.w
427 #define cinv12_10_re C8.x
428 #define cinv12_10_im C8.y
429 #define cinv12_11_re C8.z
430 #define cinv12_11_im C8.w
431 #endif // CLOVER_DOUBLE
432 
433 #define cinv00_01_re (+cinv01_00_re)
434 #define cinv00_01_im (-cinv01_00_im)
435 #define cinv00_02_re (+cinv02_00_re)
436 #define cinv00_02_im (-cinv02_00_im)
437 #define cinv01_02_re (+cinv02_01_re)
438 #define cinv01_02_im (-cinv02_01_im)
439 #define cinv00_10_re (+cinv10_00_re)
440 #define cinv00_10_im (-cinv10_00_im)
441 #define cinv01_10_re (+cinv10_01_re)
442 #define cinv01_10_im (-cinv10_01_im)
443 #define cinv02_10_re (+cinv10_02_re)
444 #define cinv02_10_im (-cinv10_02_im)
445 #define cinv00_11_re (+cinv11_00_re)
446 #define cinv00_11_im (-cinv11_00_im)
447 #define cinv01_11_re (+cinv11_01_re)
448 #define cinv01_11_im (-cinv11_01_im)
449 #define cinv02_11_re (+cinv11_02_re)
450 #define cinv02_11_im (-cinv11_02_im)
451 #define cinv10_11_re (+cinv11_10_re)
452 #define cinv10_11_im (-cinv11_10_im)
453 #define cinv00_12_re (+cinv12_00_re)
454 #define cinv00_12_im (-cinv12_00_im)
455 #define cinv01_12_re (+cinv12_01_re)
456 #define cinv01_12_im (-cinv12_01_im)
457 #define cinv02_12_re (+cinv12_02_re)
458 #define cinv02_12_im (-cinv12_02_im)
459 #define cinv10_12_re (+cinv12_10_re)
460 #define cinv10_12_im (-cinv12_10_im)
461 #define cinv11_12_re (+cinv12_11_re)
462 #define cinv11_12_im (-cinv12_11_im)
463 
464 // second chiral block of inverted clover term (reuses C0,...,C9)
465 #define cinv20_20_re cinv00_00_re
466 #define cinv21_20_re cinv01_00_re
467 #define cinv21_20_im cinv01_00_im
468 #define cinv22_20_re cinv02_00_re
469 #define cinv22_20_im cinv02_00_im
470 #define cinv30_20_re cinv10_00_re
471 #define cinv30_20_im cinv10_00_im
472 #define cinv31_20_re cinv11_00_re
473 #define cinv31_20_im cinv11_00_im
474 #define cinv32_20_re cinv12_00_re
475 #define cinv32_20_im cinv12_00_im
476 #define cinv20_21_re cinv00_01_re
477 #define cinv20_21_im cinv00_01_im
478 #define cinv21_21_re cinv01_01_re
479 #define cinv22_21_re cinv02_01_re
480 #define cinv22_21_im cinv02_01_im
481 #define cinv30_21_re cinv10_01_re
482 #define cinv30_21_im cinv10_01_im
483 #define cinv31_21_re cinv11_01_re
484 #define cinv31_21_im cinv11_01_im
485 #define cinv32_21_re cinv12_01_re
486 #define cinv32_21_im cinv12_01_im
487 #define cinv20_22_re cinv00_02_re
488 #define cinv20_22_im cinv00_02_im
489 #define cinv21_22_re cinv01_02_re
490 #define cinv21_22_im cinv01_02_im
491 #define cinv22_22_re cinv02_02_re
492 #define cinv30_22_re cinv10_02_re
493 #define cinv30_22_im cinv10_02_im
494 #define cinv31_22_re cinv11_02_re
495 #define cinv31_22_im cinv11_02_im
496 #define cinv32_22_re cinv12_02_re
497 #define cinv32_22_im cinv12_02_im
498 #define cinv20_30_re cinv00_10_re
499 #define cinv20_30_im cinv00_10_im
500 #define cinv21_30_re cinv01_10_re
501 #define cinv21_30_im cinv01_10_im
502 #define cinv22_30_re cinv02_10_re
503 #define cinv22_30_im cinv02_10_im
504 #define cinv30_30_re cinv10_10_re
505 #define cinv31_30_re cinv11_10_re
506 #define cinv31_30_im cinv11_10_im
507 #define cinv32_30_re cinv12_10_re
508 #define cinv32_30_im cinv12_10_im
509 #define cinv20_31_re cinv00_11_re
510 #define cinv20_31_im cinv00_11_im
511 #define cinv21_31_re cinv01_11_re
512 #define cinv21_31_im cinv01_11_im
513 #define cinv22_31_re cinv02_11_re
514 #define cinv22_31_im cinv02_11_im
515 #define cinv30_31_re cinv10_11_re
516 #define cinv30_31_im cinv10_11_im
517 #define cinv31_31_re cinv11_11_re
518 #define cinv32_31_re cinv12_11_re
519 #define cinv32_31_im cinv12_11_im
520 #define cinv20_32_re cinv00_12_re
521 #define cinv20_32_im cinv00_12_im
522 #define cinv21_32_re cinv01_12_re
523 #define cinv21_32_im cinv01_12_im
524 #define cinv22_32_re cinv02_12_re
525 #define cinv22_32_im cinv02_12_im
526 #define cinv30_32_re cinv10_12_re
527 #define cinv30_32_im cinv10_12_im
528 #define cinv31_32_re cinv11_12_re
529 #define cinv31_32_im cinv11_12_im
530 #define cinv32_32_re cinv12_12_re
531 
532 
533 
534 // declare C## here and use ASSN below instead of READ
535 #ifdef CLOVER_DOUBLE
536 double2 C0;
537 double2 C1;
538 double2 C2;
539 double2 C3;
540 double2 C4;
541 double2 C5;
542 double2 C6;
543 double2 C7;
544 double2 C8;
545 double2 C9;
546 double2 C10;
547 double2 C11;
548 double2 C12;
549 double2 C13;
550 double2 C14;
551 double2 C15;
552 double2 C16;
553 double2 C17;
554 #else
555 float4 C0;
556 float4 C1;
557 float4 C2;
558 float4 C3;
559 float4 C4;
560 float4 C5;
561 float4 C6;
562 float4 C7;
563 float4 C8;
564 
565 #if (DD_PREC==2)
566 float K;
567 #endif
568 
569 #endif // CLOVER_DOUBLE
570 // output spinor
595 
596 #include "read_gauge.h"
597 #include "io_spinor.h"
598 #include "read_clover.h"
599 #include "tmc_core.h"
600 
601 int x1, x2, x3, x4;
602 int X;
603 
604 #if (DD_PREC==2) // half precision
605 int sp_norm_idx;
606 #endif // half precision
607 
608 int sid;
609 
610 int dim;
611 int face_idx;
612 int Y[4] = {X1,X2,X3,X4};
613 int faceVolume[4];
614 faceVolume[0] = (X2*X3*X4)>>1;
615 faceVolume[1] = (X1*X3*X4)>>1;
616 faceVolume[2] = (X1*X2*X4)>>1;
617 faceVolume[3] = (X1*X2*X3)>>1;
618 
619  sid = blockIdx.x*blockDim.x + threadIdx.x;
620  if (sid >= param.threads) return;
621 
622 
623  dim = dimFromFaceIndex(sid, param); // sid is also modified
624 
625  const int face_volume = ((param.threadDimMapUpper[dim] - param.threadDimMapLower[dim]) >> 1);
626  const int face_num = (sid >= face_volume); // is this thread updating face 0 or 1
627  face_idx = sid - face_num*face_volume; // index into the respective face
628 
629 
630  const int dims[] = {X1, X2, X3, X4};
631  coordsFromFaceIndex<1>(X, sid, x1, x2, x3, x4, face_idx, face_volume, dim, face_num, param.parity, dims);
632 
633  bool active = false;
634  for(int dir=0; dir<4; ++dir){
635  active = active || isActive(dim,dir,+1,x1,x2,x3,x4,param.commDim,param.X);
636  }
637  if(!active) return;
638 
639 
640  READ_INTERMEDIATE_SPINOR(INTERTEX, param.sp_stride, sid, sid);
641 
642  o00_re = i00_re; o00_im = i00_im;
643  o01_re = i01_re; o01_im = i01_im;
644  o02_re = i02_re; o02_im = i02_im;
645  o10_re = i10_re; o10_im = i10_im;
646  o11_re = i11_re; o11_im = i11_im;
647  o12_re = i12_re; o12_im = i12_im;
648  o20_re = i20_re; o20_im = i20_im;
649  o21_re = i21_re; o21_im = i21_im;
650  o22_re = i22_re; o22_im = i22_im;
651  o30_re = i30_re; o30_im = i30_im;
652  o31_re = i31_re; o31_im = i31_im;
653  o32_re = i32_re; o32_im = i32_im;
654 if (isActive(dim,0,+1,x1,x2,x3,x4,param.commDim,param.X) && x1==X1m1 )
655 {
656  // Projector P0-
657  // 1 0 0 -i
658  // 0 1 -i 0
659  // 0 i 1 0
660  // i 0 0 1
661 
662  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,0,Y);
663  const int sp_idx = face_idx + param.ghostOffset[0];
664 #if (DD_PREC==2)
665  sp_norm_idx = face_idx + faceVolume[0] + param.ghostNormOffset[0];
666 #endif
667 
668  const int ga_idx = sid;
669 
676 
677 
678  const int sp_stride_pad = ghostFace[0];
679 
680  // read half spinor from device memory
681  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx + (SPINOR_HOP/2)*sp_stride_pad, sp_norm_idx);
682 
683  a0_re = i00_re; a0_im = i00_im;
684  a1_re = i01_re; a1_im = i01_im;
685  a2_re = i02_re; a2_im = i02_im;
686  b0_re = i10_re; b0_im = i10_im;
687  b1_re = i11_re; b1_im = i11_im;
688  b2_re = i12_re; b2_im = i12_im;
689 
690  // read gauge matrix from device memory
691  READ_GAUGE_MATRIX(G, GAUGE0TEX, 0, ga_idx, ga_stride);
692 
693  // reconstruct gauge matrix
695 
696  // multiply row 0
697  spinorFloat A0_re = 0;
698  A0_re += g00_re * a0_re;
699  A0_re -= g00_im * a0_im;
700  A0_re += g01_re * a1_re;
701  A0_re -= g01_im * a1_im;
702  A0_re += g02_re * a2_re;
703  A0_re -= g02_im * a2_im;
704  spinorFloat A0_im = 0;
705  A0_im += g00_re * a0_im;
706  A0_im += g00_im * a0_re;
707  A0_im += g01_re * a1_im;
708  A0_im += g01_im * a1_re;
709  A0_im += g02_re * a2_im;
710  A0_im += g02_im * a2_re;
711  spinorFloat B0_re = 0;
712  B0_re += g00_re * b0_re;
713  B0_re -= g00_im * b0_im;
714  B0_re += g01_re * b1_re;
715  B0_re -= g01_im * b1_im;
716  B0_re += g02_re * b2_re;
717  B0_re -= g02_im * b2_im;
718  spinorFloat B0_im = 0;
719  B0_im += g00_re * b0_im;
720  B0_im += g00_im * b0_re;
721  B0_im += g01_re * b1_im;
722  B0_im += g01_im * b1_re;
723  B0_im += g02_re * b2_im;
724  B0_im += g02_im * b2_re;
725 
726  // multiply row 1
727  spinorFloat A1_re = 0;
728  A1_re += g10_re * a0_re;
729  A1_re -= g10_im * a0_im;
730  A1_re += g11_re * a1_re;
731  A1_re -= g11_im * a1_im;
732  A1_re += g12_re * a2_re;
733  A1_re -= g12_im * a2_im;
734  spinorFloat A1_im = 0;
735  A1_im += g10_re * a0_im;
736  A1_im += g10_im * a0_re;
737  A1_im += g11_re * a1_im;
738  A1_im += g11_im * a1_re;
739  A1_im += g12_re * a2_im;
740  A1_im += g12_im * a2_re;
741  spinorFloat B1_re = 0;
742  B1_re += g10_re * b0_re;
743  B1_re -= g10_im * b0_im;
744  B1_re += g11_re * b1_re;
745  B1_re -= g11_im * b1_im;
746  B1_re += g12_re * b2_re;
747  B1_re -= g12_im * b2_im;
748  spinorFloat B1_im = 0;
749  B1_im += g10_re * b0_im;
750  B1_im += g10_im * b0_re;
751  B1_im += g11_re * b1_im;
752  B1_im += g11_im * b1_re;
753  B1_im += g12_re * b2_im;
754  B1_im += g12_im * b2_re;
755 
756  // multiply row 2
757  spinorFloat A2_re = 0;
758  A2_re += g20_re * a0_re;
759  A2_re -= g20_im * a0_im;
760  A2_re += g21_re * a1_re;
761  A2_re -= g21_im * a1_im;
762  A2_re += g22_re * a2_re;
763  A2_re -= g22_im * a2_im;
764  spinorFloat A2_im = 0;
765  A2_im += g20_re * a0_im;
766  A2_im += g20_im * a0_re;
767  A2_im += g21_re * a1_im;
768  A2_im += g21_im * a1_re;
769  A2_im += g22_re * a2_im;
770  A2_im += g22_im * a2_re;
771  spinorFloat B2_re = 0;
772  B2_re += g20_re * b0_re;
773  B2_re -= g20_im * b0_im;
774  B2_re += g21_re * b1_re;
775  B2_re -= g21_im * b1_im;
776  B2_re += g22_re * b2_re;
777  B2_re -= g22_im * b2_im;
778  spinorFloat B2_im = 0;
779  B2_im += g20_re * b0_im;
780  B2_im += g20_im * b0_re;
781  B2_im += g21_re * b1_im;
782  B2_im += g21_im * b1_re;
783  B2_im += g22_re * b2_im;
784  B2_im += g22_im * b2_re;
785 
786  o00_re += A0_re;
787  o00_im += A0_im;
788  o10_re += B0_re;
789  o10_im += B0_im;
790  o20_re -= B0_im;
791  o20_im += B0_re;
792  o30_re -= A0_im;
793  o30_im += A0_re;
794 
795  o01_re += A1_re;
796  o01_im += A1_im;
797  o11_re += B1_re;
798  o11_im += B1_im;
799  o21_re -= B1_im;
800  o21_im += B1_re;
801  o31_re -= A1_im;
802  o31_im += A1_re;
803 
804  o02_re += A2_re;
805  o02_im += A2_im;
806  o12_re += B2_re;
807  o12_im += B2_im;
808  o22_re -= B2_im;
809  o22_im += B2_re;
810  o32_re -= A2_im;
811  o32_im += A2_re;
812 
813 }
814 
815 if (isActive(dim,0,-1,x1,x2,x3,x4,param.commDim,param.X) && x1==0 )
816 {
817  // Projector P0+
818  // 1 0 0 i
819  // 0 1 i 0
820  // 0 -i 1 0
821  // -i 0 0 1
822 
823  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,0,Y);
824  const int sp_idx = face_idx + param.ghostOffset[0];
825 #if (DD_PREC==2)
826  sp_norm_idx = face_idx + param.ghostNormOffset[0];
827 #endif
828 
829  const int ga_idx = Vh+face_idx;
830 
837 
838 
839  const int sp_stride_pad = ghostFace[0];
840 
841  // read half spinor from device memory
842  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx, sp_norm_idx);
843 
844  a0_re = i00_re; a0_im = i00_im;
845  a1_re = i01_re; a1_im = i01_im;
846  a2_re = i02_re; a2_im = i02_im;
847  b0_re = i10_re; b0_im = i10_im;
848  b1_re = i11_re; b1_im = i11_im;
849  b2_re = i12_re; b2_im = i12_im;
850 
851  // read gauge matrix from device memory
852  READ_GAUGE_MATRIX(G, GAUGE1TEX, 1, ga_idx, ga_stride);
853 
854  // reconstruct gauge matrix
856 
857  // multiply row 0
858  spinorFloat A0_re = 0;
859  A0_re += gT00_re * a0_re;
860  A0_re -= gT00_im * a0_im;
861  A0_re += gT01_re * a1_re;
862  A0_re -= gT01_im * a1_im;
863  A0_re += gT02_re * a2_re;
864  A0_re -= gT02_im * a2_im;
865  spinorFloat A0_im = 0;
866  A0_im += gT00_re * a0_im;
867  A0_im += gT00_im * a0_re;
868  A0_im += gT01_re * a1_im;
869  A0_im += gT01_im * a1_re;
870  A0_im += gT02_re * a2_im;
871  A0_im += gT02_im * a2_re;
872  spinorFloat B0_re = 0;
873  B0_re += gT00_re * b0_re;
874  B0_re -= gT00_im * b0_im;
875  B0_re += gT01_re * b1_re;
876  B0_re -= gT01_im * b1_im;
877  B0_re += gT02_re * b2_re;
878  B0_re -= gT02_im * b2_im;
879  spinorFloat B0_im = 0;
880  B0_im += gT00_re * b0_im;
881  B0_im += gT00_im * b0_re;
882  B0_im += gT01_re * b1_im;
883  B0_im += gT01_im * b1_re;
884  B0_im += gT02_re * b2_im;
885  B0_im += gT02_im * b2_re;
886 
887  // multiply row 1
888  spinorFloat A1_re = 0;
889  A1_re += gT10_re * a0_re;
890  A1_re -= gT10_im * a0_im;
891  A1_re += gT11_re * a1_re;
892  A1_re -= gT11_im * a1_im;
893  A1_re += gT12_re * a2_re;
894  A1_re -= gT12_im * a2_im;
895  spinorFloat A1_im = 0;
896  A1_im += gT10_re * a0_im;
897  A1_im += gT10_im * a0_re;
898  A1_im += gT11_re * a1_im;
899  A1_im += gT11_im * a1_re;
900  A1_im += gT12_re * a2_im;
901  A1_im += gT12_im * a2_re;
902  spinorFloat B1_re = 0;
903  B1_re += gT10_re * b0_re;
904  B1_re -= gT10_im * b0_im;
905  B1_re += gT11_re * b1_re;
906  B1_re -= gT11_im * b1_im;
907  B1_re += gT12_re * b2_re;
908  B1_re -= gT12_im * b2_im;
909  spinorFloat B1_im = 0;
910  B1_im += gT10_re * b0_im;
911  B1_im += gT10_im * b0_re;
912  B1_im += gT11_re * b1_im;
913  B1_im += gT11_im * b1_re;
914  B1_im += gT12_re * b2_im;
915  B1_im += gT12_im * b2_re;
916 
917  // multiply row 2
918  spinorFloat A2_re = 0;
919  A2_re += gT20_re * a0_re;
920  A2_re -= gT20_im * a0_im;
921  A2_re += gT21_re * a1_re;
922  A2_re -= gT21_im * a1_im;
923  A2_re += gT22_re * a2_re;
924  A2_re -= gT22_im * a2_im;
925  spinorFloat A2_im = 0;
926  A2_im += gT20_re * a0_im;
927  A2_im += gT20_im * a0_re;
928  A2_im += gT21_re * a1_im;
929  A2_im += gT21_im * a1_re;
930  A2_im += gT22_re * a2_im;
931  A2_im += gT22_im * a2_re;
932  spinorFloat B2_re = 0;
933  B2_re += gT20_re * b0_re;
934  B2_re -= gT20_im * b0_im;
935  B2_re += gT21_re * b1_re;
936  B2_re -= gT21_im * b1_im;
937  B2_re += gT22_re * b2_re;
938  B2_re -= gT22_im * b2_im;
939  spinorFloat B2_im = 0;
940  B2_im += gT20_re * b0_im;
941  B2_im += gT20_im * b0_re;
942  B2_im += gT21_re * b1_im;
943  B2_im += gT21_im * b1_re;
944  B2_im += gT22_re * b2_im;
945  B2_im += gT22_im * b2_re;
946 
947  o00_re += A0_re;
948  o00_im += A0_im;
949  o10_re += B0_re;
950  o10_im += B0_im;
951  o20_re += B0_im;
952  o20_im -= B0_re;
953  o30_re += A0_im;
954  o30_im -= A0_re;
955 
956  o01_re += A1_re;
957  o01_im += A1_im;
958  o11_re += B1_re;
959  o11_im += B1_im;
960  o21_re += B1_im;
961  o21_im -= B1_re;
962  o31_re += A1_im;
963  o31_im -= A1_re;
964 
965  o02_re += A2_re;
966  o02_im += A2_im;
967  o12_re += B2_re;
968  o12_im += B2_im;
969  o22_re += B2_im;
970  o22_im -= B2_re;
971  o32_re += A2_im;
972  o32_im -= A2_re;
973 
974 }
975 
976 if (isActive(dim,1,+1,x1,x2,x3,x4,param.commDim,param.X) && x2==X2m1 )
977 {
978  // Projector P1-
979  // 1 0 0 -1
980  // 0 1 1 0
981  // 0 1 1 0
982  // -1 0 0 1
983 
984  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,1,Y);
985  const int sp_idx = face_idx + param.ghostOffset[1];
986 #if (DD_PREC==2)
987  sp_norm_idx = face_idx + faceVolume[1] + param.ghostNormOffset[1];
988 #endif
989 
990  const int ga_idx = sid;
991 
998 
999 
1000  const int sp_stride_pad = ghostFace[1];
1001 
1002  // read half spinor from device memory
1003  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx + (SPINOR_HOP/2)*sp_stride_pad, sp_norm_idx);
1004 
1005  a0_re = i00_re; a0_im = i00_im;
1006  a1_re = i01_re; a1_im = i01_im;
1007  a2_re = i02_re; a2_im = i02_im;
1008  b0_re = i10_re; b0_im = i10_im;
1009  b1_re = i11_re; b1_im = i11_im;
1010  b2_re = i12_re; b2_im = i12_im;
1011 
1012  // read gauge matrix from device memory
1013  READ_GAUGE_MATRIX(G, GAUGE0TEX, 2, ga_idx, ga_stride);
1014 
1015  // reconstruct gauge matrix
1017 
1018  // multiply row 0
1019  spinorFloat A0_re = 0;
1020  A0_re += g00_re * a0_re;
1021  A0_re -= g00_im * a0_im;
1022  A0_re += g01_re * a1_re;
1023  A0_re -= g01_im * a1_im;
1024  A0_re += g02_re * a2_re;
1025  A0_re -= g02_im * a2_im;
1026  spinorFloat A0_im = 0;
1027  A0_im += g00_re * a0_im;
1028  A0_im += g00_im * a0_re;
1029  A0_im += g01_re * a1_im;
1030  A0_im += g01_im * a1_re;
1031  A0_im += g02_re * a2_im;
1032  A0_im += g02_im * a2_re;
1033  spinorFloat B0_re = 0;
1034  B0_re += g00_re * b0_re;
1035  B0_re -= g00_im * b0_im;
1036  B0_re += g01_re * b1_re;
1037  B0_re -= g01_im * b1_im;
1038  B0_re += g02_re * b2_re;
1039  B0_re -= g02_im * b2_im;
1040  spinorFloat B0_im = 0;
1041  B0_im += g00_re * b0_im;
1042  B0_im += g00_im * b0_re;
1043  B0_im += g01_re * b1_im;
1044  B0_im += g01_im * b1_re;
1045  B0_im += g02_re * b2_im;
1046  B0_im += g02_im * b2_re;
1047 
1048  // multiply row 1
1049  spinorFloat A1_re = 0;
1050  A1_re += g10_re * a0_re;
1051  A1_re -= g10_im * a0_im;
1052  A1_re += g11_re * a1_re;
1053  A1_re -= g11_im * a1_im;
1054  A1_re += g12_re * a2_re;
1055  A1_re -= g12_im * a2_im;
1056  spinorFloat A1_im = 0;
1057  A1_im += g10_re * a0_im;
1058  A1_im += g10_im * a0_re;
1059  A1_im += g11_re * a1_im;
1060  A1_im += g11_im * a1_re;
1061  A1_im += g12_re * a2_im;
1062  A1_im += g12_im * a2_re;
1063  spinorFloat B1_re = 0;
1064  B1_re += g10_re * b0_re;
1065  B1_re -= g10_im * b0_im;
1066  B1_re += g11_re * b1_re;
1067  B1_re -= g11_im * b1_im;
1068  B1_re += g12_re * b2_re;
1069  B1_re -= g12_im * b2_im;
1070  spinorFloat B1_im = 0;
1071  B1_im += g10_re * b0_im;
1072  B1_im += g10_im * b0_re;
1073  B1_im += g11_re * b1_im;
1074  B1_im += g11_im * b1_re;
1075  B1_im += g12_re * b2_im;
1076  B1_im += g12_im * b2_re;
1077 
1078  // multiply row 2
1079  spinorFloat A2_re = 0;
1080  A2_re += g20_re * a0_re;
1081  A2_re -= g20_im * a0_im;
1082  A2_re += g21_re * a1_re;
1083  A2_re -= g21_im * a1_im;
1084  A2_re += g22_re * a2_re;
1085  A2_re -= g22_im * a2_im;
1086  spinorFloat A2_im = 0;
1087  A2_im += g20_re * a0_im;
1088  A2_im += g20_im * a0_re;
1089  A2_im += g21_re * a1_im;
1090  A2_im += g21_im * a1_re;
1091  A2_im += g22_re * a2_im;
1092  A2_im += g22_im * a2_re;
1093  spinorFloat B2_re = 0;
1094  B2_re += g20_re * b0_re;
1095  B2_re -= g20_im * b0_im;
1096  B2_re += g21_re * b1_re;
1097  B2_re -= g21_im * b1_im;
1098  B2_re += g22_re * b2_re;
1099  B2_re -= g22_im * b2_im;
1100  spinorFloat B2_im = 0;
1101  B2_im += g20_re * b0_im;
1102  B2_im += g20_im * b0_re;
1103  B2_im += g21_re * b1_im;
1104  B2_im += g21_im * b1_re;
1105  B2_im += g22_re * b2_im;
1106  B2_im += g22_im * b2_re;
1107 
1108  o00_re += A0_re;
1109  o00_im += A0_im;
1110  o10_re += B0_re;
1111  o10_im += B0_im;
1112  o20_re += B0_re;
1113  o20_im += B0_im;
1114  o30_re -= A0_re;
1115  o30_im -= A0_im;
1116 
1117  o01_re += A1_re;
1118  o01_im += A1_im;
1119  o11_re += B1_re;
1120  o11_im += B1_im;
1121  o21_re += B1_re;
1122  o21_im += B1_im;
1123  o31_re -= A1_re;
1124  o31_im -= A1_im;
1125 
1126  o02_re += A2_re;
1127  o02_im += A2_im;
1128  o12_re += B2_re;
1129  o12_im += B2_im;
1130  o22_re += B2_re;
1131  o22_im += B2_im;
1132  o32_re -= A2_re;
1133  o32_im -= A2_im;
1134 
1135 }
1136 
1137 if (isActive(dim,1,-1,x1,x2,x3,x4,param.commDim,param.X) && x2==0 )
1138 {
1139  // Projector P1+
1140  // 1 0 0 1
1141  // 0 1 -1 0
1142  // 0 -1 1 0
1143  // 1 0 0 1
1144 
1145  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,1,Y);
1146  const int sp_idx = face_idx + param.ghostOffset[1];
1147 #if (DD_PREC==2)
1148  sp_norm_idx = face_idx + param.ghostNormOffset[1];
1149 #endif
1150 
1151  const int ga_idx = Vh+face_idx;
1152 
1159 
1160 
1161  const int sp_stride_pad = ghostFace[1];
1162 
1163  // read half spinor from device memory
1164  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx, sp_norm_idx);
1165 
1166  a0_re = i00_re; a0_im = i00_im;
1167  a1_re = i01_re; a1_im = i01_im;
1168  a2_re = i02_re; a2_im = i02_im;
1169  b0_re = i10_re; b0_im = i10_im;
1170  b1_re = i11_re; b1_im = i11_im;
1171  b2_re = i12_re; b2_im = i12_im;
1172 
1173  // read gauge matrix from device memory
1174  READ_GAUGE_MATRIX(G, GAUGE1TEX, 3, ga_idx, ga_stride);
1175 
1176  // reconstruct gauge matrix
1178 
1179  // multiply row 0
1180  spinorFloat A0_re = 0;
1181  A0_re += gT00_re * a0_re;
1182  A0_re -= gT00_im * a0_im;
1183  A0_re += gT01_re * a1_re;
1184  A0_re -= gT01_im * a1_im;
1185  A0_re += gT02_re * a2_re;
1186  A0_re -= gT02_im * a2_im;
1187  spinorFloat A0_im = 0;
1188  A0_im += gT00_re * a0_im;
1189  A0_im += gT00_im * a0_re;
1190  A0_im += gT01_re * a1_im;
1191  A0_im += gT01_im * a1_re;
1192  A0_im += gT02_re * a2_im;
1193  A0_im += gT02_im * a2_re;
1194  spinorFloat B0_re = 0;
1195  B0_re += gT00_re * b0_re;
1196  B0_re -= gT00_im * b0_im;
1197  B0_re += gT01_re * b1_re;
1198  B0_re -= gT01_im * b1_im;
1199  B0_re += gT02_re * b2_re;
1200  B0_re -= gT02_im * b2_im;
1201  spinorFloat B0_im = 0;
1202  B0_im += gT00_re * b0_im;
1203  B0_im += gT00_im * b0_re;
1204  B0_im += gT01_re * b1_im;
1205  B0_im += gT01_im * b1_re;
1206  B0_im += gT02_re * b2_im;
1207  B0_im += gT02_im * b2_re;
1208 
1209  // multiply row 1
1210  spinorFloat A1_re = 0;
1211  A1_re += gT10_re * a0_re;
1212  A1_re -= gT10_im * a0_im;
1213  A1_re += gT11_re * a1_re;
1214  A1_re -= gT11_im * a1_im;
1215  A1_re += gT12_re * a2_re;
1216  A1_re -= gT12_im * a2_im;
1217  spinorFloat A1_im = 0;
1218  A1_im += gT10_re * a0_im;
1219  A1_im += gT10_im * a0_re;
1220  A1_im += gT11_re * a1_im;
1221  A1_im += gT11_im * a1_re;
1222  A1_im += gT12_re * a2_im;
1223  A1_im += gT12_im * a2_re;
1224  spinorFloat B1_re = 0;
1225  B1_re += gT10_re * b0_re;
1226  B1_re -= gT10_im * b0_im;
1227  B1_re += gT11_re * b1_re;
1228  B1_re -= gT11_im * b1_im;
1229  B1_re += gT12_re * b2_re;
1230  B1_re -= gT12_im * b2_im;
1231  spinorFloat B1_im = 0;
1232  B1_im += gT10_re * b0_im;
1233  B1_im += gT10_im * b0_re;
1234  B1_im += gT11_re * b1_im;
1235  B1_im += gT11_im * b1_re;
1236  B1_im += gT12_re * b2_im;
1237  B1_im += gT12_im * b2_re;
1238 
1239  // multiply row 2
1240  spinorFloat A2_re = 0;
1241  A2_re += gT20_re * a0_re;
1242  A2_re -= gT20_im * a0_im;
1243  A2_re += gT21_re * a1_re;
1244  A2_re -= gT21_im * a1_im;
1245  A2_re += gT22_re * a2_re;
1246  A2_re -= gT22_im * a2_im;
1247  spinorFloat A2_im = 0;
1248  A2_im += gT20_re * a0_im;
1249  A2_im += gT20_im * a0_re;
1250  A2_im += gT21_re * a1_im;
1251  A2_im += gT21_im * a1_re;
1252  A2_im += gT22_re * a2_im;
1253  A2_im += gT22_im * a2_re;
1254  spinorFloat B2_re = 0;
1255  B2_re += gT20_re * b0_re;
1256  B2_re -= gT20_im * b0_im;
1257  B2_re += gT21_re * b1_re;
1258  B2_re -= gT21_im * b1_im;
1259  B2_re += gT22_re * b2_re;
1260  B2_re -= gT22_im * b2_im;
1261  spinorFloat B2_im = 0;
1262  B2_im += gT20_re * b0_im;
1263  B2_im += gT20_im * b0_re;
1264  B2_im += gT21_re * b1_im;
1265  B2_im += gT21_im * b1_re;
1266  B2_im += gT22_re * b2_im;
1267  B2_im += gT22_im * b2_re;
1268 
1269  o00_re += A0_re;
1270  o00_im += A0_im;
1271  o10_re += B0_re;
1272  o10_im += B0_im;
1273  o20_re -= B0_re;
1274  o20_im -= B0_im;
1275  o30_re += A0_re;
1276  o30_im += A0_im;
1277 
1278  o01_re += A1_re;
1279  o01_im += A1_im;
1280  o11_re += B1_re;
1281  o11_im += B1_im;
1282  o21_re -= B1_re;
1283  o21_im -= B1_im;
1284  o31_re += A1_re;
1285  o31_im += A1_im;
1286 
1287  o02_re += A2_re;
1288  o02_im += A2_im;
1289  o12_re += B2_re;
1290  o12_im += B2_im;
1291  o22_re -= B2_re;
1292  o22_im -= B2_im;
1293  o32_re += A2_re;
1294  o32_im += A2_im;
1295 
1296 }
1297 
1298 if (isActive(dim,2,+1,x1,x2,x3,x4,param.commDim,param.X) && x3==X3m1 )
1299 {
1300  // Projector P2-
1301  // 1 0 -i 0
1302  // 0 1 0 i
1303  // i 0 1 0
1304  // 0 -i 0 1
1305 
1306  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,2,Y);
1307  const int sp_idx = face_idx + param.ghostOffset[2];
1308 #if (DD_PREC==2)
1309  sp_norm_idx = face_idx + faceVolume[2] + param.ghostNormOffset[2];
1310 #endif
1311 
1312  const int ga_idx = sid;
1313 
1320 
1321 
1322  const int sp_stride_pad = ghostFace[2];
1323 
1324  // read half spinor from device memory
1325  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx + (SPINOR_HOP/2)*sp_stride_pad, sp_norm_idx);
1326 
1327  a0_re = i00_re; a0_im = i00_im;
1328  a1_re = i01_re; a1_im = i01_im;
1329  a2_re = i02_re; a2_im = i02_im;
1330  b0_re = i10_re; b0_im = i10_im;
1331  b1_re = i11_re; b1_im = i11_im;
1332  b2_re = i12_re; b2_im = i12_im;
1333 
1334  // read gauge matrix from device memory
1335  READ_GAUGE_MATRIX(G, GAUGE0TEX, 4, ga_idx, ga_stride);
1336 
1337  // reconstruct gauge matrix
1339 
1340  // multiply row 0
1341  spinorFloat A0_re = 0;
1342  A0_re += g00_re * a0_re;
1343  A0_re -= g00_im * a0_im;
1344  A0_re += g01_re * a1_re;
1345  A0_re -= g01_im * a1_im;
1346  A0_re += g02_re * a2_re;
1347  A0_re -= g02_im * a2_im;
1348  spinorFloat A0_im = 0;
1349  A0_im += g00_re * a0_im;
1350  A0_im += g00_im * a0_re;
1351  A0_im += g01_re * a1_im;
1352  A0_im += g01_im * a1_re;
1353  A0_im += g02_re * a2_im;
1354  A0_im += g02_im * a2_re;
1355  spinorFloat B0_re = 0;
1356  B0_re += g00_re * b0_re;
1357  B0_re -= g00_im * b0_im;
1358  B0_re += g01_re * b1_re;
1359  B0_re -= g01_im * b1_im;
1360  B0_re += g02_re * b2_re;
1361  B0_re -= g02_im * b2_im;
1362  spinorFloat B0_im = 0;
1363  B0_im += g00_re * b0_im;
1364  B0_im += g00_im * b0_re;
1365  B0_im += g01_re * b1_im;
1366  B0_im += g01_im * b1_re;
1367  B0_im += g02_re * b2_im;
1368  B0_im += g02_im * b2_re;
1369 
1370  // multiply row 1
1371  spinorFloat A1_re = 0;
1372  A1_re += g10_re * a0_re;
1373  A1_re -= g10_im * a0_im;
1374  A1_re += g11_re * a1_re;
1375  A1_re -= g11_im * a1_im;
1376  A1_re += g12_re * a2_re;
1377  A1_re -= g12_im * a2_im;
1378  spinorFloat A1_im = 0;
1379  A1_im += g10_re * a0_im;
1380  A1_im += g10_im * a0_re;
1381  A1_im += g11_re * a1_im;
1382  A1_im += g11_im * a1_re;
1383  A1_im += g12_re * a2_im;
1384  A1_im += g12_im * a2_re;
1385  spinorFloat B1_re = 0;
1386  B1_re += g10_re * b0_re;
1387  B1_re -= g10_im * b0_im;
1388  B1_re += g11_re * b1_re;
1389  B1_re -= g11_im * b1_im;
1390  B1_re += g12_re * b2_re;
1391  B1_re -= g12_im * b2_im;
1392  spinorFloat B1_im = 0;
1393  B1_im += g10_re * b0_im;
1394  B1_im += g10_im * b0_re;
1395  B1_im += g11_re * b1_im;
1396  B1_im += g11_im * b1_re;
1397  B1_im += g12_re * b2_im;
1398  B1_im += g12_im * b2_re;
1399 
1400  // multiply row 2
1401  spinorFloat A2_re = 0;
1402  A2_re += g20_re * a0_re;
1403  A2_re -= g20_im * a0_im;
1404  A2_re += g21_re * a1_re;
1405  A2_re -= g21_im * a1_im;
1406  A2_re += g22_re * a2_re;
1407  A2_re -= g22_im * a2_im;
1408  spinorFloat A2_im = 0;
1409  A2_im += g20_re * a0_im;
1410  A2_im += g20_im * a0_re;
1411  A2_im += g21_re * a1_im;
1412  A2_im += g21_im * a1_re;
1413  A2_im += g22_re * a2_im;
1414  A2_im += g22_im * a2_re;
1415  spinorFloat B2_re = 0;
1416  B2_re += g20_re * b0_re;
1417  B2_re -= g20_im * b0_im;
1418  B2_re += g21_re * b1_re;
1419  B2_re -= g21_im * b1_im;
1420  B2_re += g22_re * b2_re;
1421  B2_re -= g22_im * b2_im;
1422  spinorFloat B2_im = 0;
1423  B2_im += g20_re * b0_im;
1424  B2_im += g20_im * b0_re;
1425  B2_im += g21_re * b1_im;
1426  B2_im += g21_im * b1_re;
1427  B2_im += g22_re * b2_im;
1428  B2_im += g22_im * b2_re;
1429 
1430  o00_re += A0_re;
1431  o00_im += A0_im;
1432  o10_re += B0_re;
1433  o10_im += B0_im;
1434  o20_re -= A0_im;
1435  o20_im += A0_re;
1436  o30_re += B0_im;
1437  o30_im -= B0_re;
1438 
1439  o01_re += A1_re;
1440  o01_im += A1_im;
1441  o11_re += B1_re;
1442  o11_im += B1_im;
1443  o21_re -= A1_im;
1444  o21_im += A1_re;
1445  o31_re += B1_im;
1446  o31_im -= B1_re;
1447 
1448  o02_re += A2_re;
1449  o02_im += A2_im;
1450  o12_re += B2_re;
1451  o12_im += B2_im;
1452  o22_re -= A2_im;
1453  o22_im += A2_re;
1454  o32_re += B2_im;
1455  o32_im -= B2_re;
1456 
1457 }
1458 
1459 if (isActive(dim,2,-1,x1,x2,x3,x4,param.commDim,param.X) && x3==0 )
1460 {
1461  // Projector P2+
1462  // 1 0 i 0
1463  // 0 1 0 -i
1464  // -i 0 1 0
1465  // 0 i 0 1
1466 
1467  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,2,Y);
1468  const int sp_idx = face_idx + param.ghostOffset[2];
1469 #if (DD_PREC==2)
1470  sp_norm_idx = face_idx + param.ghostNormOffset[2];
1471 #endif
1472 
1473  const int ga_idx = Vh+face_idx;
1474 
1481 
1482 
1483  const int sp_stride_pad = ghostFace[2];
1484 
1485  // read half spinor from device memory
1486  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx, sp_norm_idx);
1487 
1488  a0_re = i00_re; a0_im = i00_im;
1489  a1_re = i01_re; a1_im = i01_im;
1490  a2_re = i02_re; a2_im = i02_im;
1491  b0_re = i10_re; b0_im = i10_im;
1492  b1_re = i11_re; b1_im = i11_im;
1493  b2_re = i12_re; b2_im = i12_im;
1494 
1495  // read gauge matrix from device memory
1496  READ_GAUGE_MATRIX(G, GAUGE1TEX, 5, ga_idx, ga_stride);
1497 
1498  // reconstruct gauge matrix
1500 
1501  // multiply row 0
1502  spinorFloat A0_re = 0;
1503  A0_re += gT00_re * a0_re;
1504  A0_re -= gT00_im * a0_im;
1505  A0_re += gT01_re * a1_re;
1506  A0_re -= gT01_im * a1_im;
1507  A0_re += gT02_re * a2_re;
1508  A0_re -= gT02_im * a2_im;
1509  spinorFloat A0_im = 0;
1510  A0_im += gT00_re * a0_im;
1511  A0_im += gT00_im * a0_re;
1512  A0_im += gT01_re * a1_im;
1513  A0_im += gT01_im * a1_re;
1514  A0_im += gT02_re * a2_im;
1515  A0_im += gT02_im * a2_re;
1516  spinorFloat B0_re = 0;
1517  B0_re += gT00_re * b0_re;
1518  B0_re -= gT00_im * b0_im;
1519  B0_re += gT01_re * b1_re;
1520  B0_re -= gT01_im * b1_im;
1521  B0_re += gT02_re * b2_re;
1522  B0_re -= gT02_im * b2_im;
1523  spinorFloat B0_im = 0;
1524  B0_im += gT00_re * b0_im;
1525  B0_im += gT00_im * b0_re;
1526  B0_im += gT01_re * b1_im;
1527  B0_im += gT01_im * b1_re;
1528  B0_im += gT02_re * b2_im;
1529  B0_im += gT02_im * b2_re;
1530 
1531  // multiply row 1
1532  spinorFloat A1_re = 0;
1533  A1_re += gT10_re * a0_re;
1534  A1_re -= gT10_im * a0_im;
1535  A1_re += gT11_re * a1_re;
1536  A1_re -= gT11_im * a1_im;
1537  A1_re += gT12_re * a2_re;
1538  A1_re -= gT12_im * a2_im;
1539  spinorFloat A1_im = 0;
1540  A1_im += gT10_re * a0_im;
1541  A1_im += gT10_im * a0_re;
1542  A1_im += gT11_re * a1_im;
1543  A1_im += gT11_im * a1_re;
1544  A1_im += gT12_re * a2_im;
1545  A1_im += gT12_im * a2_re;
1546  spinorFloat B1_re = 0;
1547  B1_re += gT10_re * b0_re;
1548  B1_re -= gT10_im * b0_im;
1549  B1_re += gT11_re * b1_re;
1550  B1_re -= gT11_im * b1_im;
1551  B1_re += gT12_re * b2_re;
1552  B1_re -= gT12_im * b2_im;
1553  spinorFloat B1_im = 0;
1554  B1_im += gT10_re * b0_im;
1555  B1_im += gT10_im * b0_re;
1556  B1_im += gT11_re * b1_im;
1557  B1_im += gT11_im * b1_re;
1558  B1_im += gT12_re * b2_im;
1559  B1_im += gT12_im * b2_re;
1560 
1561  // multiply row 2
1562  spinorFloat A2_re = 0;
1563  A2_re += gT20_re * a0_re;
1564  A2_re -= gT20_im * a0_im;
1565  A2_re += gT21_re * a1_re;
1566  A2_re -= gT21_im * a1_im;
1567  A2_re += gT22_re * a2_re;
1568  A2_re -= gT22_im * a2_im;
1569  spinorFloat A2_im = 0;
1570  A2_im += gT20_re * a0_im;
1571  A2_im += gT20_im * a0_re;
1572  A2_im += gT21_re * a1_im;
1573  A2_im += gT21_im * a1_re;
1574  A2_im += gT22_re * a2_im;
1575  A2_im += gT22_im * a2_re;
1576  spinorFloat B2_re = 0;
1577  B2_re += gT20_re * b0_re;
1578  B2_re -= gT20_im * b0_im;
1579  B2_re += gT21_re * b1_re;
1580  B2_re -= gT21_im * b1_im;
1581  B2_re += gT22_re * b2_re;
1582  B2_re -= gT22_im * b2_im;
1583  spinorFloat B2_im = 0;
1584  B2_im += gT20_re * b0_im;
1585  B2_im += gT20_im * b0_re;
1586  B2_im += gT21_re * b1_im;
1587  B2_im += gT21_im * b1_re;
1588  B2_im += gT22_re * b2_im;
1589  B2_im += gT22_im * b2_re;
1590 
1591  o00_re += A0_re;
1592  o00_im += A0_im;
1593  o10_re += B0_re;
1594  o10_im += B0_im;
1595  o20_re += A0_im;
1596  o20_im -= A0_re;
1597  o30_re -= B0_im;
1598  o30_im += B0_re;
1599 
1600  o01_re += A1_re;
1601  o01_im += A1_im;
1602  o11_re += B1_re;
1603  o11_im += B1_im;
1604  o21_re += A1_im;
1605  o21_im -= A1_re;
1606  o31_re -= B1_im;
1607  o31_im += B1_re;
1608 
1609  o02_re += A2_re;
1610  o02_im += A2_im;
1611  o12_re += B2_re;
1612  o12_im += B2_im;
1613  o22_re += A2_im;
1614  o22_im -= A2_re;
1615  o32_re -= B2_im;
1616  o32_im += B2_re;
1617 
1618 }
1619 
1620 if (isActive(dim,3,+1,x1,x2,x3,x4,param.commDim,param.X) && x4==X4m1 )
1621 {
1622  // Projector P3-
1623  // 0 0 0 0
1624  // 0 0 0 0
1625  // 0 0 2 0
1626  // 0 0 0 2
1627 
1628  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,3,Y);
1629  const int sp_idx = face_idx + param.ghostOffset[3];
1630 #if (DD_PREC==2)
1631  sp_norm_idx = face_idx + faceVolume[3] + param.ghostNormOffset[3];
1632 #endif
1633 
1634  const int ga_idx = sid;
1635 
1636  if (gauge_fixed && ga_idx < X4X3X2X1hmX3X2X1h)
1637  {
1644 
1645 
1646  const int sp_stride_pad = ghostFace[3];
1647  //const int t_proj_scale = TPROJSCALE;
1648 
1649  // read half spinor from device memory
1650  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx + (SPINOR_HOP/2)*sp_stride_pad, sp_norm_idx);
1651 
1652 #ifdef CLOVER_TWIST_INV_DSLASH
1653  a0_re = i00_re; a0_im = i00_im;
1654  a1_re = i01_re; a1_im = i01_im;
1655  a2_re = i02_re; a2_im = i02_im;
1656  b0_re = i10_re; b0_im = i10_im;
1657  b1_re = i11_re; b1_im = i11_im;
1658  b2_re = i12_re; b2_im = i12_im;
1659 #else
1660  a0_re = 2*i00_re; a0_im = 2*i00_im;
1661  a1_re = 2*i01_re; a1_im = 2*i01_im;
1662  a2_re = 2*i02_re; a2_im = 2*i02_im;
1663  b0_re = 2*i10_re; b0_im = 2*i10_im;
1664  b1_re = 2*i11_re; b1_im = 2*i11_im;
1665  b2_re = 2*i12_re; b2_im = 2*i12_im;
1666 #endif
1667 
1668  // identity gauge matrix
1675 
1676  o20_re += A0_re;
1677  o20_im += A0_im;
1678  o30_re += B0_re;
1679  o30_im += B0_im;
1680 
1681  o21_re += A1_re;
1682  o21_im += A1_im;
1683  o31_re += B1_re;
1684  o31_im += B1_im;
1685 
1686  o22_re += A2_re;
1687  o22_im += A2_im;
1688  o32_re += B2_re;
1689  o32_im += B2_im;
1690 
1691  } else {
1698 
1699 
1700  const int sp_stride_pad = ghostFace[3];
1701  //const int t_proj_scale = TPROJSCALE;
1702 
1703  // read half spinor from device memory
1704  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx + (SPINOR_HOP/2)*sp_stride_pad, sp_norm_idx);
1705 
1706 #ifdef CLOVER_TWIST_INV_DSLASH
1707  a0_re = i00_re; a0_im = i00_im;
1708  a1_re = i01_re; a1_im = i01_im;
1709  a2_re = i02_re; a2_im = i02_im;
1710  b0_re = i10_re; b0_im = i10_im;
1711  b1_re = i11_re; b1_im = i11_im;
1712  b2_re = i12_re; b2_im = i12_im;
1713 #else
1714  a0_re = 2*i00_re; a0_im = 2*i00_im;
1715  a1_re = 2*i01_re; a1_im = 2*i01_im;
1716  a2_re = 2*i02_re; a2_im = 2*i02_im;
1717  b0_re = 2*i10_re; b0_im = 2*i10_im;
1718  b1_re = 2*i11_re; b1_im = 2*i11_im;
1719  b2_re = 2*i12_re; b2_im = 2*i12_im;
1720 #endif
1721 
1722  // read gauge matrix from device memory
1723  READ_GAUGE_MATRIX(G, GAUGE0TEX, 6, ga_idx, ga_stride);
1724 
1725  // reconstruct gauge matrix
1727 
1728  // multiply row 0
1729  spinorFloat A0_re = 0;
1730  A0_re += g00_re * a0_re;
1731  A0_re -= g00_im * a0_im;
1732  A0_re += g01_re * a1_re;
1733  A0_re -= g01_im * a1_im;
1734  A0_re += g02_re * a2_re;
1735  A0_re -= g02_im * a2_im;
1736  spinorFloat A0_im = 0;
1737  A0_im += g00_re * a0_im;
1738  A0_im += g00_im * a0_re;
1739  A0_im += g01_re * a1_im;
1740  A0_im += g01_im * a1_re;
1741  A0_im += g02_re * a2_im;
1742  A0_im += g02_im * a2_re;
1743  spinorFloat B0_re = 0;
1744  B0_re += g00_re * b0_re;
1745  B0_re -= g00_im * b0_im;
1746  B0_re += g01_re * b1_re;
1747  B0_re -= g01_im * b1_im;
1748  B0_re += g02_re * b2_re;
1749  B0_re -= g02_im * b2_im;
1750  spinorFloat B0_im = 0;
1751  B0_im += g00_re * b0_im;
1752  B0_im += g00_im * b0_re;
1753  B0_im += g01_re * b1_im;
1754  B0_im += g01_im * b1_re;
1755  B0_im += g02_re * b2_im;
1756  B0_im += g02_im * b2_re;
1757 
1758  // multiply row 1
1759  spinorFloat A1_re = 0;
1760  A1_re += g10_re * a0_re;
1761  A1_re -= g10_im * a0_im;
1762  A1_re += g11_re * a1_re;
1763  A1_re -= g11_im * a1_im;
1764  A1_re += g12_re * a2_re;
1765  A1_re -= g12_im * a2_im;
1766  spinorFloat A1_im = 0;
1767  A1_im += g10_re * a0_im;
1768  A1_im += g10_im * a0_re;
1769  A1_im += g11_re * a1_im;
1770  A1_im += g11_im * a1_re;
1771  A1_im += g12_re * a2_im;
1772  A1_im += g12_im * a2_re;
1773  spinorFloat B1_re = 0;
1774  B1_re += g10_re * b0_re;
1775  B1_re -= g10_im * b0_im;
1776  B1_re += g11_re * b1_re;
1777  B1_re -= g11_im * b1_im;
1778  B1_re += g12_re * b2_re;
1779  B1_re -= g12_im * b2_im;
1780  spinorFloat B1_im = 0;
1781  B1_im += g10_re * b0_im;
1782  B1_im += g10_im * b0_re;
1783  B1_im += g11_re * b1_im;
1784  B1_im += g11_im * b1_re;
1785  B1_im += g12_re * b2_im;
1786  B1_im += g12_im * b2_re;
1787 
1788  // multiply row 2
1789  spinorFloat A2_re = 0;
1790  A2_re += g20_re * a0_re;
1791  A2_re -= g20_im * a0_im;
1792  A2_re += g21_re * a1_re;
1793  A2_re -= g21_im * a1_im;
1794  A2_re += g22_re * a2_re;
1795  A2_re -= g22_im * a2_im;
1796  spinorFloat A2_im = 0;
1797  A2_im += g20_re * a0_im;
1798  A2_im += g20_im * a0_re;
1799  A2_im += g21_re * a1_im;
1800  A2_im += g21_im * a1_re;
1801  A2_im += g22_re * a2_im;
1802  A2_im += g22_im * a2_re;
1803  spinorFloat B2_re = 0;
1804  B2_re += g20_re * b0_re;
1805  B2_re -= g20_im * b0_im;
1806  B2_re += g21_re * b1_re;
1807  B2_re -= g21_im * b1_im;
1808  B2_re += g22_re * b2_re;
1809  B2_re -= g22_im * b2_im;
1810  spinorFloat B2_im = 0;
1811  B2_im += g20_re * b0_im;
1812  B2_im += g20_im * b0_re;
1813  B2_im += g21_re * b1_im;
1814  B2_im += g21_im * b1_re;
1815  B2_im += g22_re * b2_im;
1816  B2_im += g22_im * b2_re;
1817 
1818  o20_re += A0_re;
1819  o20_im += A0_im;
1820  o30_re += B0_re;
1821  o30_im += B0_im;
1822 
1823  o21_re += A1_re;
1824  o21_im += A1_im;
1825  o31_re += B1_re;
1826  o31_im += B1_im;
1827 
1828  o22_re += A2_re;
1829  o22_im += A2_im;
1830  o32_re += B2_re;
1831  o32_im += B2_im;
1832 
1833  }
1834 }
1835 
1836 if (isActive(dim,3,-1,x1,x2,x3,x4,param.commDim,param.X) && x4==0 )
1837 {
1838  // Projector P3+
1839  // 2 0 0 0
1840  // 0 2 0 0
1841  // 0 0 0 0
1842  // 0 0 0 0
1843 
1844  faceIndexFromCoords<1>(face_idx,x1,x2,x3,x4,3,Y);
1845  const int sp_idx = face_idx + param.ghostOffset[3];
1846 #if (DD_PREC==2)
1847  sp_norm_idx = face_idx + param.ghostNormOffset[3];
1848 #endif
1849 
1850  const int ga_idx = Vh+face_idx;
1851 
1852  if (gauge_fixed && ga_idx < X4X3X2X1hmX3X2X1h)
1853  {
1860 
1861 
1862  const int sp_stride_pad = ghostFace[3];
1863  //const int t_proj_scale = TPROJSCALE;
1864 
1865  // read half spinor from device memory
1866  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx, sp_norm_idx);
1867 
1868 #ifdef CLOVER_TWIST_INV_DSLASH
1869  a0_re = i00_re; a0_im = i00_im;
1870  a1_re = i01_re; a1_im = i01_im;
1871  a2_re = i02_re; a2_im = i02_im;
1872  b0_re = i10_re; b0_im = i10_im;
1873  b1_re = i11_re; b1_im = i11_im;
1874  b2_re = i12_re; b2_im = i12_im;
1875 #else
1876  a0_re = 2*i00_re; a0_im = 2*i00_im;
1877  a1_re = 2*i01_re; a1_im = 2*i01_im;
1878  a2_re = 2*i02_re; a2_im = 2*i02_im;
1879  b0_re = 2*i10_re; b0_im = 2*i10_im;
1880  b1_re = 2*i11_re; b1_im = 2*i11_im;
1881  b2_re = 2*i12_re; b2_im = 2*i12_im;
1882 #endif
1883 
1884  // identity gauge matrix
1891 
1892  o00_re += A0_re;
1893  o00_im += A0_im;
1894  o10_re += B0_re;
1895  o10_im += B0_im;
1896 
1897  o01_re += A1_re;
1898  o01_im += A1_im;
1899  o11_re += B1_re;
1900  o11_im += B1_im;
1901 
1902  o02_re += A2_re;
1903  o02_im += A2_im;
1904  o12_re += B2_re;
1905  o12_im += B2_im;
1906 
1907  } else {
1914 
1915 
1916  const int sp_stride_pad = ghostFace[3];
1917  //const int t_proj_scale = TPROJSCALE;
1918 
1919  // read half spinor from device memory
1920  READ_HALF_SPINOR(SPINORTEX, sp_stride_pad, sp_idx, sp_norm_idx);
1921 
1922 #ifdef CLOVER_TWIST_INV_DSLASH
1923  a0_re = i00_re; a0_im = i00_im;
1924  a1_re = i01_re; a1_im = i01_im;
1925  a2_re = i02_re; a2_im = i02_im;
1926  b0_re = i10_re; b0_im = i10_im;
1927  b1_re = i11_re; b1_im = i11_im;
1928  b2_re = i12_re; b2_im = i12_im;
1929 #else
1930  a0_re = 2*i00_re; a0_im = 2*i00_im;
1931  a1_re = 2*i01_re; a1_im = 2*i01_im;
1932  a2_re = 2*i02_re; a2_im = 2*i02_im;
1933  b0_re = 2*i10_re; b0_im = 2*i10_im;
1934  b1_re = 2*i11_re; b1_im = 2*i11_im;
1935  b2_re = 2*i12_re; b2_im = 2*i12_im;
1936 #endif
1937 
1938  // read gauge matrix from device memory
1939  READ_GAUGE_MATRIX(G, GAUGE1TEX, 7, ga_idx, ga_stride);
1940 
1941  // reconstruct gauge matrix
1943 
1944  // multiply row 0
1945  spinorFloat A0_re = 0;
1946  A0_re += gT00_re * a0_re;
1947  A0_re -= gT00_im * a0_im;
1948  A0_re += gT01_re * a1_re;
1949  A0_re -= gT01_im * a1_im;
1950  A0_re += gT02_re * a2_re;
1951  A0_re -= gT02_im * a2_im;
1952  spinorFloat A0_im = 0;
1953  A0_im += gT00_re * a0_im;
1954  A0_im += gT00_im * a0_re;
1955  A0_im += gT01_re * a1_im;
1956  A0_im += gT01_im * a1_re;
1957  A0_im += gT02_re * a2_im;
1958  A0_im += gT02_im * a2_re;
1959  spinorFloat B0_re = 0;
1960  B0_re += gT00_re * b0_re;
1961  B0_re -= gT00_im * b0_im;
1962  B0_re += gT01_re * b1_re;
1963  B0_re -= gT01_im * b1_im;
1964  B0_re += gT02_re * b2_re;
1965  B0_re -= gT02_im * b2_im;
1966  spinorFloat B0_im = 0;
1967  B0_im += gT00_re * b0_im;
1968  B0_im += gT00_im * b0_re;
1969  B0_im += gT01_re * b1_im;
1970  B0_im += gT01_im * b1_re;
1971  B0_im += gT02_re * b2_im;
1972  B0_im += gT02_im * b2_re;
1973 
1974  // multiply row 1
1975  spinorFloat A1_re = 0;
1976  A1_re += gT10_re * a0_re;
1977  A1_re -= gT10_im * a0_im;
1978  A1_re += gT11_re * a1_re;
1979  A1_re -= gT11_im * a1_im;
1980  A1_re += gT12_re * a2_re;
1981  A1_re -= gT12_im * a2_im;
1982  spinorFloat A1_im = 0;
1983  A1_im += gT10_re * a0_im;
1984  A1_im += gT10_im * a0_re;
1985  A1_im += gT11_re * a1_im;
1986  A1_im += gT11_im * a1_re;
1987  A1_im += gT12_re * a2_im;
1988  A1_im += gT12_im * a2_re;
1989  spinorFloat B1_re = 0;
1990  B1_re += gT10_re * b0_re;
1991  B1_re -= gT10_im * b0_im;
1992  B1_re += gT11_re * b1_re;
1993  B1_re -= gT11_im * b1_im;
1994  B1_re += gT12_re * b2_re;
1995  B1_re -= gT12_im * b2_im;
1996  spinorFloat B1_im = 0;
1997  B1_im += gT10_re * b0_im;
1998  B1_im += gT10_im * b0_re;
1999  B1_im += gT11_re * b1_im;
2000  B1_im += gT11_im * b1_re;
2001  B1_im += gT12_re * b2_im;
2002  B1_im += gT12_im * b2_re;
2003 
2004  // multiply row 2
2005  spinorFloat A2_re = 0;
2006  A2_re += gT20_re * a0_re;
2007  A2_re -= gT20_im * a0_im;
2008  A2_re += gT21_re * a1_re;
2009  A2_re -= gT21_im * a1_im;
2010  A2_re += gT22_re * a2_re;
2011  A2_re -= gT22_im * a2_im;
2012  spinorFloat A2_im = 0;
2013  A2_im += gT20_re * a0_im;
2014  A2_im += gT20_im * a0_re;
2015  A2_im += gT21_re * a1_im;
2016  A2_im += gT21_im * a1_re;
2017  A2_im += gT22_re * a2_im;
2018  A2_im += gT22_im * a2_re;
2019  spinorFloat B2_re = 0;
2020  B2_re += gT20_re * b0_re;
2021  B2_re -= gT20_im * b0_im;
2022  B2_re += gT21_re * b1_re;
2023  B2_re -= gT21_im * b1_im;
2024  B2_re += gT22_re * b2_re;
2025  B2_re -= gT22_im * b2_im;
2026  spinorFloat B2_im = 0;
2027  B2_im += gT20_re * b0_im;
2028  B2_im += gT20_im * b0_re;
2029  B2_im += gT21_re * b1_im;
2030  B2_im += gT21_im * b1_re;
2031  B2_im += gT22_re * b2_im;
2032  B2_im += gT22_im * b2_re;
2033 
2034  o00_re += A0_re;
2035  o00_im += A0_im;
2036  o10_re += B0_re;
2037  o10_im += B0_im;
2038 
2039  o01_re += A1_re;
2040  o01_im += A1_im;
2041  o11_re += B1_re;
2042  o11_im += B1_im;
2043 
2044  o02_re += A2_re;
2045  o02_im += A2_im;
2046  o12_re += B2_re;
2047  o12_im += B2_im;
2048 
2049  }
2050 }
2051 
2052 {
2053 #ifdef DSLASH_XPAY
2054  READ_ACCUM(ACCUMTEX, param.sp_stride)
2055 
2056 #ifndef CLOVER_TWIST_XPAY
2057  //perform invert twist first:
2058  APPLY_CLOVER_TWIST_INV(c, cinv, a, o);
2059  o00_re = b*o00_re + acc00_re;
2060  o00_im = b*o00_im + acc00_im;
2061  o01_re = b*o01_re + acc01_re;
2062  o01_im = b*o01_im + acc01_im;
2063  o02_re = b*o02_re + acc02_re;
2064  o02_im = b*o02_im + acc02_im;
2065  o10_re = b*o10_re + acc10_re;
2066  o10_im = b*o10_im + acc10_im;
2067  o11_re = b*o11_re + acc11_re;
2068  o11_im = b*o11_im + acc11_im;
2069  o12_re = b*o12_re + acc12_re;
2070  o12_im = b*o12_im + acc12_im;
2071  o20_re = b*o20_re + acc20_re;
2072  o20_im = b*o20_im + acc20_im;
2073  o21_re = b*o21_re + acc21_re;
2074  o21_im = b*o21_im + acc21_im;
2075  o22_re = b*o22_re + acc22_re;
2076  o22_im = b*o22_im + acc22_im;
2077  o30_re = b*o30_re + acc30_re;
2078  o30_im = b*o30_im + acc30_im;
2079  o31_re = b*o31_re + acc31_re;
2080  o31_im = b*o31_im + acc31_im;
2081  o32_re = b*o32_re + acc32_re;
2082  o32_im = b*o32_im + acc32_im;
2083 #else
2084  APPLY_CLOVER_TWIST(c, a, acc);
2085  o00_re = b*o00_re + acc00_re;
2086  o00_im = b*o00_im + acc00_im;
2087  o01_re = b*o01_re + acc01_re;
2088  o01_im = b*o01_im + acc01_im;
2089  o02_re = b*o02_re + acc02_re;
2090  o02_im = b*o02_im + acc02_im;
2091  o10_re = b*o10_re + acc10_re;
2092  o10_im = b*o10_im + acc10_im;
2093  o11_re = b*o11_re + acc11_re;
2094  o11_im = b*o11_im + acc11_im;
2095  o12_re = b*o12_re + acc12_re;
2096  o12_im = b*o12_im + acc12_im;
2097  o20_re = b*o20_re + acc20_re;
2098  o20_im = b*o20_im + acc20_im;
2099  o21_re = b*o21_re + acc21_re;
2100  o21_im = b*o21_im + acc21_im;
2101  o22_re = b*o22_re + acc22_re;
2102  o22_im = b*o22_im + acc22_im;
2103  o30_re = b*o30_re + acc30_re;
2104  o30_im = b*o30_im + acc30_im;
2105  o31_re = b*o31_re + acc31_re;
2106  o31_im = b*o31_im + acc31_im;
2107  o32_re = b*o32_re + acc32_re;
2108  o32_im = b*o32_im + acc32_im;
2109 #endif//CLOVER_TWIST_XPAY
2110 #else //no XPAY
2111  APPLY_CLOVER_TWIST_INV(c, cinv, a, o);
2112 #endif
2113 }
2114 
2115 // write spinor field back to device memory
2116 WRITE_SPINOR(param.sp_stride);
2117 
2118 // undefine to prevent warning when precision is changed
2119 #undef spinorFloat
2120 #undef g00_re
2121 #undef g00_im
2122 #undef g01_re
2123 #undef g01_im
2124 #undef g02_re
2125 #undef g02_im
2126 #undef g10_re
2127 #undef g10_im
2128 #undef g11_re
2129 #undef g11_im
2130 #undef g12_re
2131 #undef g12_im
2132 #undef g20_re
2133 #undef g20_im
2134 #undef g21_re
2135 #undef g21_im
2136 #undef g22_re
2137 #undef g22_im
2138 
2139 #undef i00_re
2140 #undef i00_im
2141 #undef i01_re
2142 #undef i01_im
2143 #undef i02_re
2144 #undef i02_im
2145 #undef i10_re
2146 #undef i10_im
2147 #undef i11_re
2148 #undef i11_im
2149 #undef i12_re
2150 #undef i12_im
2151 #undef i20_re
2152 #undef i20_im
2153 #undef i21_re
2154 #undef i21_im
2155 #undef i22_re
2156 #undef i22_im
2157 #undef i30_re
2158 #undef i30_im
2159 #undef i31_re
2160 #undef i31_im
2161 #undef i32_re
2162 #undef i32_im
2163 
2164 #undef acc00_re
2165 #undef acc00_im
2166 #undef acc01_re
2167 #undef acc01_im
2168 #undef acc02_re
2169 #undef acc02_im
2170 #undef acc10_re
2171 #undef acc10_im
2172 #undef acc11_re
2173 #undef acc11_im
2174 #undef acc12_re
2175 #undef acc12_im
2176 #undef acc20_re
2177 #undef acc20_im
2178 #undef acc21_re
2179 #undef acc21_im
2180 #undef acc22_re
2181 #undef acc22_im
2182 #undef acc30_re
2183 #undef acc30_im
2184 #undef acc31_re
2185 #undef acc31_im
2186 #undef acc32_re
2187 #undef acc32_im
2188 
2189 
2190 
2191 #undef c00_00_re
2192 #undef c01_01_re
2193 #undef c02_02_re
2194 #undef c10_10_re
2195 #undef c11_11_re
2196 #undef c12_12_re
2197 #undef c01_00_re
2198 #undef c01_00_im
2199 #undef c02_00_re
2200 #undef c02_00_im
2201 #undef c10_00_re
2202 #undef c10_00_im
2203 #undef c11_00_re
2204 #undef c11_00_im
2205 #undef c12_00_re
2206 #undef c12_00_im
2207 #undef c02_01_re
2208 #undef c02_01_im
2209 #undef c10_01_re
2210 #undef c10_01_im
2211 #undef c11_01_re
2212 #undef c11_01_im
2213 #undef c12_01_re
2214 #undef c12_01_im
2215 #undef c10_02_re
2216 #undef c10_02_im
2217 #undef c11_02_re
2218 #undef c11_02_im
2219 #undef c12_02_re
2220 #undef c12_02_im
2221 #undef c11_10_re
2222 #undef c11_10_im
2223 #undef c12_10_re
2224 #undef c12_10_im
2225 #undef c12_11_re
2226 #undef c12_11_im
2227 
2228 #undef cinv00_00_re
2229 #undef cinv01_01_re
2230 #undef cinv02_02_re
2231 #undef cinv10_10_re
2232 #undef cinv11_11_re
2233 #undef cinv12_12_re
2234 #undef cinv01_00_re
2235 #undef cinv01_00_im
2236 #undef cinv02_00_re
2237 #undef cinv02_00_im
2238 #undef cinv10_00_re
2239 #undef cinv10_00_im
2240 #undef cinv11_00_re
2241 #undef cinv11_00_im
2242 #undef cinv12_00_re
2243 #undef cinv12_00_im
2244 #undef cinv02_01_re
2245 #undef cinv02_01_im
2246 #undef cinv10_01_re
2247 #undef cinv10_01_im
2248 #undef cinv11_01_re
2249 #undef cinv11_01_im
2250 #undef cinv12_01_re
2251 #undef cinv12_01_im
2252 #undef cinv10_02_re
2253 #undef cinv10_02_im
2254 #undef cinv11_02_re
2255 #undef cinv11_02_im
2256 #undef cinv12_02_re
2257 #undef cinv12_02_im
2258 #undef cinv11_10_re
2259 #undef cinv11_10_im
2260 #undef cinv12_10_re
2261 #undef cinv12_10_im
2262 #undef cinv12_11_re
2263 #undef cinv12_11_im
2264 
2265 #undef VOLATILE
2266 
2267 #endif // MULTI_GPU
__constant__ int Vh
#define APPLY_CLOVER_TWIST(c, a, reg)
Definition: tmc_core.h:1
__constant__ int X2
#define o32_im
Definition: gamma5.h:295
__constant__ int X1
#define READ_INTERMEDIATE_SPINOR
Definition: covDev.h:144
int sp_idx
#define o31_im
Definition: gamma5.h:293
QudaGaugeParam param
Definition: pack_test.cpp:17
__constant__ int ghostFace[QUDA_MAX_DIM+1]
#define RECONSTRUCT_GAUGE_MATRIX
Definition: covDev.h:39
#define APPLY_CLOVER_TWIST_INV(c, cinv, a, reg)
Definition: tmc_core.h:432
#define GAUGE0TEX
Definition: covDev.h:112
#define o30_im
Definition: gamma5.h:291
__constant__ int X2m1
#define SPINORTEX
Definition: clover_def.h:40
#define o32_re
Definition: gamma5.h:294
int X[4]
Definition: quda.h:29
__constant__ int gauge_fixed
#define o31_re
Definition: gamma5.h:292
#define SPINOR_HOP
Definition: covDev.h:158
__constant__ int ga_stride
__constant__ int X1m1
__constant__ int X3
#define GAUGE1TEX
Definition: covDev.h:113
#define READ_GAUGE_MATRIX
Definition: covDev.h:44
__constant__ int X4m1
#define WRITE_SPINOR
Definition: clover_def.h:48
#define READ_HALF_SPINOR
Definition: io_spinor.h:390
#define INTERTEX
Definition: covDev.h:149
__constant__ int X4X3X2X1hmX3X2X1h
__constant__ int X4
__constant__ int X3m1