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

[XPU] add some bf16 ops for kl3 #59263

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

houj04
Copy link
Contributor

@houj04 houj04 commented Nov 22, 2023

PR types

New features

PR changes

OPs

Description

  • 在跑某个模型训练的时候,遇到了一批需要bfloat16类型的算子,本PR添加了kl3下面的一批注册。
  • AdamW里面有一个获得最大值的临时空间,在kl2和kl3下面findmax函数返回的结果个数不同,因此换了写法。
  • 还有已知的一批算子需要增加注册,但是可能依赖新版本XDNN,并且一个PR内修改太多文件不是一个好的行为,因此本PR先添加一部分。
  • TODO:继续补剩下的算子,以及跑KL3单测。目前的这批修改在某个砍规模之后的模型上能跑通。

Copy link

paddle-bot bot commented Nov 22, 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 22, 2023
Copy link
Contributor

@zhangyk0314 zhangyk0314 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@cqulilujia cqulilujia left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -31,16 +31,17 @@ float GetAbsMax(const Context& dev_ctx,
const float* input,
float* buffer_xpu,
int64_t numel) {
float buffer_cpu[6];
int max_ptr_size = phi::backends::xpu::get_xpu_max_ptr_size(-1);
float buffer_cpu[12]; // 12 is enough even for XPU3
Copy link
Contributor

Choose a reason for hiding this comment

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

XPU3还需要这个优化吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

显存足够的话很可能不需要了,但是也留着以防万一。不刷那个环境变量就不会启动。

@QingshuChen QingshuChen merged commit 723f2d3 into PaddlePaddle:develop Nov 23, 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.

4 participants