Repository navigation
server: abstract llama_memory calls to common_memory - #26221
Conversation
|
/bot review |
Automated code reviewReview: server: abstract llama_memory calls to common_memoryScope: a small refactor introducing Will slow the review(point 1) Silent behavioral change in the context-shift path. slot.mem.seq_rm (slot.id, n_keep , n_keep + n_discard);
slot.mem.seq_add(slot.id, n_keep + n_discard, slot.prompt.tokens.pos_next(), -n_discard);The old code called This is plausibly a latent bug fix (the target side was under-shifting), but it's an unstated semantic change bundled into a pure-refactor PR. At minimum it should be called out in the PR description, ideally committed separately, and covered by a test that exercises the mtmd context-shift path (-ctk/-ctv q8_0 included). If the intent was not to change tgt behavior, the end value must be preserved per context, which the current abstraction can't express (see point 3). (point 2) Layering: (point 3) The abstraction doesn't serve the stated future goal. The PR description says the motivation is "multiple contexts in (point 4) Duplicate pointer state in the slot. (point 5) Nits(point 6) No linked issue. This is refactor prep for an unmerged feature (Qwen3-Omni audio output head). Per (point 7) Stray space before (point 8) No security or correctness bugs found beyond the context-shift behavior change in (point 1). The migration of the speculative-decode restore path ( This review was generated automatically by pi coding agent using |
|
I think the most important review would be one from @ggerganov though, not sure if you think it will be a good idea to structure the contexts this way |
|
Yeah I just wanted to check if I'm not missing any behavioral changes with the interleaves. |
|
But I think the "vector of contexts" generalization question is actually a valid one. |
| if (!llama_memory_seq_rm(llama_get_memory(ctx_dft), slot.id, ckpt.pos_max + 1, -1)) { | ||
| GGML_ABORT("failed to remove sequence %d\n", slot.id); | ||
| } |
There was a problem hiding this comment.
It's a good change. This particular call seems a bit out of place - should look for ways in the future to abstract it through common_memory too.
the number of contexts are deterministic, it's fine to keep branching code for now. generalization can be applied in the future, just a cosmetic improvement IMO |
Overview
While trying to implement audio output head for Qwen3-Omni, I realize that we may want to have multiple contexts in
server_contextthat all share the same sequence. So I added a new structcommon_memoryto be able to synchronize among them.Requirements