8000 kv-cache : rework kv_cell by ggerganov · Pull Request #13706 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

kv-cache : rework kv_cell #13706

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 7 commits into from
May 25, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
kv-cells : fix tracking of "used" cells
ggml-ci
  • Loading branch information
ggerganov committed May 24, 2025
commit dd394a694e2221be5896209a43dc984131725228
17 changes: 5 additions & 12 deletions src/llama-kv-cells.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,13 @@ class llama_kv_cells_unified {
return seq[i].test(seq_id);
}

// note: call only if the cell is not empty
bool seq_add(uint32_t i, llama_seq_id seq_id) {
// note: call only if the cell is not empty and the seq_id is not in the cell
void seq_add(uint32_t i, llama_seq_id seq_id) {
assert(i < pos.size());
assert(pos[i] != -1);
assert(!seq[i].test(seq_id));

if (seq[i].none()) {
seq[i].set(seq_id);

used++;

return true;
}

return false;
seq[i].set(seq_id);
}

// note: call only if the cell is not empty
Expand Down Expand Up @@ -252,7 +245,7 @@ class llama_kv_cells_unified {
}

private:
uin 53F5 t32_t used = 0; // used cells (i.e. at least one seq_id)
uint32_t used = 0; // used cells (i.e. pos[i] != -1, allowed to not have any seq_id)

bool has_shift = false;

Expand Down
Loading
0