Skip to content

[phi] Migrate update_loss_scaling XPU kernel to PHI.#45515

Closed
jiahy0825 wants to merge 9 commits intoPaddlePaddle:developfrom
jiahy0825:update_loss_scaling
Closed

[phi] Migrate update_loss_scaling XPU kernel to PHI.#45515
jiahy0825 wants to merge 9 commits intoPaddlePaddle:developfrom
jiahy0825:update_loss_scaling

Conversation

@jiahy0825
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

Migrate update_loss_scaling XPU kernel to PHI.

@paddle-bot
Copy link

paddle-bot bot commented Aug 29, 2022

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

@jiahy0825 jiahy0825 force-pushed the update_loss_scaling branch from 850879e to 5b9f827 Compare August 29, 2022 11:07
reinterpret_cast<XPUTyp*>(out_data),
num,
XPUTyp(0.0));
PADDLE_ENFORCE_EQ(r,
Copy link
Contributor

Choose a reason for hiding this comment

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

PADDLE_ENFORCE_XDNN_SUCCESS 请用这个宏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

#include <string>
#include <vector>

#include "paddle/phi/kernels/amp_kernel.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

cc中这个头文件在最前面

Copy link
Contributor

Choose a reason for hiding this comment

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

头文件和cc文件命名保持一致

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

#include "paddle/phi/backends/xpu/xpu_context.h"
#include "paddle/phi/common/amp_type_traits.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/common/scalar.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

scalar.h头文件中有了,是不是不需要include了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jiahy0825
Copy link
Contributor Author

update_loss_scaling and check_finite_and_unscale are both amp ops.
Migrate them through one PR: [phi] Migrate amp XPU kernels to PHI

@jiahy0825 jiahy0825 closed this Aug 30, 2022
@jiahy0825 jiahy0825 deleted the update_loss_scaling branch September 2, 2022 09:24
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