File tree 2 files changed +34
-12
lines changed
2 files changed +34
-12
lines changed Original file line number Diff line number Diff line change 12
12
#include " profiling.h"
13
13
14
14
#ifdef USE_AVX2
15
- #include " avx_mathfun.h"
16
- #endif
15
+ #include " avx_mathfun.h"
17
16
18
17
AVX2_TARGET
19
18
int softmax_cpu_avx2
@@ -26,10 +25,6 @@ int softmax_cpu_avx2
26
25
float * output
27
26
)
28
27
{
29
- #ifndef USE_AVX2
30
- return 0 ;
31
- #else
32
-
33
28
profile_start (" softmax_cpu (AVX2)" );
34
29
35
30
int vocab_size_aligned = ((vocab_size + 31 ) / 32 ) * 32 ;
@@ -148,5 +143,24 @@ int softmax_cpu_avx2
148
143
// }
149
144
// printf("sum: %f\n\n", summ);
150
145
return maxi;
151
- # endif
146
+
152
147
}
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
Original file line number Diff line number Diff line change 8
8
#include < pybind11/pybind11.h>
9
9
#include < pybind11/stl.h>
10
10
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
13
20
#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)
16
25
#endif
17
26
18
- #include " config.h"
19
27
#include " ext_sampling.h"
20
28
21
29
#include " cpp/generator.h"
You can’t perform that action at this time.
0 commit comments