Skip to content

Commit

Permalink
Port from x86 intrinsics to CPU native ones using SIMDe
Browse files Browse the repository at this point in the history
  • Loading branch information
pabs3 committed Mar 1, 2023
1 parent 3e75b18 commit f7685f4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion AnnService/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ add_library (DistanceUtils STATIC
)

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
target_compile_options(DistanceUtils PRIVATE -mavx2 -mavx -msse -msse2 -mavx512f -mavx512bw -mavx512dq -fPIC)
target_compile_options(DistanceUtils PRIVATE -fPIC -fopenmp-simd -O3)
target_compile_definitions(DistanceUtils PRIVATE SIMDE_ENABLE_NATIVE_ALIASES SIMDE_ENABLE_OPENMP)
endif()

add_library (SPTAGLib SHARED ${SRC_FILES} ${HDR_FILES})
Expand Down
20 changes: 18 additions & 2 deletions AnnService/inc/Core/Common/InstructionUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,24 @@

#ifndef _MSC_VER
#include <cpuid.h>
#include <xmmintrin.h>
#include <immintrin.h>
#include <simde/x86/sse.h>
#include <simde/x86/avx.h>
#include <simde/x86/avx2.h>
#include <simde/x86/avx512.h>

// FIXME: remove when SIMDe supports these:
// https://github.com/simd-everywhere/simde/issues/961
#ifndef __mmask32
#define __mmask32 simde__mmask32
#endif

#ifndef __mmask64
#define __mmask64 simde__mmask64
#endif

#ifndef _mm512_setzero_ps
#define _mm512_setzero_ps simde_mm512_setzero_ps
#endif

void cpuid(int info[4], int InfoType);

Expand Down

0 comments on commit f7685f4

Please sign in to comment.