Skip to content

Commit a67dbcc

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

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ggml.c

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

1940319403
#else // posix?
1940419404

19405+
#ifndef __USE_GNU
19406+
#define __USE_GNU
19407+
#endif
1940519408
#include <sched.h>
1940619409

1940719410
static bool __thread_affinity(const bool * mask) {
@@ -19473,17 +19476,16 @@ static bool __thread_priority(int32_t prio) {
1947319476

1947419477
#endif
1947519478

19476-
#ifdef __aarch64__
19477-
19479+
#if defined(__aarch64__) && ( defined(__clang__) || defined(__GNUC__) )
1947819480
static inline void __cpu_relax(void) {
1947919481
__asm__ volatile("yield" ::: "memory");
1948019482
}
19481-
19482-
#else
19483-
19483+
#elif defined(__x86_64__)
1948419484
static inline void __cpu_relax(void) {
19485-
__asm__ volatile("rep; nop" ::: "memory");
19485+
_mm_pause();
1948619486
}
19487+
#else
19488+
static inline void __cpu_relax(void) {;}
1948719489
#endif
1948819490

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

0 commit comments

Comments
 (0)