Skip to content

Commit fea3c91

Browse files
authored
Merge pull request #321 from ggerganov/sl/aligned-alloc-no-abort
Sl/aligned alloc no abort
2 parents 08828a6 + 20e1211 commit fea3c91

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

Diff for: ggml/src/ggml-backend.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static ggml_backend_buffer_t ggml_backend_cpu_buffer_type_alloc_buffer(ggml_back
798798
void * data = ggml_aligned_malloc(size);
799799

800800
if (data == NULL) {
801-
GGML_LOG_ERROR("%s: failed to allocate buffer of size %zu\n", __func__, size);
801+
GGML_LOG_ERROR("%s: failed to allocate buffer of size %.2f MiB\n", __func__, size / 1024.0 / 1024.0);
802802
return NULL;
803803
}
804804

Diff for: ggml/src/ggml.c

-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ void * ggml_aligned_malloc(size_t size) {
433433
break;
434434
}
435435
GGML_LOG_ERROR("%s: %s (attempted to allocate %6.2f MB)\n", __func__, error_desc, size/(1024.0*1024.0));
436-
GGML_ABORT("fatal error");
437436
return NULL;
438437
}
439438
return aligned_memory;

Diff for: src/llama.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -19534,6 +19534,7 @@ struct llama_context * llama_new_context_with_model(
1953419534

1953519535
if (!llama_kv_cache_init(ctx->kv_self, ctx, type_k, type_v, kv_size, cparams.offload_kqv)) {
1953619536
LLAMA_LOG_ERROR("%s: llama_kv_cache_init() failed for self-attention cache\n", __func__);
19537+
LLAMA_LOG_ERROR("%s: suggestion: try using a smaller context size (-c command line option or llama_context_params.n_ctx)\n", __func__);
1953719538
llama_free(ctx);
1953819539
return nullptr;
1953919540
}

0 commit comments

Comments
 (0)