Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lshpku
Copy link
Contributor

@lshpku lshpku commented Aug 12, 2025

PR Category

Operator Mechanism

PR Types

New features

Description

新增paddle.incubate.nn.functional.fused_partial_rope(x, cos, sin)算子

该算子是DeepseekV3使用的一种“部分RoPE“算子,即对于输入 x[bs, seq_len, num_heads, head_dim],首先将 head_dim 拆分成 nope_head_dim + pe_head_dim,然后只在 pe_head_dim 上进行RoPE,最后合并回来

注意到,该算子只有一个输入x,因此 q 和 k 需要分别处理;这是模仿DSV3的timeline实现的,因为它的 q 比 k 大很多,分开处理更好实现

PaddleNLP修改已合入:PaddlePaddle/PaddleNLP#10942
(用了分支的形式,旧版的Paddle还能跑老的分支,新版Paddle就自动使用融合算子)

Pcard-85711

@paddle-bot
Copy link

paddle-bot bot commented Aug 12, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@lshpku lshpku force-pushed the fused-partial-rope branch 3 times, most recently from f14d16f to 64ec214 Compare August 14, 2025 01:53
@lshpku lshpku force-pushed the fused-partial-rope branch from 64ec214 to 4710dc2 Compare August 14, 2025 07:58
@codecov-commenter
Copy link

Codecov Report

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

Files with missing lines Patch % Lines
...addle/incubate/nn/functional/fused_partial_rope.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #74577   +/-   ##
==========================================
  Coverage           ?   97.29%           
==========================================
  Files              ?        3           
  Lines              ?       37           
  Branches           ?        0           
==========================================
  Hits               ?       36           
  Misses             ?        1           
  Partials           ?        0           

☔ 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.

@lshpku lshpku merged commit 20e50fb into PaddlePaddle:develop Aug 15, 2025
96 of 100 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