8000 llama : refactor llama_context, llama_kv_cache, llm_build_context (v2) by ggerganov · Pull Request #12181 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

llama : refactor llama_context, llama_kv_cache, llm_build_context (v2) #12181

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 16 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
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
Next Next commit
graph : rework inputs to use only unique_ptr, remove attn input abstr…
…action

ggml-ci
  • Loading branch information
ggerganov committed Mar 12, 2025
commit 562a47870b60cd2a403991a60498818f7dcbb10c
6 changes: 3 additions & 3 deletions src/llama-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,13 +1874,11 @@ llm_graph_result_ptr llama_context_kv_self::build_kv_self_shift(

//GGML_ASSERT(kv_self->size == n_ctx);

auto inp = std::make_shared<llm_graph_input_k_shift>(kv_self.get());
auto inp = std::make_unique<llm_graph_input_k_shift>(kv_self.get());

inp->k_shift = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, cparams.n_ctx);
ggml_set_input(inp->k_shift);

res->add_input(inp);

for (uint32_t il = 0; il < n_layer; ++il) {
const int64_t n_head_kv = hparams.n_head_kv(il);
const int64_t n_embd_k_gqa = hparams.n_embd_k_gqa(il);
Expand All @@ -1899,6 +1897,8 @@ llm_graph_result_ptr llama_context_kv_self::build_kv_self_shift(
ggml_build_forward_expand(gf, cur);
}

res->add_input(std::move(inp));

return res;
}

Expand Down
Loading
0