-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support FP16 mean #38289
Support FP16 mean #38289
Conversation
Thanks for your contribution! |
private: | ||
T n_inv; | ||
}; | ||
|
||
template <typename T> | ||
__global__ void MeanRunKernel(const T* in_data, T* out_data, int N) { |
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.
目前mean 和reducemean调用的都是pten里面的reduce,由chen tian yu进行修改。可以确认一下修改是否起作用了
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.
已打log确认,确实能调到,因为PTen没有FP16的注册。后续PR会在PTen里添加注册。
@@ -77,7 +77,7 @@ struct CustomSub { | |||
|
|||
template <typename Tx, typename Ty = Tx> | |||
struct CustomMean { | |||
using Transformer = kps::DivideFunctor<Tx>; | |||
using Transformer = kps::DivideFunctor<Tx, Ty>; |
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.
在最新的reduce_op.cu.h中是没用到CustomMean的,本来计划删除,但是pten用到了,你只修改这里是不会对pten中reduce实现有修改的,不过他们好像在移动代码
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.
已打log确认,确实能调到,因为PTen没有FP16的注册。后续PR会在PTen里添加注册。
@@ -19,5 +19,7 @@ | |||
REGISTER_OP_CUDA_KERNEL( | |||
reduce_mean, | |||
ops::ReduceCudaKernel<bool, kps::AddFunctor, kps::DivideFunctor>, | |||
ops::ReduceCudaKernel<paddle::platform::float16, kps::AddFunctor, | |||
kps::DivideFunctor>, |
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.
chentianyu说对于mean和sum pten内部是添加了注册的,请确认修改这里是否真正能够调用fp16
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.
已打log确认,确实能调到,因为PTen没有FP16的注册。后续PR会在PTen里添加注册。
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 types
Others
PR changes
OPs
Describe
Support FP16 for
mean
andreduce_mean
ops.