Skip to content

How does llama.cpp manage the memory? #6323

@VincentXWD

Description

@VincentXWD

Hello, I'm wondering how does llama.cpp manage the memory:

  1. Does llama.cpp allocate space for tensors including static parameter tensors and temporary tensors at once? I only accumulated the allocations of parameter tensors(e.g. blk.0.attn_q.weight) but no more temporary tensors (e.g. inp_embd). Could you please explain where the allocating process is?
  2. Will llama.cpp free all tensors at the end of the model inference process including both parameter tensors and temporary tensors? I'm also wondering where llama.cpp frees these tensors.

I hope I described my confusions properly and thanks for your attention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions