From 5dff7b5d1e5ed7faa0e7cb27e1a9ec84cda37afa Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 29 Jul 2019 20:59:22 +0200 Subject: [PATCH] AVX2 version of plot min max calculation. Slightly faster (~5%) than the autovectorized serial code. --- server/TracyView.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 61276511..92c179c5 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -17,6 +17,14 @@ #include #include +#ifdef __AVX2__ +# ifdef _MSC_VER +# include +# else +# include +# endif +#endif + #include "../common/TracyMutex.hpp" #include "../common/TracyProtocol.hpp" #include "../common/TracySystem.hpp" @@ -3686,11 +3694,42 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl auto tmp = it; ++tmp; const auto sz = end - tmp; +#ifdef __AVX2__ + __m256d vmin = _mm256_set1_pd( min ); + __m256d vmax = vmin; + const auto ssz = sz / 4; + for( ptrdiff_t i=0; i max ? tmp[i].val : max; + } +#else for( ptrdiff_t i=0; i max ? tmp[i].val : max; } +#endif } if( min == max ) {