Skip to content

[Bug Fix] Fix bug for caching output when preempted - #5502

Merged
qingqing01 merged 1 commit into
PaddlePaddle:developfrom
rainyfly:fix_bug_for_caching_output_when_preempted
Dec 15, 2025
Merged

qingqing01 merged 1 commit into
PaddlePaddle:developfrom
rainyfly:fix_bug_for_caching_output_when_preempted

Conversation

@rainyfly

@rainyfly rainyfly commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

Motivation

当请求被抢占时,此时由于资源被释放,不应该调用cache_output_tokens

Modifications

如果请求在抢占后待重调度的集合中,不调用cache_output_tokens

Usage or Command

None

Accuracy Tests

None

Checklist

  • 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.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • 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.

Copilot AI review requested due to automatic review settings December 11, 2025 06:22
@paddle-bot

paddle-bot Bot commented Dec 11, 2025

Copy link
Copy Markdown

Thanks for your contribution!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

此PR修复了在请求被抢占(preempted)时仍然缓存输出tokens的bug。当任务处于等待重新调度状态时,不应该缓存其输出tokens,否则可能导致缓存状态不一致。

  • 在缓存输出tokens之前添加了对to_be_rescheduled_request_id_set的检查
  • 确保被抢占的请求不会错误地缓存其输出tokens

Comment thread fastdeploy/output/token_processor.py
Comment thread fastdeploy/output/token_processor.py
@codecov-commenter

codecov-commenter commented Dec 11, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@9f4512c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/output/token_processor.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5502   +/-   ##
==========================================
  Coverage           ?   60.35%           
==========================================
  Files              ?      329           
  Lines              ?    41114           
  Branches           ?     6261           
==========================================
  Hits               ?    24816           
  Misses             ?    14398           
  Partials           ?     1900           
Flag Coverage Δ
GPU 60.35% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qingqing01
qingqing01 merged commit 0100ee8 into PaddlePaddle:develop Dec 15, 2025
26 of 32 checks passed
chang-wenbin pushed a commit to chang-wenbin/FastDeploy that referenced this pull request Mar 2, 2026
xiaoguoguo626807 pushed a commit to xiaoguoguo626807/FastDeploy that referenced this pull request May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants