Skip to content

Commit 360ff16

Browse files
committed
fix: cross compilation
Signed-off-by: usamoi <[email protected]>
1 parent 2b9e9a3 commit 360ff16

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

crates/c/src/c.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#include "c.h"
2-
#include <immintrin.h>
32
#include <math.h>
43

4+
#if defined(__x86_64__)
5+
#include <immintrin.h>
6+
#endif
7+
8+
#if defined(__x86_64__)
9+
510
__attribute__((target("avx512fp16,bmi2"))) extern float
611
v_f16_cosine_axv512(_Float16 const *restrict a, _Float16 const *restrict b,
712
size_t n) {
@@ -115,3 +120,5 @@ v_f16_sl2_axv2(_Float16 const *restrict a, _Float16 const *restrict b,
115120
}
116121
return dd;
117122
}
123+
124+
#endif

crates/c/src/c.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#include <stddef.h>
22
#include <stdint.h>
33

4+
#if defined(__x86_64__)
5+
46
extern float v_f16_cosine_axv512(_Float16 const *, _Float16 const *, size_t n);
57
extern float v_f16_dot_axv512(_Float16 const *, _Float16 const *, size_t n);
68
extern float v_f16_sl2_axv512(_Float16 const *, _Float16 const *, size_t n);
79
extern float v_f16_cosine_axv2(_Float16 const *, _Float16 const *, size_t n);
810
extern float v_f16_dot_axv2(_Float16 const *, _Float16 const *, size_t n);
911
extern float v_f16_sl2_axv2(_Float16 const *, _Float16 const *, size_t n);
12+
13+
#endif

0 commit comments

Comments
 (0)