Skip to content

llama: refactor llama_decode_impl#11381

Merged
JohannesGaessler merged 1 commit into
ggml-org:masterfrom
JohannesGaessler:llama-prepare-sbatch-ubatch
Jan 27, 2025
Merged

llama: refactor llama_decode_impl#11381
JohannesGaessler merged 1 commit into
ggml-org:masterfrom
JohannesGaessler:llama-prepare-sbatch-ubatch

Conversation

@JohannesGaessler

Copy link
Copy Markdown
Contributor

This PR refactors llama_decode_impl by moving some of the code to functions llama_prepare_sbatch and llama_prepare_ubatch. There should be no change to functionality. The motivation for the change is that this enables re-using the code for training in #10544 .

@ggerganov ggerganov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the #11213 refactoring, the llama_prepare_sbatch and llama_prepare_ubatch will be replaced with something like:

// internal llama_context logic will be implemented
// for example, the llama_prepare_sbatch logic will go here
llama_batch_manager_i bm = lctx.prepare_batch(batch, logits_all);

while (!bm->done()) {
    // the llama_prepare_ubatch() will be implemented here
    llama_ubatch ubatch = bm->next();

    ...
}

Feel free to merge. After merging, I will rebase the #11213 PR to illustrate this.

@JohannesGaessler JohannesGaessler merged commit df984e0 into ggml-org:master Jan 27, 2025
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Feb 26, 2025
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
phibya pushed a commit to ziee-ai/llama.cpp that referenced this pull request May 29, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
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.

2 participants