-
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
[PHI] register c_comm_init_all_op to phi #59672
[PHI] register c_comm_init_all_op to phi #59672
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -0,0 +1,34 @@ | |||
/* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. |
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.
2019 -> 2023
namespace operators { | ||
|
||
template <typename T, typename DeviceContext> | ||
class CCommInitAllCpuKernel : public framework::OpKernel<T> { |
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.
这个算子只支持GPU/XPU,可以直接不注册CPU kernel。
protected: | ||
phi::KernelKey GetExpectedKernelType( | ||
const framework::ExecutionContext& ctx) const override { | ||
return phi::KernelKey(framework::proto::VarType::FP32, ctx.GetPlace()); |
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.
这段逻辑是原来就有的吗?
没来是没有的,我看有其他Kernel里面是这样处理没有input的Kernel的, 比如 CSyncCommStreamOp
@@ -0,0 +1,47 @@ | |||
/* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. |
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.
2023
@@ -0,0 +1,80 @@ | |||
/* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. |
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.
2023
namespace ops = paddle::operators; | ||
|
||
PD_REGISTER_STRUCT_KERNEL( | ||
c_comm_init_all, GPU, ALL_LAYOUT, ops::CCommInitAllKernel, float, double) {} |
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.
这种op没有输入输出,kernel应该只需要注册一个特定的数据类型就行了
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.
all done
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 for data registeration
PR types
Others
PR changes
Others
Description
将 c_comm_init_all_op 注册到 PHI 体系下