-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[XPU] remove cast for elementwise_add(float, bf16/fp16) #64289
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
e547462
to
229f75c
Compare
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的报错信息支持common::errors::XX 类型提示么?如果支持的话,建议加一下报错类型
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的, 我研究下
There was a problem hiding this comment.
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 && |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Category
Custom Device
PR Types
Performance
Description
Reference PR: