Skip to content

Commit ef32ae9

Browse files
committed
fix: fix clang-tidy
1 parent 19ce2a0 commit ef32ae9

22 files changed

Lines changed: 104 additions & 589 deletions

src/ailego/math/euclidean_distance_matrix_fp16_dispatch.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,11 @@ float SquaredEuclideanDistanceFp16AVX(const Float16 *lhs, const Float16 *rhs,
4444
size_t size);
4545
#endif
4646

47-
<<<<<<< HEAD
4847
float SquaredEuclideanDistanceFp16Scalar(const Float16 *lhs, const Float16 *rhs,
4948
size_t size);
5049

51-
=======
5250
#if (defined(__F16C__) && defined(__AVX__)) || \
5351
(defined(__ARM_NEON) && defined(__aarch64__)) || defined(__riscv_zvfh)
54-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
5552
//! Compute the distance between matrix and query (FP16, M=1, N=1)
5653
void SquaredEuclideanDistanceMatrix<Float16, 1, 1>::Compute(const ValueType *m,
5754
const ValueType *q,
@@ -78,7 +75,6 @@ void SquaredEuclideanDistanceMatrix<Float16, 1, 1>::Compute(const ValueType *m,
7875
return;
7976
}
8077
#endif
81-
<<<<<<< HEAD
8278

8379
#if defined(__AVX__)
8480
if (zvec::ailego::internal::CpuFeatures::static_flags_.AVX) {
@@ -87,19 +83,6 @@ void SquaredEuclideanDistanceMatrix<Float16, 1, 1>::Compute(const ValueType *m,
8783
}
8884
#endif
8985
*out = SquaredEuclideanDistanceFp16Scalar(m, q, dim);
90-
91-
=======
92-
#if defined(__AVX__)
93-
SquaredEuclideanDistanceAVX(m, q, dim, out);
94-
// ACCUM_FP16_1X1_AVX(m, q, dim, out, 0ull, )
95-
#else
96-
float sum = 0.0f;
97-
for (size_t i = 0; i < dim; ++i) {
98-
sum += MathHelper::SquaredDifference(m[i], q[i]);
99-
}
100-
*out = sum;
101-
#endif
102-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
10386
#endif //__ARM_NEON
10487
}
10588

src/ailego/math/euclidean_distance_matrix_fp32_dispatch.cc

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,74 +50,52 @@ float SquaredEuclideanDistanceFp32Scalar(const float *lhs, const float *rhs,
5050
//-----------------------------------------------------------
5151
// SquaredEuclideanDistance
5252
//-----------------------------------------------------------
53-
<<<<<<< HEAD
54-
=======
5553
#if defined(__SSE__) || defined(__ARM_NEON) || defined(__riscv_vector)
56-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
5754
//! Compute the distance between matrix and query (FP32, M=1, N=1)
5855
void SquaredEuclideanDistanceMatrix<float, 1, 1>::Compute(const ValueType *m,
5956
const ValueType *q,
6057
size_t dim,
6158
float *out) {
62-
<<<<<<< HEAD
63-
#if defined(__ARM_NEON)
64-
SquaredEuclideanDistanceFp32NEON(m, q, dim, out);
65-
#else
66-
=======
6759
#if defined(__riscv_vector)
6860
if (zvec::ailego::internal::CpuFeatures::static_flags_.RISCV_VECTOR) {
6961
*out = SquaredEuclideanDistanceRVV(m, q, dim);
7062
return;
7163
}
72-
#elif defined(__ARM_NEON)
73-
SquaredEuclideanDistanceNEON(m, q, dim, out);
74-
#elif defined(__SSE__)
75-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
64+
#endif // __riscv_vector
65+
66+
#if defined(__ARM_NEON)
67+
SquaredEuclideanDistanceFp32NEON(m, q, dim, out);
68+
return;
69+
#endif // __ARM_NEON
70+
7671
#if defined(__AVX512F__)
7772
if (zvec::ailego::internal::CpuFeatures::static_flags_.AVX512F) {
7873
*out = SquaredEuclideanDistanceFp32AVX512(m, q, dim);
7974
return;
8075
}
8176
#endif // __AVX512F__
77+
8278
#if defined(__AVX__)
8379
if (zvec::ailego::internal::CpuFeatures::static_flags_.AVX) {
8480
*out = SquaredEuclideanDistanceFp32AVX(m, q, dim);
8581
return;
8682
}
8783
#endif // __AVX__
88-
<<<<<<< HEAD
8984

9085
#if defined(__SSE__)
9186
if (zvec::ailego::internal::CpuFeatures::static_flags_.SSE) {
9287
*out = SquaredEuclideanDistanceFp32SSE(m, q, dim);
9388
return;
9489
}
9590
#endif // __SSE__
91+
9692
*out = SquaredEuclideanDistanceFp32Scalar(m, q, dim);
97-
#endif // __ARM_NEON
98-
}
99-
=======
100-
*out = SquaredEuclideanDistanceSSE(m, q, dim);
101-
#else
102-
float sum = 0.0f;
103-
for (size_t i = 0; i < dim; ++i) {
104-
sum += MathHelper::SquaredDifference(m[i], q[i]);
105-
}
106-
*out = sum;
107-
#endif
10893
}
10994
#endif // __SSE__ || __ARM_NEON || __riscv_vector
11095

111-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
112-
11396
//-----------------------------------------------------------
11497
// EuclideanDistance
11598
//-----------------------------------------------------------
116-
<<<<<<< HEAD
117-
=======
118-
#if defined(__SSE__) || (defined(__ARM_NEON) && defined(__aarch64__)) || \
119-
defined(__riscv_vector)
120-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
12199
//! Compute the distance between matrix and query (FP32, M=1, N=1)
122100
void EuclideanDistanceMatrix<float, 1, 1>::Compute(const ValueType *m,
123101
const ValueType *q,
@@ -127,14 +105,11 @@ void EuclideanDistanceMatrix<float, 1, 1>::Compute(const ValueType *m,
127105
*out = EuclideanDistanceRVV(m, q, dim);
128106
return;
129107
}
130-
#endif
108+
#endif // __riscv_vector
109+
131110
SquaredEuclideanDistanceMatrix<float, 1, 1>::Compute(m, q, dim, out);
132111
*out = std::sqrt(*out);
133112
}
134-
<<<<<<< HEAD
135-
=======
136-
#endif // __SSE__ || __ARM_NEON && __aarch64__ || __riscv_vector
137-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
138113

139114
} // namespace ailego
140115
} // namespace zvec

src/ailego/math/euclidean_distance_matrix_int8_dispatch.cc

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ float SquaredEuclideanDistanceInt8SSE(const int8_t *lhs, const int8_t *rhs,
3737
float SquaredEuclideanDistanceInt8Scalar(const int8_t *lhs, const int8_t *rhs,
3838
size_t size);
3939

40-
<<<<<<< HEAD
41-
=======
42-
#if defined(__SSE4_1__) || defined(__riscv_vector)
43-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
4440
//! Compute the distance between matrix and query (INT8, M=1, N=1)
4541
void SquaredEuclideanDistanceMatrix<int8_t, 1, 1>::Compute(const ValueType *m,
4642
const ValueType *q,
@@ -58,7 +54,6 @@ void SquaredEuclideanDistanceMatrix<int8_t, 1, 1>::Compute(const ValueType *m,
5854
return;
5955
}
6056
#endif // __AVX2__
61-
<<<<<<< HEAD
6257

6358
#if defined(__SSE4_1__)
6459
if (zvec::ailego::internal::CpuFeatures::static_flags_.SSE4_1) {
@@ -68,17 +63,6 @@ void SquaredEuclideanDistanceMatrix<int8_t, 1, 1>::Compute(const ValueType *m,
6863
#endif
6964

7065
*out = SquaredEuclideanDistanceInt8Scalar(m, q, dim);
71-
=======
72-
#if defined(__SSE4_1__)
73-
*out = SquaredEuclideanDistanceSSE(m, q, dim);
74-
#else
75-
float sum = 0.0f;
76-
for (size_t i = 0; i < dim; ++i) {
77-
sum += MathHelper::SquaredDifference(m[i], q[i]);
78-
}
79-
*out = sum;
80-
#endif
81-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
8266
}
8367

8468
//! Compute the distance between matrix and query (INT8, M=1, N=1)
@@ -94,10 +78,6 @@ void EuclideanDistanceMatrix<int8_t, 1, 1>::Compute(const ValueType *m,
9478
SquaredEuclideanDistanceMatrix<int8_t, 1, 1>::Compute(m, q, dim, out);
9579
*out = std::sqrt(*out);
9680
}
97-
<<<<<<< HEAD
98-
=======
99-
#endif // __SSE4_1__ || __riscv_vector
100-
>>>>>>> 05b06b8 (feat: add RVV non-batch distance operators)
10181

10282
} // namespace ailego
10383
} // namespace zvec

src/ailego/math/inner_product_matrix.h

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -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

777776
constexpr static uint32_t SEGMENT_ID_BITS = 16;
778777
constexpr 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

901779
template <typename T>
902780
struct MinusInnerProductSparseMatrix {

0 commit comments

Comments
 (0)