diff --git a/otherarch/gpt2_v2.cpp b/otherarch/gpt2_v2.cpp index f8ae9a582..151e9dd4a 100644 --- a/otherarch/gpt2_v2.cpp +++ b/otherarch/gpt2_v2.cpp @@ -372,10 +372,11 @@ bool gpt2_eval( //todo: there is a bug that causes the buffer to oom and I cannot figure it out, hack to increase size for now static size_t buf_size = 256u*1024*1024; + const size_t extra_buf = 64u*1024*1024; static void * buf = malloc(buf_size); if (mem_per_token > 0 && mem_per_token*N*1.6 > buf_size) { - const size_t buf_size_new = 2*(mem_per_token*N); // add 10% to account for ggml object overhead + const size_t buf_size_new = extra_buf + 2*(mem_per_token*N); // add 10% to account for ggml object overhead //printf("\n%s: reallocating buffer from %zu to %zu bytes\n", __func__, buf_size, buf_size_new); // reallocate diff --git a/otherarch/gptj_v2.cpp b/otherarch/gptj_v2.cpp index 307ee5a4e..7d548081c 100644 --- a/otherarch/gptj_v2.cpp +++ b/otherarch/gptj_v2.cpp @@ -383,10 +383,11 @@ bool gptj_eval( //todo: there is a bug that causes the buffer to oom and I cannot figure it out, hack to increase size for now static size_t buf_size = 256u*1024*1024; + const size_t extra_buf = 64u*1024*1024; static void * buf = malloc(buf_size); - if (mem_per_token > 0 && mem_per_token*N*1.4 > buf_size) { - const size_t buf_size_new = 1.6*(mem_per_token*N); // add 10% to account for ggml object overhead + if (mem_per_token > 0 && mem_per_token*N*1.5 > buf_size) { + const size_t buf_size_new = extra_buf + 1.6*(mem_per_token*N); // add 10% to account for ggml object overhead //printf("\n%s: reallocating buffer from %zu to %zu bytes\n", __func__, buf_size, buf_size_new); // reallocate diff --git a/otherarch/neox.cpp b/otherarch/neox.cpp index 14c9f5b74..5b9656aa5 100644 --- a/otherarch/neox.cpp +++ b/otherarch/neox.cpp @@ -365,10 +365,11 @@ bool stablelm_eval( const int n_rot = hparams.n_rot; static size_t buf_size = 256u*1024*1024; + const size_t extra_buf = 64u*1024*1024; static void * buf = malloc(buf_size); - if (mem_per_token > 0 && mem_per_token*N*1.2 > buf_size) { - const size_t buf_size_new = 1.4*(mem_per_token*N); // add 10% to account for ggml object overhead + if (mem_per_token > 0 && mem_per_token*N*1.5 > buf_size) { + const size_t buf_size_new = extra_buf + 1.6*(mem_per_token*N); // add 10% to account for ggml object overhead //printf("\n%s: reallocating buffer from %zu to %zu bytes\n", __func__, buf_size, buf_size_new); // reallocate