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] remove cast for elementwise_add(float, bf16/fp16) #64289

Merged
merged 3 commits into from
May 16, 2024

Conversation

dynamicheart
Copy link
Contributor

@dynamicheart dynamicheart commented May 14, 2024

Copy link

paddle-bot bot commented May 14, 2024

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

ret = xpu::add_mul_type<float, XPUYType, float>(
dev_ctx.x_context(), x_data, y_data, z_data, x.numel());
}
PADDLE_ENFORCE_XDNN_SUCCESS(ret, "add_mul_type");
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的报错信息支持common::errors::XX 类型提示么?如果支持的话,建议加一下报错类型

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的, 我研究下

Copy link
Contributor Author

Choose a reason for hiding this comment

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

目前原本的XPUElementwise里面也是调用的PADDLE_ENFORCE_XDNN_SUCCESS,包括其它XPU算子也是用的PADDLE_ENFORCE_XDNN_SUCCESS,至于common::errors::XX报错信息的建议后续可以专门批量去改,看看是否能加到PADDLE_ENFORCE_XDNN_SUCCESS宏里面

@@ -145,6 +145,11 @@ inline bool NeedTypePromotion(const std::string& op_name,
(y == phi::DataType::BFLOAT16 || y == phi::DataType::FLOAT16)) {
return false;
}
#elif defined(PADDLE_WITH_XPU)
if ((op_name == "add" || op_name == "add_") && x == DataType::FLOAT32 &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Aurelius84 @zxcd 麻烦看看CUDA版本是否是漏了add_算子,这样XPU和CUDA可以合并,add_(fp32, bf16/fp16)最一开始的需求是来自于main_grad的inplace_add:https://github.com/PaddlePaddle/Paddle/pull/54415/files#diff-1c8fea91efa1fa5f00f4b766fb11723120b74ec26365724cca4be8a0792946d9R62

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

@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

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

@QingshuChen QingshuChen merged commit 610f7dd into PaddlePaddle:develop May 16, 2024
31 checks passed
@houj04 houj04 added the XPU label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants