From be450086b520f2de37af2aa9721441b516dd93e3 Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Fri, 17 Dec 2021 22:09:35 +0100 Subject: [PATCH] took out prefetch and added commented out pragmas - they not help --- magyarsort.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/magyarsort.h b/magyarsort.h index 667bcf7..ab098a0 100644 --- a/magyarsort.h +++ b/magyarsort.h @@ -9,6 +9,12 @@ * LICENCE: CC3 - look it up, you need to mention me but that is all */ +/* + * Does not help much: +// #pragma GCC target ("avx2") +// #pragma GCC optimization ("unroll-loops") +*/ + #include #include #include // memset @@ -90,8 +96,7 @@ namespace MagyarSort { #pragma GCC unroll 64 for(COUNTER_TYP i = 0; i < size; ++i) { // Prefetch caches - __builtin_prefetch(&arr[i]); // TODO: is good? - __builtin_prefetch(&arr[i + 64]); + //__builtin_prefetch(&arr[i + 64]); // Creates no object, struct is empty OccurenceMagic(arr, i, radicsOut); } @@ -143,8 +148,10 @@ namespace MagyarSort { #pragma GCC unroll 64 for(COUNTER_TYP i = size; i > 0; --i) { // right-to-left to ensure already sorted digits order we keep for iterations // Prefetch caches + /* __builtin_prefetch(&from[i]); // TODO: is good? if(i >= 64) { __builtin_prefetch(&from[i - 64]); } // TODO: manually unroll? + */ // Get num and its new offset / location auto num = from[i - 1]; auto digVal = getDigit(num);