Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f7685f4

Browse files
committedMar 1, 2023
Port from x86 intrinsics to CPU native ones using SIMDe
Obsoletes: microsoft#136 Fixes: microsoft#134 Fixes: microsoft#316 Blocked-by: simd-everywhere/simde#961
1 parent 3e75b18 commit f7685f4

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed
 

‎AnnService/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ add_library (DistanceUtils STATIC
3434
)
3535

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

4041
add_library (SPTAGLib SHARED ${SRC_FILES} ${HDR_FILES})

‎AnnService/inc/Core/Common/InstructionUtils.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,24 @@
88

99
#ifndef _MSC_VER
1010
#include <cpuid.h>
11-
#include <xmmintrin.h>
12-
#include <immintrin.h>
11+
#include <simde/x86/sse.h>
12+
#include <simde/x86/avx.h>
13+
#include <simde/x86/avx2.h>
14+
#include <simde/x86/avx512.h>
15+
16+
// FIXME: remove when SIMDe supports these:
17+
// https://github.com/simd-everywhere/simde/issues/961
18+
#ifndef __mmask32
19+
#define __mmask32 simde__mmask32
20+
#endif
21+
22+
#ifndef __mmask64
23+
#define __mmask64 simde__mmask64
24+
#endif
25+
26+
#ifndef _mm512_setzero_ps
27+
#define _mm512_setzero_ps simde_mm512_setzero_ps
28+
#endif
1329

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

0 commit comments

Comments
 (0)
Please sign in to comment.