From 39f4afac204fedf44d4f21836203f42182aa3131 Mon Sep 17 00:00:00 2001 From: slaren Date: Thu, 21 Sep 2023 20:15:22 +0200 Subject: [PATCH] fix metal build --- llama.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llama.cpp b/llama.cpp index c49ac0225..6a025b45e 100644 --- a/llama.cpp +++ b/llama.cpp @@ -6376,7 +6376,7 @@ struct llama_context * llama_new_context_with_model( llama_token token = llama_token_bos(ctx); // not actually used by llama_build_graph, but required to choose between token and embedding inputs graph ggml_cgraph * gf = llama_build_graph(*ctx, &token, NULL, n_tokens, n_past); #ifdef GGML_USE_METAL - if (params.n_gpu_layers > 0) { + if (model->n_gpu_layers > 0) { ctx->ctx_metal = ggml_metal_init(1); if (!ctx->ctx_metal) { LLAMA_LOG_ERROR("%s: ggml_metal_init() failed\n", __func__); @@ -6415,13 +6415,13 @@ struct llama_context * llama_new_context_with_model( } #ifdef GGML_USE_METAL - if (params.n_gpu_layers > 0) { + if (model->n_gpu_layers > 0) { // this allocates all Metal resources and memory buffers void * data_ptr = NULL; size_t data_size = 0; - if (params.use_mmap) { + if (ctx->model.mapping) { data_ptr = ctx->model.mapping->addr; data_size = ctx->model.mapping->size; } else {