FastDeploy icon indicating copy to clipboard operation
FastDeploy copied to clipboard

[Feature]Support reorder ids to split prefill and decodes

Open YuanRisheng opened this issue 1 month ago • 2 comments

Motivation

为了能够更好的接入三方Attention,需要对输入进行重排,将prefill token和decode token区分开来,本PR支持了重排功能,目前支持了基础场景及投机解码场景下的重排

Modifications

新增InputBatch结构,用于管理gpu_model_runner的输入,并且添加reorder_split_prefill_and_decode和condense函数支持重排

Usage or Command

在AttentionMetadata中,通过添加enable_ids_reorder字段并设置为True,即可使用P/D重排功能

Accuracy Tests

Checklist

  • [x] Add at least a tag in the PR title.
    • Tag list: [[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]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • [x] Format your code, run pre-commit before commit.
  • [x] Add unit tests. Please write the reason in this PR if no unit tests.
  • [x] Provide accuracy results.
  • [ ] If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

YuanRisheng avatar Nov 24 '25 09:11 YuanRisheng

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Nov 24 '25 09:11 CLAassistant

Thanks for your contribution!

paddle-bot[bot] avatar Nov 24 '25 09:11 paddle-bot[bot]