Repository navigation
llama-context : sync pending async copies before clearing embd_seq - #25676
Merged
Merged
Conversation
Contributor
Author
|
Tested on macOS (Apple M5, Metal) with Qwen3-VL-Embedding-2B (Q6_K + f16 mmproj). Following the repro from the issue (#25654), I hammered the endpoint with sequential and concurrent image embedding requests, no abort: cat example.jpg | base64 > ex.b64
REQ='{"input":[{"prompt_string":"<__media__>","multimodal_data":["'$(cat ex.b64)'"]}]}'
# 60 sequential requests
for i in $(seq 1 60); do
curl -s -X POST "http://127.0.0.1:8080/v1/embeddings" \
-H "Content-Type: application/json" -d "$REQ" \
-o /dev/null -w "seq $i: %{http_code}\n"
done
# 8 concurrent requests
for i in $(seq 1 8); do
curl -s -X POST "http://127.0.0.1:8080/v1/embeddings" \
-H "Content-Type: application/json" -d "$REQ" \
-o /dev/null -w "conc $i: %{http_code}\n" &
done
waitAll requests return |
|
@o7si ,FYI, for this particular usecase it might be helpful to iterate different images for testing, cause otherwise server somehow returns cached response, without re-evaluating inference. |
o7si
marked this pull request as ready for review
July 19, 2026 07:57
ggerganov
approved these changes
Jul 30, 2026
huaxel
pushed a commit
to huaxel/CachyLLama
that referenced
this pull request
Aug 2, 2026
ishikawa
added a commit
to ishikawa/llama.cpp
that referenced
this pull request
Aug 9, 2026
#7 (1e08ebf) で追加した encode()/decode() の embd_seq 解放ガード (非同期出力コピー完了を待ってから embd_seq.clear() する) は、upstream 432d7ff (ggml-org#25676, "llama-context : sync pending async copies before clearing embd_seq") で同等のガードが独立に追加され、destructor 側の 同期も含めて fork 版より広い範囲を保護している。 コード上の guard 自体 (if (!embd_seq.empty()) { synchronize(); }) は upstream マージ後も機能的に同一のまま残っているため、revert は差分を 生まない。本コミットは fork 独自のコメント文言を upstream 432d7ff の 文言に揃えることで、fork 独自実装としての痕跡を除き、upstream 追従を 妨げないようにする。
satindergrewal
pushed a commit
to satindergrewal/llama.cpp
that referenced
this pull request
Aug 12, 2026
thecodacus
pushed a commit
to thecodacus/llama.cpp
that referenced
this pull request
Sep 7, 2026
zbrad
pushed a commit
to zbrad/llama.cpp
that referenced
this pull request
Sep 10, 2026
pl752
pushed a commit
to pl752/llama.cpp
that referenced
this pull request
Sep 15, 2026
frostyautumnleaf
pushed a commit
to frostyautumnleaf/llama.cpp
that referenced
this pull request
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes #25654
Pooled embeddings (
--pooling last/mean/cls) are written into the per-sequenceembd_seqbuffers with an asynchronous backend copy.embd_seqis freed at the start of the nextdecode()/encode()(both clear it) and by the destructor, without waiting for the copy.Without that synchronization, the copy can complete after the buffer is freed, writing into freed memory and corrupting the allocator's metadata, which aborts the process on the next allocation:
This PR synchronizes before
embd_seqis cleared indecode()/encode(), and in the destructor before the output buffers are freed.Requirements