[BugFix][XPU] Fix kv_cache management bug#7420
Merged
ddchenhao66 merged 1 commit intoPaddlePaddle:developfrom Apr 16, 2026
Merged
[BugFix][XPU] Fix kv_cache management bug#7420ddchenhao66 merged 1 commit intoPaddlePaddle:developfrom
ddchenhao66 merged 1 commit intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
📋 Review 摘要
PR 概述:修复 XPU model runner 中 KV cache 重复创建的问题
变更范围:fastdeploy/worker/xpu_model_runner.py
影响面 Tag:[XPU] [KVCache]
📝 PR 规范检查
✅ PR 标题和描述符合规范,包含必要的 [BugFix] 和 [XPU] 标签。
问题
未发现阻塞性问题。
总体评价
本次修改将 XPU model runner 的 KV cache 创建逻辑与 GPU/Metax 标准实现对齐。原逻辑只检查 splitwise_role == "mixed",忽略了 num_cpu_blocks 和 kvcache_storage_backend 两个条件,导致在开启 attention store 时会重复创建 KV cache。修改后的逻辑正确地修复了这个问题,代码简洁且符合项目规范。
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7420 +/- ##
==========================================
Coverage ? 74.14%
==========================================
Files ? 394
Lines ? 54759
Branches ? 8577
==========================================
Hits ? 40599
Misses ? 11423
Partials ? 2737
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:
|
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
当xpu开启attention store时,目前会存在在model runner中重复create kv cache的过程,需要解决重复分配cache问题
Modifications
在xpu model runner里修改create kv cache的条件逻辑
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.