[BugFix] fix multi-step mtp bug#6754
Merged
Merged
Conversation
|
Thanks for your contribution! |
kevincheng2
requested changes
Mar 10, 2026
| num_new_tokens = self._get_num_new_tokens(request, token_budget) | ||
| if num_new_tokens == 0: | ||
| num_new_block = self.get_new_block_nums(request, num_new_tokens) | ||
| if num_new_block == 0: |
Collaborator
There was a problem hiding this comment.
想了一下,这里num_new_block == 0 的场景也是要插入计算的。cache完全命中的场景已经有了足够的block,不需要再分配block,但还需要插入计算。可以还原回之前的num_new_tokens 判断
| num_new_block, request.request_id | ||
| ) | ||
| request.block_tables.extend(extra_gpu_block_ids) | ||
| extra_gpu_block_ids = self.cache_manager.allocate_gpu_blocks( |
Collaborator
There was a problem hiding this comment.
这里可以把之前的 skip_allocate 判断改成 if num_new_block > 0 ?
| # Allocate blocks for the tokens that does not hit cache | ||
| num_new_tokens = self._get_num_new_tokens(request, token_budget) | ||
| if num_new_tokens == 0: | ||
| num_new_block = self.get_new_block_nums(request, num_new_tokens) |
| num_new_block, request.request_id | ||
| ) | ||
| request.block_tables.extend(extra_gpu_block_ids) | ||
| extra_gpu_block_ids = self.cache_manager.allocate_gpu_blocks( |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6754 +/- ##
==========================================
Coverage ? 72.20%
==========================================
Files ? 394
Lines ? 54211
Branches ? 8493
==========================================
Hits ? 39145
Misses ? 12267
Partials ? 2799
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
75baeab to
1ac51fe
Compare
kevincheng2
approved these changes
Mar 11, 2026
mattheliu
pushed a commit
to mattheliu/FastDeploy
that referenced
this pull request
Apr 1, 2026
xiaoguoguo626807
pushed a commit
to xiaoguoguo626807/FastDeploy
that referenced
this pull request
May 7, 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.
Motivation
多步step需要的cache kv长度是超过原始prompt长度的,所以在分配block时需要多分配一个。
Modifications
删掉skip_allocate判断,即使cache完全命中,在mtp下也会多分配一个给当前req。
Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.