From bd4c6d32cc67172c3e9907d667e66a66af62bf58 Mon Sep 17 00:00:00 2001 From: Matthew Sterrett Date: Tue, 29 Oct 2024 14:02:56 -0700 Subject: [PATCH 1/2] Reset MMX state after argsort/argselect --- src/xss-common-argsort.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xss-common-argsort.h b/src/xss-common-argsort.h index cf02b30..eb46bbe 100644 --- a/src/xss-common-argsort.h +++ b/src/xss-common-argsort.h @@ -575,6 +575,11 @@ X86_SIMD_SORT_INLINE void xss_argsort(T *arr, if (descending) { std::reverse(arg, arg + arrsize); } } + +#ifdef __MMX__ + // Workaround for compiler bug generating MMX instructions without emms + _mm_empty(); +#endif } template @@ -632,6 +637,11 @@ X86_SIMD_SORT_INLINE void xss_argselect(T *arr, argselect_( arr, arg, k, 0, arrsize - 1, 2 * (arrsize_t)log2(arrsize)); } + +#ifdef __MMX__ + // Workaround for compiler bug generating MMX instructions without emms + _mm_empty(); +#endif } template From 5c63eeca2f37488add6ac13595e0383e53962f51 Mon Sep 17 00:00:00 2001 From: Matthew Sterrett Date: Thu, 7 Nov 2024 13:48:58 -0800 Subject: [PATCH 2/2] Removed message about potential MMX issue --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 6768314..61f4de5 100644 --- a/README.md +++ b/README.md @@ -80,16 +80,6 @@ benchmark](https://github.com/google/benchmark) frameworks respectively. You can configure meson to build them both by using `-Dbuild_tests=true` and `-Dbuild_benchmarks=true`. -### Note about building with avx512 by g++ v9 and v10 - -There is a risk when compile with avx512 by g++ v9 and v10, -as some `MMX Technology` instructions is used by g++ v9/v10 -without clearing fpu state. -Check [issue 154](https://github.com/intel/x86-simd-sort/issues/154) -for more details. - -Adding `g++` option `-mno-mmx`, which disables `MMX Technology` instructions, is a possible workaround. - ## Example usage #### Sort an array of floats