[XPU] fix bug and teporary fix for rope 3d#7465
[XPU] fix bug and teporary fix for rope 3d#7465RuohengMa wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 AI Code Review |
2026-04-17 17:28 CST
📋 Review 摘要
PR 概述:修复 XPU 上 rope_3d 场景下 spliced split kvcache 的崩溃问题,以及 GetInferParam 中 decoder_seq_lod 循环边界 bug。
变更范围:custom_ops/xpu_ops/src/ops/
影响面 Tag:XPU OP
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🟡 建议 | block_attn_spliced.cc:244 |
外层已排除 rope_3d,内层 if (rope_3d) 成为死代码,建议清理 |
| 🟡 建议 | block_attn_spliced.cc:553 |
同上,decoder 路径相同的死代码问题 |
总体评价
本次修复逻辑正确:通过在外层条件加入 !rope_3d 使 rope_3d 场景绕过不支持的 splice 路径,get_infer_param.cc 中循环上界修正与 decoder_seq_lod_vec(大小 bsz + 1)一致,消除了遍历不完整的 bug。建议顺手清理内层已不可达的 if (rope_3d) 死代码块。
| if (FLAGS_encoder_splice) { | ||
| // TODO: spliced split kvcache should support rope3d | ||
| if (FLAGS_encoder_splice && !rope_3d) { | ||
| if (rope_3d) { |
There was a problem hiding this comment.
🟡 建议 外层条件已加入 !rope_3d,此处 if (rope_3d) 永远为 false,PD_THROW 不可达,建议删除这段死代码。
// TODO: spliced split kvcache should support rope3d
if (FLAGS_encoder_splice && !rope_3d) {
- if (rope_3d) {
- PD_THROW("split_kvcache_encoder does not support rope_3d == true!");
- }
paddle::Place place = qkv.place();| if (FLAGS_decoder_splice && !rope_3d) { | ||
| // not yet supported | ||
| if (rope_3d) { | ||
| PD_THROW("split_kvcache_decoder does not support rope_3d == true!"); |
There was a problem hiding this comment.
🟡 建议 与 encoder 路径相同,外层 !rope_3d 使得内层 if (rope_3d) 不可达,建议一并清理。
// TODO: spliced split kvcache should support rope3d
if (FLAGS_decoder_splice && !rope_3d) {
- // not yet supported
- if (rope_3d) {
- PD_THROW("split_kvcache_decoder does not support rope_3d == true!");
- }
if (std::is_same<TKV_CACHE, int8_t>::value &&
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7465 +/- ##
==========================================
Coverage ? 73.87%
==========================================
Files ? 398
Lines ? 54977
Branches ? 8613
==========================================
Hits ? 40613
Misses ? 11649
Partials ? 2715
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:
|
Motivation
fix bug and teporary fix for rope 3d
Modifications
fix bug and teporary fix for rope 3d
Usage or Command
None
Accuracy Tests
None
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.