summaryrefslogtreecommitdiff
path: root/llama.cpp
diff options
context:
space:
mode:
authorJhen-Jie Hong <iainst0409@gmail.com>2023-08-14 21:37:39 +0800
committerGitHub <noreply@github.com>2023-08-14 16:37:39 +0300
commitd783f7982e0e823a2626a9956359c0d36c1a7e21 (patch)
treebc9f49614cd4dbb333a964ff221b9c1c1f6ff3a7 /llama.cpp
parentd75561df207d22790609ee0ad924302f66ac2599 (diff)
metal : return null instead of exit(1) (#2573)
Diffstat (limited to 'llama.cpp')
-rw-r--r--llama.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llama.cpp b/llama.cpp
index 0cf2b374..c8ab313d 100644
--- a/llama.cpp
+++ b/llama.cpp
@@ -3337,6 +3337,12 @@ struct llama_context * llama_new_context_with_model(
// this allocates all Metal resources and memory buffers
ctx->ctx_metal = ggml_metal_init(1);
+ if (!ctx->ctx_metal) {
+ LLAMA_LOG_ERROR("%s: ggml_metal_init() failed\n", __func__);
+ llama_free(ctx);
+ return NULL;
+ }
+
void * data_ptr = NULL;
size_t data_size = 0;