Skip to content

llama : optimize memory buffers #2325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2023
Merged

llama : optimize memory buffers #2325

merged 1 commit into from
Jul 22, 2023

Conversation

ggerganov
Copy link
Member

@ghost
Copy link

ghost commented Jul 22, 2023

Hi,

has overall RAM decreased? Here's ./main prior to this commit:

main: build = 878 (b5fe67f)
main: seed  = 1690051538
llama.cpp: loading model from /data/data/com.termux/files/home/llama-2-7b-chat-codeCherryPop.ggmlv3.q4_0.bin
...
llama_model_load_internal: mem required  = 5287.72 MB (+ 1026.00 MB per state)
llama_new_context_with_model: kv self size  = 1024.00 MB

Here's after this commit:

main: build = 879 (b47b8a9)
main: seed  = 1690053156
llama.cpp: loading model from /data/data/com.termux/files/home/llama-2-7b-chat-codeCherryPop.ggmlv3.q4_0.bin
...
llama_model_load_internal: mem required  = 4013.72 MB (+ 1024.00 MB per state)
llama_new_context_with_model: kv self size  = 1024.00 MB

1.2GB freed? Wow?

@ggerganov
Copy link
Member Author

Yes, the allocated buffers should fit more tightly now. There is one dynamic "work" buffer which size is not currently displayed. It is relatively small when not using BLAS and a bit bigger when BLAS is enabled.

Anyway, all this memory management stuff will be further improved in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant