From 9a013b7c68f94e6be0fe8748c9012a441fe0273f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 12 Jan 2026 18:09:43 +0100 Subject: Improve performance of H48 solver with prefetching With this commit we re-structure how the node expansion in the H48 solution search works to allow prefetching of pruning values, showing performance improvements in the range of 30-45% on x86, depending on table size and solution length. A small bug fix related to appending solutions is included in this commit. --- src/utils/prefetch.h | 15 +++++++++++++++ src/utils/utils.h | 1 + 2 files changed, 16 insertions(+) create mode 100644 src/utils/prefetch.h (limited to 'src/utils') 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 @@ +#if defined(AVX2) + +#define prefetch(a, i) _mm_prefetch(a+i, _MM_HINT_T0) + +#else +#if defined(__GNUC__) || defined(__clang__) + +#define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) + +#else + +#define prefetch(a, i) (void)i + +#endif +#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 @@ #include "math.h" #include "sleep.h" #include "wrapthread.h" +#include "prefetch.h" -- cgit v1.3