Skip to content

Commit 8f1284f

Browse files
authored
fix: fix import wrong package in ARM architecture (#49)
1 parent 9069d26 commit 8f1284f

File tree

17 files changed

+117
-54
lines changed

17 files changed

+117
-54
lines changed

.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ DerivePointerAlignment : false
44
PointerAlignment : Right
55
ColumnLimit : 100
66

7+
# Preprocessor directive indentation
8+
IndentPPDirectives : BeforeHash
9+
710
# Default for clang-8, changed in later clangs. Set explicitly for forwards
811
# compatibility for students with modern clangs
912
IncludeBlocks : Preserve

include/executor/jobs/graph_search_job.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "utils/rabitq_utils/search_utils/hashset.hpp"
3434

3535
#if defined(__linux__)
36-
#include "coro/task.hpp"
36+
#include "coro/task.hpp"
3737
#endif
3838

3939
namespace alaya {

include/index/graph/qg/qg_builder.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class QGBuilder {
130130
void search_new_neighbors(bool sup) {
131131
LOG_INFO("Searching for new neighbor candidates...");
132132
#if defined(__AVX512F__)
133-
#pragma omp parallel for schedule(dynamic)
133+
#pragma omp parallel for schedule(dynamic)
134134
for (size_t i = 0; i < num_nodes_; ++i) {
135135
IDType cur_id = i;
136136
auto tid = omp_get_thread_num();
@@ -165,7 +165,7 @@ class QGBuilder {
165165
#if defined(__AVX512F__)
166166
std::vector<std::mutex> locks(num_nodes_);
167167
std::vector<CandidateList> reverse_buffer(num_nodes_);
168-
#pragma omp parallel for schedule(dynamic)
168+
#pragma omp parallel for schedule(dynamic)
169169
for (IDType data_id = 0; data_id < num_nodes_; ++data_id) { // for every vertex
170170
for (const auto &nei : new_neighbors_[data_id]) {
171171
auto dst = nei.id_;
@@ -191,7 +191,7 @@ class QGBuilder {
191191
}
192192
}
193193
}
194-
#pragma omp parallel for schedule(dynamic)
194+
#pragma omp parallel for schedule(dynamic)
195195
for (IDType data_id = 0; data_id < num_nodes_; ++data_id) { // prune for every vertex
196196
CandidateList &tmp_pool = reverse_buffer[data_id];
197197
tmp_pool.reserve(tmp_pool.size() + degree_bound_);
@@ -214,7 +214,7 @@ class QGBuilder {
214214
void angle_based_supplement() {
215215
LOG_INFO("Supplementing edges...");
216216
#if defined(__AVX512F__)
217-
#pragma omp parallel for schedule(dynamic)
217+
#pragma omp parallel for schedule(dynamic)
218218
for (size_t i = 0; i < num_nodes_; ++i) {
219219
CandidateList &cur_neighbors = new_neighbors_[i];
220220
size_t cur_degree = cur_neighbors.size();

include/index/index_type.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
#include <tuple>
2222

2323
#if defined(_MSC_VER)
24-
#define ALAYA_UNREACHABLE __assume(0)
24+
#define ALAYA_UNREACHABLE __assume(0)
2525
#elif defined(__GNUC__) || defined(__clang__)
26-
#define ALAYA_UNREACHABLE __builtin_unreachable()
26+
#define ALAYA_UNREACHABLE __builtin_unreachable()
2727
#else
28-
#define ALAYA_UNREACHABLE
28+
#define ALAYA_UNREACHABLE
2929
#endif
3030

3131
namespace alaya {

include/space/distance/dist_config.hpp

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,59 @@
1818
#include <sys/types.h>
1919

2020
#ifndef NO_MANUAL_VECTORIZATION
21-
#if (defined(__SSE__) || _M_IX86_FP > 0 || defined(_M_AMD64) || defined(_M_X64))
22-
#define USE_SSE
23-
#ifdef __AVX__
24-
#define USE_AVX
25-
#ifdef __AVX512F__
26-
#define USE_AVX512
27-
#endif
28-
#endif
29-
#endif
21+
#if (defined(__SSE__) || _M_IX86_FP > 0 || defined(_M_AMD64) || defined(_M_X64))
22+
#define USE_SSE
23+
#ifdef __AVX__
24+
#define USE_AVX
25+
#ifdef __AVX512F__
26+
#define USE_AVX512
27+
#endif
28+
#endif
29+
#endif
30+
31+
// ARM NEON detection
32+
#if defined(__aarch64__) || defined(_M_ARM64)
33+
#define USE_NEON
34+
#endif
3035
#endif
3136

3237
#if defined(USE_AVX) || defined(USE_SSE)
33-
#ifdef _MSC_VER
34-
#include <intrin.h>
35-
#include <stdexcept>
36-
#else
37-
#include <cpuid.h>
38-
#include <x86intrin.h>
38+
#ifdef _MSC_VER
39+
#include <intrin.h>
40+
#include <stdexcept>
41+
#else
42+
#include <cpuid.h>
43+
#include <x86intrin.h>
44+
45+
#endif
3946

47+
#if defined(USE_AVX512)
48+
#include <immintrin.h>
49+
#endif
4050
#endif
4151

42-
#if defined(USE_AVX512)
43-
#include <immintrin.h>
52+
// ARM NEON headers
53+
#if defined(USE_NEON)
54+
#include <arm_neon.h>
4455
#endif
4556

57+
// Alignment macros (available on all platforms)
4658
#if defined(__GNUC__) || defined(__clang__)
47-
#define PORTABLE_ALIGN32 __attribute__((aligned(32)))
48-
#define PORTABLE_ALIGN64 __attribute__((aligned(64)))
59+
#define PORTABLE_ALIGN32 __attribute__((aligned(32)))
60+
#define PORTABLE_ALIGN64 __attribute__((aligned(64)))
4961
#else
50-
#define PORTABLE_ALIGN32 __declspec(align(32))
51-
#define PORTABLE_ALIGN64 __declspec(align(64))
52-
#endif
62+
#define PORTABLE_ALIGN32 __declspec(align(32))
63+
#define PORTABLE_ALIGN64 __declspec(align(64))
5364
#endif
5465

5566
#if defined(__GNUC__) && !defined(__clang__)
56-
#define FAST_BEGIN _Pragma("GCC push_options") _Pragma("GCC optimize (\"unroll-loops,fast-math\")")
57-
#define FAST_END _Pragma("GCC pop_options")
67+
#define FAST_BEGIN \
68+
_Pragma("GCC push_options") _Pragma("GCC optimize (\"unroll-loops,fast-math\")")
69+
#define FAST_END _Pragma("GCC pop_options")
5870
#else
59-
// Clang / MSVC / others: no-op
60-
#define FAST_BEGIN
61-
#define FAST_END
71+
// Clang / MSVC / others: no-op
72+
#define FAST_BEGIN
73+
#define FAST_END
6274
#endif
6375

6476
#define CAST(Type, Ptr) (*reinterpret_cast<const Type *>(Ptr))

include/space/raw_space.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "utils/metric_type.hpp"
3434

3535
#ifdef _MSC_VER
36-
#include <malloc.h>
36+
#include <malloc.h>
3737
#endif
3838

3939
namespace alaya {

include/space/sq4_space.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "utils/types.hpp"
4040

4141
#ifdef _MSC_VER
42-
#include <malloc.h>
42+
#include <malloc.h>
4343
#endif
4444

4545
namespace alaya {

include/space/sq8_space.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "utils/prefetch.hpp"
3232

3333
#ifdef _MSC_VER
34-
#include <malloc.h>
34+
#include <malloc.h>
3535
#endif
3636

3737
namespace alaya {

include/storage/sequential_storage.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "utils/types.hpp"
3131

3232
#ifdef _MSC_VER
33-
#include <malloc.h>
33+
#include <malloc.h>
3434
#endif
3535

3636
namespace alaya {

include/utils/log.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
#include <string>
2323

2424
#ifdef PROJECT_ROOT
25-
#define RELATIVE_FILE get_relative_path(__FILE__, PROJECT_ROOT)
25+
#define RELATIVE_FILE get_relative_path(__FILE__, PROJECT_ROOT)
2626
auto inline get_relative_path(const std::string &full_path, const std::string &base_path)
2727
-> std::string {
2828
std::filesystem::path full(full_path);
2929
std::filesystem::path base(base_path);
3030
return std::filesystem::relative(full, base).string();
3131
}
3232
#else
33-
#define RELATIVE_FILE __FILE__
33+
#define RELATIVE_FILE __FILE__
3434
#endif
3535

3636
#define CONCATENATE_STRINGS(a, b) a b

0 commit comments

Comments
 (0)