Skip to content

Commit 0276aca

Browse files
threadpool: fix compiler errors for android and x64 builds
1 parent c1e7f48 commit 0276aca

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ggml.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19402,6 +19402,7 @@ static bool __thread_priority(int32_t prio) {
1940219402

1940319403
#else // posix?
1940419404

19405+
#define __USE_GNU
1940519406
#include <sched.h>
1940619407

1940719408
static bool __thread_affinity(const bool * mask) {
@@ -19473,17 +19474,16 @@ static bool __thread_priority(int32_t prio) {
1947319474

1947419475
#endif
1947519476

19476-
#ifdef __aarch64__
19477-
19477+
#if defined(__aarch64__) && ( defined(__clang__) || defined(__GNUC__) )
1947819478
static inline void __cpu_relax(void) {
19479-
__asm__ volatile("yield" ::: "memory");
19479+
asm volatile("yield" ::: "memory");
1948019480
}
19481-
19482-
#else
19483-
19481+
#elif defined(__x86_64__)
1948419482
static inline void __cpu_relax(void) {
19485-
__asm__ volatile("rep; nop" ::: "memory");
19483+
_mm_pause();
1948619484
}
19485+
#else
19486+
static inline void __cpu_relax(void) {;}
1948719487
#endif
1948819488

1948919489
static void __cpumask_next(const bool * global_mask, bool * local_mask, bool strict, int32_t* iter) {

0 commit comments

Comments
 (0)