Skip to content

Conversation

@juncaipeng
Copy link
Collaborator

@juncaipeng juncaipeng commented Nov 24, 2025

Motivation

resourcemanager 中的 schedue 调用check_and_free_block_tables导致性能下降。

Modifications

移除相关逻辑

Usage or Command

不变

Accuracy Tests

不影响

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 November 24, 2025 05:06
@paddle-bot
Copy link

paddle-bot bot commented Nov 24, 2025

Thanks for your contribution!

Copilot finished reviewing on behalf of juncaipeng November 24, 2025 05:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a performance issue in the V1 KVCache scheduler by relocating the check_and_free_block_tables() call from ResourceManagerV1's schedule() method to the Engine's _schedule_request_to_worker_v1() method, aligning it with the V0 scheduler implementation.

Key Changes:

  • Removed check_and_free_block_tables() call from inside ResourceManagerV1's schedule() method to reduce overhead in the frequently-called scheduling loop
  • Added the same call in Engine's _schedule_request_to_worker_v1() before scheduler.get_requests(), matching the V0 scheduler pattern

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
fastdeploy/engine/sched/resource_manager_v1.py Removed check_and_free_block_tables() call from the schedule() method to reduce performance overhead
fastdeploy/engine/common_engine.py Added check_and_free_block_tables() call in _schedule_request_to_worker_v1() before fetching requests, aligning with V0 scheduler behavior

@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@98f1ab4). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5184   +/-   ##
==========================================
  Coverage           ?   57.65%           
==========================================
  Files              ?      317           
  Lines              ?    38444           
  Branches           ?     5762           
==========================================
  Hits               ?    22166           
  Misses             ?    14500           
  Partials           ?     1778           
Flag Coverage Δ
GPU 57.65% <ø> (?)

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.

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit af03da5 into PaddlePaddle:develop Nov 24, 2025
16 of 17 checks passed
@juncaipeng juncaipeng deleted the fix_1 branch November 24, 2025 08:50
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.

3 participants