Skip to content

llama : refactor sampling_info to use buffer_view template#19368

Merged
danbev merged 4 commits into
ggml-org:masterfrom
danbev:llama-context-sampling-buffer-view
Feb 11, 2026
Merged

llama : refactor sampling_info to use buffer_view template#19368
danbev merged 4 commits into
ggml-org:masterfrom
danbev:llama-context-sampling-buffer-view

Conversation

@danbev

@danbev danbev commented Feb 5, 2026

Copy link
Copy Markdown
Member

This commit updates the sampling_info struct in llama-context to use a buffer_view template for the logits, probs, sampled tokens, and candidates buffers.

The motivation for this is to simplify the code, improve type safety and readability.

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
Comment thread src/llama-context.h Outdated
@danbev danbev marked this pull request as ready for review February 6, 2026 12:24

@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.

For consistency, the non-sampling logits and embeddings could be wrapped in buffer view as well

This commit applies the same changes as was done previously for the
sampling_info struct where some of the members were updated to use
buffer_view. In this commit, the logits and embd members of
llama_context are updated to use buffer_view instead of raw pointers and
separate size for consistency.

@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.

Can merge if the CI is green

The previous commit updated the resetting of the logits and embd
pointer by resetting the entire buffer_view. But original version only
reset the data pointers and not the size. This commit updates the
resetting to only reset the data pointers and not the size to match the
original functionality. In this way the size is preserved and not reset
to 0.
@danbev danbev merged commit 2cce9fd into ggml-org:master Feb 11, 2026
76 of 78 checks passed
@danbev danbev deleted the llama-context-sampling-buffer-view branch February 11, 2026 04:38
liparetejas pushed a commit to liparetejas/llama.cpp that referenced this pull request Feb 23, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
bartowski1182 pushed a commit to bartowski1182/llama.cpp that referenced this pull request Mar 2, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
ArberSephirotheca pushed a commit to ArberSephirotheca/llama.cpp that referenced this pull request Mar 3, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
rsenthilkumar6 pushed a commit to rsenthilkumar6/llama.cpp that referenced this pull request May 1, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
fewtarius pushed a commit to fewtarius/llama.cpp that referenced this pull request May 30, 2026
…19368)

* llama : refactor sampling_info to use buffer_view template

This commit updates the sampling_info struct in llama-context to use a
buffer_view template for the logits, probs, sampled tokens, and
candidates buffers.

The motivation for this is to simplify the code, improve type safety
and readability.
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