-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprefetch64.c
231 lines (167 loc) · 4.95 KB
/
prefetch64.c
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/******************** prefetch64.c ***************************************
* *
* Cache manipulation - C version for including in prefetch.c *
* C. DeTar 9/29/01 *
* This is the vanilla version for use when there is no assembly code *
* Note: Some compilers will not do these null fetches *
* I have had some success with the -g compiler option *
* If that doesn't work, you may have to get the compiler-generated *
* assembly code and edit by hand *
* *
* This version assumes 8 byte alignment and 64 byte cache line *
* *
*/
/* Rule for fetching datum of size "size" starting at address "addr" *
* with alignment "align" and cache line "cache" *
* Fetch addr, addr + cache, ... ,addr + size - align */
#include "../include/config.h"
#include "../include/complex.h"
#include "../include/su3.h"
#include "../include/prefetch.h"
/* 16 Floats in cache line */
/* 2 Floats per alignment boundary */
/* su3_matrix 18 Reals */
#define _pftch_M(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 16 );
/* su3_vector 6 Reals */
#define _pftch_V(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 4 );
/* half_wilson_vector 12 Reals */
#define _pftch_H(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 10 );
/* wilson_vector 24 Reals */
#define _pftch_W(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 16 ); \
dummy = *((Real *)(a) + 22 );
/* 4*su3_vector 24 Reals */
#define _pftch_4V(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 16 ); \
dummy = *((Real *)(a) + 22 );
/* 4*su3_matrix 72 Reals */
#define _pftch_4M(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 16 ); \
dummy = *((Real *)(a) + 32 ); \
dummy = *((Real *)(a) + 48 ); \
dummy = *((Real *)(a) + 64 ); \
dummy = *((Real *)(a) + 70 );
/* 4*wilson_vector 96 Reals */
#define _pftch_4W(a) \
dummy = *((Real *)(a) ); \
dummy = *((Real *)(a) + 16 ); \
dummy = *((Real *)(a) + 32 ); \
dummy = *((Real *)(a) + 48 ); \
dummy = *((Real *)(a) + 64 ); \
dummy = *((Real *)(a) + 80 ); \
dummy = *((Real *)(a) + 94 );
/***********************************************************************/
void _prefetch_M( su3_matrix *a0 ){
register Real dummy;
_pftch_M(a0);
}
void _prefetch_V( su3_vector *a0 ){
register Real dummy;
_pftch_V(a0);
}
void _prefetch_W( wilson_vector *a0 ){
register Real dummy;
_pftch_W(a0);
}
void _prefetch_H( half_wilson_vector *a0 ){
register Real dummy;
_pftch_H(a0);
}
void _prefetch_VV( su3_vector *a0, su3_vector *a1){
register Real dummy;
_pftch_V(a0);
_pftch_V(a1);
}
void _prefetch_VVV( su3_vector *a0, su3_vector *a1, su3_vector *a2){
register Real dummy;
_pftch_V(a0);
_pftch_V(a1);
_pftch_V(a2);
}
void _prefetch_VVVV( su3_vector *a0, su3_vector *a1, su3_vector *a2,
su3_vector *a3){
register Real dummy;
_pftch_V(a0);
_pftch_V(a1);
_pftch_V(a2);
_pftch_V(a3);
}
void _prefetch_VVVVV( su3_vector *a0, su3_vector *a1, su3_vector *a2,
su3_vector *a3, su3_vector *a4){
register Real dummy;
_pftch_V(a0);
_pftch_V(a1);
_pftch_V(a2);
_pftch_V(a3);
_pftch_V(a4);
}
void _prefetch_WWW( wilson_vector *a0, wilson_vector *a1, wilson_vector *a2){
register Real dummy;
_pftch_W(a0);
_pftch_W(a1);
_pftch_W(a2);
}
void _prefetch_WWWW( wilson_vector *a0, wilson_vector *a1,
wilson_vector *a2, wilson_vector *a3){
register Real dummy;
_pftch_W(a0);
_pftch_W(a1);
_pftch_W(a2);
_pftch_W(a3);
}
void _prefetch_WWWWW( wilson_vector *a0, wilson_vector *a1, wilson_vector *a2,
wilson_vector *a3, wilson_vector *a4){
register Real dummy;
_pftch_W(a0);
_pftch_W(a1);
_pftch_W(a2);
_pftch_W(a3);
_pftch_W(a4);
}
void _prefetch_4MVVVV( su3_matrix *a0, su3_vector *a1, su3_vector *a2,
su3_vector *a3, su3_vector *a4){
register Real dummy;
_pftch_4M(a0);
_pftch_V(a1);
_pftch_V(a2);
_pftch_V(a3);
_pftch_V(a4);
}
void _prefetch_4MWWWW( su3_matrix *a0, wilson_vector *a1, wilson_vector *a2,
wilson_vector *a3, wilson_vector *a4){
register Real dummy;
_pftch_4M(a0);
_pftch_W(a1);
_pftch_W(a2);
_pftch_W(a3);
_pftch_W(a4);
}
void _prefetch_4MV4V( su3_matrix *a0, su3_vector *a1, su3_vector *a2){
register Real dummy;
_pftch_4M(a0);
_pftch_V(a1);
_pftch_4V(a2);
}
void _prefetch_4MW4W( su3_matrix *a0, wilson_vector *a1, wilson_vector *a2){
register Real dummy;
_pftch_4M(a0);
_pftch_W(a1);
_pftch_4W(a2);
}
#undef _pftch_M
#undef _pftch_V
#undef _pftch_H
#undef _pftch_W
#undef _pftch_4V
#undef _pftch_4M
#undef _pftch_4W
/* prefetch.c */