Skip to content

Commit b010cb9

Browse files
committed
Fix compilation errors on aarch64
1 parent fb5000a commit b010cb9

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

exllamav2/exllamav2_ext/cpp/sampling_avx2.cpp

+21-7
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
#include "profiling.h"
1313

1414
#ifdef USE_AVX2
15-
#include "avx_mathfun.h"
16-
#endif
15+
#include "avx_mathfun.h"
1716

1817
AVX2_TARGET
1918
int softmax_cpu_avx2
@@ -26,10 +25,6 @@ int softmax_cpu_avx2
2625
float* output
2726
)
2827
{
29-
#ifndef USE_AVX2
30-
return 0;
31-
#else
32-
3328
profile_start("softmax_cpu (AVX2)");
3429

3530
int vocab_size_aligned = ((vocab_size + 31) / 32) * 32;
@@ -148,5 +143,24 @@ int softmax_cpu_avx2
148143
// }
149144
// printf("sum: %f\n\n", summ);
150145
return maxi;
151-
#endif
146+
152147
}
148+
149+
#else
150+
151+
// Dummy function to avoid compilation errors on aarch64
152+
153+
int softmax_cpu_avx2
154+
(
155+
const int vocab_size,
156+
const float temperature,
157+
const float* logits,
158+
const bool* logits_filter,
159+
const float exponent,
160+
float* output
161+
)
162+
{
163+
return 0;
164+
}
165+
166+
#endif

exllamav2/exllamav2_ext/ext_sampling.cpp

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@
88
#include <pybind11/pybind11.h>
99
#include <pybind11/stl.h>
1010

11-
#ifdef __linux__
12-
#include <mm_malloc.h>
11+
#include "config.h"
12+
13+
#ifdef USE_AVX2
14+
#ifdef __linux__
15+
#include <mm_malloc.h>
16+
#else
17+
#define _mm_malloc(a, b) _aligned_malloc(a, b)
18+
#define _mm_free(a) _aligned_free(a)
19+
#endif
1320
#else
14-
#define _mm_malloc(a, b) _aligned_malloc(a, b)
15-
#define _mm_free(a) _aligned_free(a)
21+
// aarch64-linux apparently has no mm_malloc, but it would only be needed for AVX2 anyway, which is also not
22+
// available on aarch64
23+
#define _mm_malloc(a, b) malloc(a)
24+
#define _mm_free(a) free(a)
1625
#endif
1726

18-
#include "config.h"
1927
#include "ext_sampling.h"
2028

2129
#include "cpp/generator.h"

0 commit comments

Comments
 (0)