forked from JeffersonLab/qphix-codegen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
data_types.h
87 lines (79 loc) · 3.57 KB
/
data_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef _DATA_TYPES_H_
#define _DATA_TYPES_H_
#include "instructions.h"
#if PRECISION == 1
#define FPTYPE float
#define LPTYPE short
#elif PRECISION == 2
#define FPTYPE double
#define LPTYPE float
#else
#error "Invalid FP PRECISION"
#endif
#ifndef USE_LP_SPINOR
typedef FPTYPE SpinorBaseType;
#define SpinorType 0
#else
typedef LPTYPE SpinorBaseType;
#define SpinorType 1
#endif
#ifndef USE_LP_GAUGE
typedef FPTYPE GaugeBaseType;
#define GaugeType 0
#else
typedef LPTYPE GaugeBaseType;
#define GaugeType 1
#endif
#ifndef USE_LP_CLOVER
typedef FPTYPE CloverBaseType;
#define CloverType 0
#else
typedef LPTYPE CloverBaseType;
#define CloverType 1
#endif
template<typename FT, int VL, int SL, bool compress12>
class data_types
{
public:
typedef FT Spinor[4][3][2][SL];
#ifdef USE_PACKED_GAUGES
typedef FT Gauge[8][(compress12? 2 : 3)][3][2][VL];
#else
typedef FT Gauge[8][(compress12? 2 : 3)][3][2][SL];
#endif
#ifdef USE_PACKED_CLOVER
typedef struct {
FT diag1[6][VL];
FT off_diag1[15][2][VL];
FT diag2[6][VL];
FT off_diag2[15][2][VL];
} Clover;
#else
typedef struct {
FT diag1[6][SL];
FT off_diag1[15][2][SL];
FT diag2[6][SL];
FT off_diag2[15][2][SL];
} Clover;
#endif
};
void LoadSpinorElement(InstVector& ivector, const FVec& ret, string& base, string& offsets, int spin, int col, int reim, bool isFace, string mask, int dir = -1);
void LoadFullSpinor(InstVector& ivector, const FVec ret[4][3][2], string& base, string& offsets, string mask);
void StoreFullSpinor(InstVector& ivector, const FVec ret[4][3][2], string& base, string& offsets, int isStreaming = 0);
void StreamFullSpinor(InstVector& ivector, const FVec ret[4][3][2], string& base, string& offsets);
void PackHalfSpinor(InstVector& ivector, const FVec ret[2][3][2], string& base, int dir, string mask);
void UnpackHalfSpinor(InstVector& ivector, const FVec ret[2][3][2], string& base, int dir, string mask="");
void LoadFullGaugeDir(InstVector& ivector, const FVec ret[3][3][2], string& base, string& offsets, int dir, bool compress12);
void LoadFullCloverBlock(InstVector& ivector, const FVec diag[6], const FVec off_diag[15][2], string& base, string& offsets, int block);
void PrefetchL1FullSpinorDirIn(InstVector& ivector, const string& base, const string& off, int dir = -1, int type = 0);
void PrefetchL1FullSpinorOut(InstVector& ivector, const string& base, const string& off);
void PrefetchL2FullSpinorDirIn(InstVector& ivector, const string& base, const string& off, const string& pref_dist, int dir=-1);
void PrefetchL2FullSpinorOut(InstVector& ivector, const string& base, const string& off, const string& pref_dist);
void PrefetchL1FullGaugeDirIn(InstVector& ivector, const string& base, const string& off, int dir, bool compress12);
void PrefetchL2FullGaugeDirIn(InstVector& ivector, const string& base, const string& off, int dir, const string& pref_dist, bool compress12);
void PrefetchL2FullGaugeIn(InstVector& ivector, const string& base, const string& off, const string& pref_dist, bool compress12);
void PrefetchL1FullCloverBlockIn(InstVector& ivector, const string& base, const string& off, int block);
void PrefetchL2FullCloverIn(InstVector& ivector, const string& base, const string& off, const string& pref_dist);
void PrefetchL1HalfSpinorDir(InstVector& ivector, const string& base, int dir, bool isPrefforWrite, int type);
void PrefetchL2HalfSpinorDir(InstVector& ivector, const string& base, const string& pref_dist, int dir, bool isPrefforWrite, int type);
#endif // _DATA_TYPES_H_