Conversation
…ral sequences The per-block (blk_bias) path of set_input_qsa indexes the per-sequence bid arrays by block number (bid_cell[b], bid_idx[b]), but those arrays are indexed by bid, and the block table keys a block on (sequence set, bucket): with more than one sequence in a unified cache the two no longer coincide, so a block gets the visibility of a different sequence's group - one of our blocks can be masked out, one of another sequence's can pass through. Build an inverse block -> bid map once per ubatch, keeping the entry that owns the stream's sequence, and use it for both the seq_has test and the tail comparison. Single-sequence caches are unaffected (one_seq keeps the old correspondence). Reproduced with two live sequences in one stream (llama-server serves each slot as its own sequence from position 0): the model stops seeing its last messages and reports the input as empty. With the change, the same concurrent shape is answered correctly in 4/4 attempts (2/4 before).
2 tasks
|
Hi @akionux, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
This branch has not been deployed
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
Fix the per-block (
blk_bias) path ofset_input_qsa: it indexes the per-sequence bid arrays by block number (bid_cell[b],bid_idx[b]), but those arrays are indexed by bid, and the block table keys a block on (sequence set, bucket). With more than one sequence in a unified cache the two no longer coincide, so a block gets the visibility of a different sequence's group - one of our blocks can be masked out, one of another sequence's can pass through.Build an inverse block -> bid map once per ubatch, keeping the entry that owns the stream's sequence, and use it for both the
seq_hastest and the tail comparison. Single-sequence caches are unaffected (one_seqkeeps the old correspondence).Reproduced with two live sequences in one stream (llama-server serves each slot as its own sequence from position 0): the model stops seeing its last messages and reports the input as empty. With the change, the same concurrent shape is answered correctly in 4/4 attempts (2/4 before).
Additional information
Found while running this branch's QSA path under
--parallel 4with concurrent requests. The companion fixes for the pooled-key-cache-specific paths (per-sequence row windows, own-block fill, stream-inventory sizing) live in #28699; this PR is the part that exists on master on its own.Requirements