Skip to content

[Optim] SWA related performance optimization (part 2/3)#161

Merged
GuoxiaWang merged 4 commits into
PaddlePaddle:mainfrom
Enigmatisms:swa_optim_p1
Jul 8, 2026
Merged

[Optim] SWA related performance optimization (part 2/3)#161
GuoxiaWang merged 4 commits into
PaddlePaddle:mainfrom
Enigmatisms:swa_optim_p1

Conversation

@Enigmatisms

@Enigmatisms Enigmatisms commented Jul 7, 2026

Copy link
Copy Markdown

提升 SWA 层性能。本 PR 的主要操作是:

考虑到 SWA 在 dKV postprocess CP 情况下只需要对一小段进行 post-process(本地段以及本地段前面的 window size 个 token),故新增两个可选参数(start end range),专门用于 contiguous 切分情况下的 dKV postprocess。根据 start end range,进入 post-process 前会对 tensor 进行 seqlen 维度 slice,以降低实际 dKV postprocess 访存量(纯 mem bound 操作)。

本 PR 的功能,在不传入对应 range 时,不影响精度行为。

这是三个拆分优化的第二个:

@Enigmatisms Enigmatisms changed the title [Optim] SWA related performance optimization (part 1/2) [WIP][Optim] SWA related performance optimization (part 2/3) Jul 7, 2026
@Enigmatisms Enigmatisms changed the title [WIP][Optim] SWA related performance optimization (part 2/3) [Optim] SWA related performance optimization (part 2/3) Jul 7, 2026
@GuoxiaWang
GuoxiaWang merged commit 26048f7 into PaddlePaddle:main Jul 8, 2026
1 check passed
@Enigmatisms
Enigmatisms deleted the swa_optim_p1 branch July 10, 2026 06:11
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.

2 participants