backend: make initial buf_size const in model impls

more unifying mpt and gptj code - this one's never written so also
changing the name to be clearer
This commit is contained in:
Aaron Miller 2023-05-15 17:13:05 -07:00 committed by AT
parent 08402a1b64
commit 4cd8bdf9a1
2 changed files with 6 additions and 6 deletions

View File

@ -497,9 +497,9 @@ bool gptj_eval(
const int d_key = n_embd/n_head;
static size_t buf_size = 1024u*MB;
if (!model.buf.addr || model.buf.size < buf_size)
model.buf.resize(buf_size);
const size_t init_buf_size = 1024u*MB;
if (!model.buf.addr || model.buf.size < init_buf_size)
model.buf.resize(init_buf_size);
if (mem_per_token > 0 && mem_per_token*N > model.buf.size) {
const size_t buf_size_new = 1.1*(mem_per_token*N); // add 10% to account for ggml object overhead

View File

@ -469,9 +469,9 @@ bool mpt_eval(
const int d_key = n_embd/n_head;
static size_t buf_size = 1024u*MB;
if (!model.buf.addr || model.buf.size < buf_size)
model.buf.resize(buf_size);
const size_t init_buf_size = 1024u*MB;
if (!model.buf.addr || model.buf.size < init_buf_size)
model.buf.resize(init_buf_size);
if (mem_per_token > 0 && mem_per_token*N > model.buf.size) {
const size_t buf_size_new = 1.1*(mem_per_token*N); // add 10% to account for ggml object overhead