diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/solvers/h48/solve.h | 7 | ||||
| -rw-r--r-- | src/utils/prefetch.h | 15 | ||||
| -rw-r--r-- | src/utils/utils.h | 1 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index c51fa29..6a29b82 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -138,6 +138,7 @@ h48_prune_pipeline( | |||
| 138 | bool normal | 138 | bool normal |
| 139 | ) | 139 | ) |
| 140 | { | 140 | { |
| 141 | uint64_t i; | ||
| 141 | uint32_t cdata; | 142 | uint32_t cdata; |
| 142 | uint8_t m, p; | 143 | uint8_t m, p; |
| 143 | 144 | ||
| @@ -184,7 +185,8 @@ h48_prune_pipeline( | |||
| 184 | if (prune[m].pi == 0) { | 185 | if (prune[m].pi == 0) { |
| 185 | prune[m].coord = coord_h48_edges(prune[m].inverse, | 186 | prune[m].coord = coord_h48_edges(prune[m].inverse, |
| 186 | COCLASS(cdata), TTREP(cdata), arg->h); | 187 | COCLASS(cdata), TTREP(cdata), arg->h); |
| 187 | // TODO prefetch | 188 | i = H48_INDEX(H48_LINE_EXT(prune[m].coord)); |
| 189 | prefetch(arg->h48data, i); | ||
| 188 | } | 190 | } |
| 189 | } | 191 | } |
| 190 | 192 | ||
| @@ -210,7 +212,8 @@ h48_prune_pipeline( | |||
| 210 | } | 212 | } |
| 211 | prune[m].coord = coord_h48_edges( | 213 | prune[m].coord = coord_h48_edges( |
| 212 | prune[m].cube, COCLASS(cdata), TTREP(cdata), arg->h); | 214 | prune[m].cube, COCLASS(cdata), TTREP(cdata), arg->h); |
| 213 | // TODO prefetch | 215 | i = H48_INDEX(H48_LINE_EXT(prune[m].coord)); |
| 216 | prefetch(arg->h48data, i); | ||
| 214 | } | 217 | } |
| 215 | 218 | ||
| 216 | /* Stage 3: get pval from normal */ | 219 | /* Stage 3: get pval from normal */ |
diff --git a/src/utils/prefetch.h b/src/utils/prefetch.h new file mode 100644 index 0000000..89b14e8 --- /dev/null +++ b/src/utils/prefetch.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #if defined(AVX2) | ||
| 2 | |||
| 3 | #define prefetch(a, i) _mm_prefetch(a+i, _MM_HINT_T0) | ||
| 4 | |||
| 5 | #else | ||
| 6 | #if defined(__GNUC__) || defined(__clang__) | ||
| 7 | |||
| 8 | #define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) | ||
| 9 | |||
| 10 | #else | ||
| 11 | |||
| 12 | #define prefetch(a, i) (void)i | ||
| 13 | |||
| 14 | #endif | ||
| 15 | #endif | ||
diff --git a/src/utils/utils.h b/src/utils/utils.h index 383781a..e322f20 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h | |||
| @@ -4,3 +4,4 @@ | |||
| 4 | #include "math.h" | 4 | #include "math.h" |
| 5 | #include "sleep.h" | 5 | #include "sleep.h" |
| 6 | #include "wrapthread.h" | 6 | #include "wrapthread.h" |
| 7 | #include "prefetch.h" | ||
