Skip to content

Conversation

@juncaipeng
Copy link
Collaborator

@juncaipeng juncaipeng commented Dec 25, 2025

Motivation

统一准备cpu和storage的cache

Modifications

prefix-cache-manager模块

Usage or Command

不变

Accuracy Tests

后续更新ci镜像后添加单侧

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 25, 2025 12:59
@paddle-bot
Copy link

paddle-bot bot commented Dec 25, 2025

Thanks for your contribution!

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 refactors the cache preparation logic to unify the handling of CPU and storage cache within the prefix_cache_manager module. The main motivation is to consolidate scattered cache preparation code and eliminate duplication between CPU and storage cache handling.

Key Changes:

  • Integrated storage cache matching and preparation logic into the request_match_blocks method in prefix_cache_manager
  • Removed the separate get_storage_cached_blocks method from resource_manager_v1 (though calls to it remain in some code paths outside this diff)
  • Split the gpu_cpu_cache_prepare_time metric into separate cpu_cache_prepare_time and storage_cache_prepare_time metrics for better observability

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
fastdeploy/engine/sched/resource_manager_v1.py Removed duplicate storage cache logic and unused import; updated get_prefix_cached_blocks to handle new consolidated metrics
fastdeploy/cache_manager/prefix_cache_manager.py Integrated storage cache matching into request_match_blocks; added storage cache preparation logic with proper block allocation and recycling; updated return value of issue_prefetch_storage_task to return count instead of list
fastdeploy/engine/request.py Renamed metric field from gpu_cpu_cache_prepare_time to cpu_cache_prepare_time to better reflect its purpose
fastdeploy/cache_manager/cache_metrics.py Added storage cache token tracking throughout metrics calculation and reporting
fastdeploy/cache_manager/cache_transfer_manager.py Improved debug logging by showing counts instead of full lists for better performance
benchmarks/benchmark_serving.py Updated to use new cpu_cache_prepare_time metric name
benchmarks/backend_request_func.py Updated to use new cpu_cache_prepare_time metric name

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 43.52941% with 48 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@9018ccf). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/cache_manager/prefix_cache_manager.py 50.00% 24 Missing and 3 partials ⚠️
fastdeploy/engine/sched/resource_manager_v1.py 8.33% 11 Missing ⚠️
fastdeploy/cache_manager/cache_transfer_manager.py 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5777   +/-   ##
==========================================
  Coverage           ?   66.71%           
==========================================
  Files              ?      347           
  Lines              ?    44354           
  Branches           ?     6810           
==========================================
  Hits               ?    29591           
  Misses             ?    12578           
  Partials           ?     2185           
Flag Coverage Δ
GPU 66.71% <43.52%> (?)

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.

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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit e911ac2 into PaddlePaddle:develop Jan 5, 2026
24 of 26 checks passed
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