Issue description
Creating a context crashes the process on an Apple M5 MacBook Air with the
prebuilt Metal binaries shipped in v3.19.0 (llama.cpp build b9842).
Metal shader compilation fails first, then a GGML assert aborts the process.
Possibly related to #549 / #595 (other M5 Metal problems), but the crash
signature is different.
Environment
- MacBook Air, Apple M5 (10-core: 4P+6E), 16 GB unified memory
- macOS 26
- node-llama-cpp 3.19.0 (prebuilt Metal binaries,
libllama.metal.b9842.dylib)
- Reproduces under both Node.js 22.22.3 and Bun
Error output
[node-llama-cpp] ggml_metal_library_init_from_source: error compiling source
/Users/runner/work/node-llama-cpp/node-llama-cpp/llama/llama.cpp/ggml/src/ggml-backend.cpp:62: GGML_ASSERT(buft) failed
WARNING: Using native backtrace. Set GGML_BACKTRACE_LLDB for more info.
0 libggml-base.dylib ggml_print_backtrace + 276
1 libggml-base.dylib ggml_abort + 156
2 libggml-base.dylib ggml_backend_buft_is_host + 0
3 libggml-metal.so ggml_metal_graph_optimize_reorder (lambda) + 364
4 libggml-metal.so ggml_graph_optimize + 2268
5 libggml-base.dylib ggml_backend_sched_split_graph + 6804
6 libllama.metal.b9842.dylib llama_context::graph_reserve + 496
7 libllama.metal.b9842.dylib llama_context::sched_reserve + 2184
8 libllama.metal.b9842.dylib llama_context::llama_context + 4476
9 libllama.metal.b9842.dylib llama_init_from_model + 588
10 llama-addon.node AddonContextLoadContextWorker::Execute + 108
11 llama-addon.node Napi::AsyncWorker::OnExecute + 32
12 bun bun + 10080272
13 bun bun + 11565400
14 libsystem_pthread.dylib _pthread_start + 136
15 libsystem_pthread.dylib thread_start + 8
(Note: the /Users/runner/... path above is from the CI machine that built
the prebuilt binaries, not my machine.)
Repro
Any model.createContext() with GPU enabled crashes this way on M5.
The same model and code work fine with the GPU disabled.
Verified workaround
NODE_LLAMA_CPP_GPU=false + a one-time local source build (cmake required;
there is no prebuilt CPU-only binary for mac-arm64). After that, model load
and context creation work under both Node and Bun.
Happy to run diagnostics on this M5 machine if it helps — I saw in #549 that
M5 hardware is hard to come by for testing.
Issue description
Creating a context crashes the process on an Apple M5 MacBook Air with the
prebuilt Metal binaries shipped in v3.19.0 (llama.cpp build b9842).
Metal shader compilation fails first, then a GGML assert aborts the process.
Possibly related to #549 / #595 (other M5 Metal problems), but the crash
signature is different.
Environment
libllama.metal.b9842.dylib)Error output
(Note: the
/Users/runner/...path above is from the CI machine that builtthe prebuilt binaries, not my machine.)
Repro
Any
model.createContext()with GPU enabled crashes this way on M5.The same model and code work fine with the GPU disabled.
Verified workaround
NODE_LLAMA_CPP_GPU=false+ a one-time local source build (cmake required;there is no prebuilt CPU-only binary for mac-arm64). After that, model load
and context creation work under both Node and Bun.
Happy to run diagnostics on this M5 machine if it helps — I saw in #549 that
M5 hardware is hard to come by for testing.