From 03093afc1f0a567f4c08995cafcfdc7783ea2f82 Mon Sep 17 00:00:00 2001 From: Keming Date: Tue, 3 Dec 2024 19:27:41 +0800 Subject: [PATCH] fix: import x86 simd Signed-off-by: Keming --- src/simd.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/simd.rs b/src/simd.rs index 96ce22e..98741c2 100644 --- a/src/simd.rs +++ b/src/simd.rs @@ -331,6 +331,9 @@ pub unsafe fn scalar_quantize( lower_bound: f32, multiplier: f32, ) -> u32 { + #[cfg(target_arch = "x86")] + use std::arch::x86::*; + #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; let mut quantize_ptr = quantized.as_mut_ptr() as *mut u64; @@ -395,6 +398,9 @@ pub unsafe fn scalar_quantize( #[target_feature(enable = "avx,avx2")] #[inline] pub unsafe fn vector_binarize_query(vec: &[u8], binary: &mut [u64]) { + #[cfg(target_arch = "x86")] + use std::arch::x86::*; + #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; let length = vec.len(); @@ -428,6 +434,9 @@ pub unsafe fn vector_binarize_query(vec: &[u8], binary: &mut [u64]) { #[target_feature(enable = "sse2,avx,avx2")] #[inline] pub unsafe fn binary_dot_product(lhs: &[u64], rhs: &[u64]) -> u32 { + #[cfg(target_arch = "x86")] + use std::arch::x86::*; + #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; let mut sum = 0;