@@ -769,134 +769,12 @@ struct SparseSegmentInfo {
769769 public:
770770 SparseSegmentInfo () : seg_id_{-1U }, vec_cnt_{0 } {}
771771
772- <<<<<<< HEAD
773772 SparseSegmentInfo (uint32_t seg_id, uint32_t vec_cnt)
774773 : seg_id_{seg_id}, vec_cnt_{vec_cnt} {}
775774};
776775
777776constexpr static uint32_t SEGMENT_ID_BITS = 16 ;
778777constexpr static uint32_t SEGMENT_ID_MASK = 0xFFFF ;
779- =======
780- float sum = 0.0 ;
781- for (size_t i = 0 ; i < (dim >> 1 ); ++i) {
782- uint8_t m_val = m[i];
783- uint8_t q_val = q[i];
784- sum -= Int4MulTable[((m_val << 4 ) & 0xf0 ) | ((q_val >> 0 ) & 0xf )] +
785- Int4MulTable[((m_val >> 0 ) & 0xf0 ) | ((q_val >> 4 ) & 0xf )];
786- }
787- *out = sum;
788- }
789- };
790- #endif // !__SSE4_1__
791-
792- #if defined(__SSE__) || defined(__ARM_NEON) || defined(__riscv_vector)
793- /* ! Inner Product Matrix (FP32, M=1, N=1)
794- */
795- template <>
796- struct InnerProductMatrix <float , 1 , 1 > {
797- // ! Type of value
798- using ValueType = float ;
799-
800- // ! Compute the distance between matrix and query
801- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
802- float *out);
803- };
804-
805- /* ! Minus Inner Product Matrix (FP32, M=1, N=1)
806- */
807- template <>
808- struct MinusInnerProductMatrix <float , 1 , 1 > {
809- // ! Type of value
810- using ValueType = float ;
811-
812- // ! Compute the distance between matrix and query
813- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
814- float *out);
815- };
816- #endif // __SSE__ || __ARM_NEON || __riscv_vector
817-
818- #if (defined(__F16C__) && defined(__AVX__)) || \
819- (defined (__ARM_NEON) && defined (__aarch64__)) || defined (__riscv_zvfh)
820- /* ! Inner Product Matrix (FP16, M=1, N=1)
821- */
822- template <>
823- struct InnerProductMatrix <Float16, 1 , 1 > {
824- // ! Type of value
825- using ValueType = Float16;
826-
827- // ! Compute the distance between matrix and query
828- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
829- float *out);
830- };
831-
832- /* ! Minus Inner Product Matrix (FP16, M=1, N=1)
833- */
834- template <>
835- struct MinusInnerProductMatrix <Float16, 1 , 1 > {
836- // ! Type of value
837- using ValueType = Float16;
838-
839- // ! Compute the distance between matrix and query
840- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
841- float *out);
842- };
843-
844- #endif // (__F16C__ && __AVX__) || (__ARM_NEON && __aarch64__) || __riscv_zvfh
845-
846- #if defined(__SSE4_1__) || defined(__riscv_vector)
847- /* ! Inner Product Matrix (INT8, M=1, N=1)
848- */
849- template <>
850- struct InnerProductMatrix <int8_t , 1 , 1 > {
851- // ! Type of value
852- using ValueType = int8_t ;
853-
854- // ! Compute the distance between matrix and query
855- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
856- float *out);
857- };
858-
859- /* ! Minus Inner Product Matrix (INT8, M=1, N=1)
860- */
861- template <>
862- struct MinusInnerProductMatrix <int8_t , 1 , 1 > {
863- // ! Type of value
864- using ValueType = int8_t ;
865-
866- // ! Compute the distance between matrix and query
867- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
868- float *out);
869- };
870-
871- #if defined(__SSE4_1__)
872-
873- /* ! Inner Product Matrix (INT4, M=1, N=1)
874- */
875- template <>
876- struct InnerProductMatrix <uint8_t , 1 , 1 > {
877- // ! Type of value
878- using ValueType = uint8_t ;
879-
880- // ! Compute the distance between matrix and query
881- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
882- float *out);
883- };
884-
885- /* ! Minus Inner Product Matrix (INT4, M=1, N=1)
886- */
887- template <>
888- struct MinusInnerProductMatrix <uint8_t , 1 , 1 > {
889- // ! Type of value
890- using ValueType = uint8_t ;
891-
892- // ! Compute the distance between matrix and query
893- static void Compute (const ValueType *m, const ValueType *q, size_t dim,
894- float *out);
895- };
896- #endif // __SSE4_1__
897- >>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
898-
899- #endif // __SSE4_1__ || __riscv_vector
900778
901779template <typename T>
902780struct MinusInnerProductSparseMatrix {
0 commit comments