Skip to content

Commit 69ffd89

Browse files
authored
ggml-amx : fix ggml_amx_init() on generic Linux (#16049)
Generalize Linux check to `__linux__` to support non-glibc systems (like musl). Also, return `false` on unknown/untested OS. Without this commit, the code compiles (with warnings) but fails: register_backend: registered backend CPU (1 devices) register_device: registered device CPU (Intel(R) Xeon(R) Platinum 8488C) build: 6487 (51c4cac) with x86_64-linux-musl-gcc (GCC) 15.1.0 for x86_64-linux-musl (debug) system info: n_threads = 8, n_threads_batch = 8, total_threads = 16 .... print_info: n_ctx_orig_yarn = 262144 print_info: rope_finetuned = unknown print_info: model type = 4B Illegal instruction (core dumped) Signed-off-by: Adrien Gallouët <[email protected]>
1 parent 246c0d9 commit 69ffd89

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ggml/src/ggml-cpu/amx/amx.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "ggml-cpu.h"
88
#include "traits.h"
99

10-
#if defined(__gnu_linux__)
10+
#if defined(__linux__)
1111
#include <sys/syscall.h>
1212
#include <unistd.h>
1313
#endif
@@ -186,14 +186,16 @@ static size_t ggml_backend_amx_buffer_type_get_alloc_size(ggml_backend_buffer_ty
186186
#define XFEATURE_XTILEDATA 18
187187

188188
static bool ggml_amx_init() {
189-
#if defined(__gnu_linux__)
189+
#if defined(__linux__)
190190
if (syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA)) {
191191
fprintf(stderr, "AMX is not ready to be used!\n");
192192
return false;
193193
}
194194
return true;
195195
#elif defined(_WIN32)
196196
return true;
197+
#else
198+
return false;
197199
#endif
198200
}
199201

0 commit comments

Comments
 (0)