From 00cca253e352b38dfbc4f2571f1d70778d469062 Mon Sep 17 00:00:00 2001 From: Arik Poznanski Date: Sat, 15 Apr 2023 20:48:26 +0300 Subject: [PATCH] Made the assessors functions for static maps be static const --- llama.cpp | 8 ++++---- tests/test-tokenizer-0.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/llama.cpp b/llama.cpp index 2b3756160..b68e1600f 100644 --- a/llama.cpp +++ b/llama.cpp @@ -42,7 +42,7 @@ static const size_t MB = 1024*1024; // TODO: dynamically determine these sizes // needs modifications in ggml -std::map& MEM_REQ_SCRATCH0() +static const std::map & MEM_REQ_SCRATCH0() { static std::map _MEM_REQ_SCRATCH0 = { { MODEL_7B, 512ull * MB }, @@ -53,7 +53,7 @@ std::map& MEM_REQ_SCRATCH0() return _MEM_REQ_SCRATCH0; } -std::map& MEM_REQ_SCRATCH1() +static const std::map & MEM_REQ_SCRATCH1() { static std::map _MEM_REQ_SCRATCH1 = { { MODEL_7B, 512ull * MB }, @@ -65,7 +65,7 @@ std::map& MEM_REQ_SCRATCH1() }; // 2*n_embd*n_ctx*n_layer*sizeof(float16) -std::map& MEM_REQ_KV_SELF() +static const std::map & MEM_REQ_KV_SELF() { static std::map _MEM_REQ_KV_SELF = { { MODEL_7B, 1026ull * MB }, @@ -78,7 +78,7 @@ std::map& MEM_REQ_KV_SELF() // this is mostly needed for temporary mul_mat buffers to dequantize the data // not actually needed if BLAS is disabled -std::map& MEM_REQ_EVAL() +static const std::map & MEM_REQ_EVAL() { static std::map _MEM_REQ_EVAL = { { MODEL_7B, 768ull * MB }, diff --git a/tests/test-tokenizer-0.cpp b/tests/test-tokenizer-0.cpp index 59350e2fe..b08984571 100644 --- a/tests/test-tokenizer-0.cpp +++ b/tests/test-tokenizer-0.cpp @@ -5,7 +5,7 @@ #include #include -std::map>& k_tests() +static const std::map> & k_tests() { static std::map> _k_tests = { { "Hello World", { 1, 10994, 2787, }, },