Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MergedAdamKernel and test for MergedAdamKernel and fix adam caculation process in test #58982

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

HandSomeLEEw
Copy link
Contributor

@HandSomeLEEw HandSomeLEEw commented Nov 14, 2023

PR types

New features

PR changes

OPs

Description

  1. 新增mergedAdamKernel,该Kernel的主要目的是将param打包为一个vector后整体进行运算。Kernel单测结果分别和CPU中adam、mergedAdam以及XPU adam的结果进行比对。
  2. 修正XPU adam单测中模拟的计算结果。
    image

Copy link

paddle-bot bot commented Nov 14, 2023

你的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.

@paddle-bot paddle-bot bot added the contributor External developers label Nov 14, 2023
Copy link

paddle-bot bot commented Nov 14, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

runzhech

This comment was marked as outdated.

import paddle

# from op import Operator
# from op_test_xpu import XPUOpTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要的代码删掉吧。可以攒着和下一个PR一起。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

收到,我这周还会提一个pr,到时候顺便把这里删掉:)


// update param, moment1, moment2
for (int i = 0; i < param_num; i++) {
phi::Copy(dev_ctx, *param[i], dev_ctx.GetPlace(), false, param_out[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个能优化吗?api内部inplace操作

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个确实是导致mergedAdam性能不够好的问题之一,原因就是api的算子接口没有按照标准的inplace来写,而pytorch那边不希望我们更改接口,所以只能暂时这样

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for const_cast to call xpu api

@QingshuChen QingshuChen merged commit cbafa02 into PaddlePaddle:develop Nov 20, 2023
28 checks passed
SecretXV pushed a commit to SecretXV/Paddle that referenced this pull request Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants