-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
New ir support data transfer #54763
New ir support data transfer #54763
Conversation
… add_kernel_dialect
… add_kernel_dialect
… lower_pd_op_to_kernel_dialect
… lower_pd_op_to_kernel_dialect
… lower_pd_op_to_kernel_dialect
… lower_pd_op_to_kernel_dialect
… new_interprector_support_new_IR
… new_interprector_support_new_IR
… new_interprector_support_new_IR
… new_interprector_support_new_IR
… new_ir_support_combine_op
… new_ir_support_combine_op
… new_ir_support_combine_op
… new_ir_support_combine_op
… new_ir_support_combine_op
… new_ir_support_data_transfer
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
… new_ir_support_data_transfer
… new_ir_support_data_transfer
… new_ir_support_data_transfer
… new_ir_support_data_transfer
… new_ir_support_data_transfer
… new_ir_support_data_transfer
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
|
||
if (op->name() == "pd.uniform") { | ||
// try to process uniform, use shape to determin backend | ||
// TODO(phlrain): shuold support other initilize op |
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.
这里的TODO意思是我们要单独处理其他的初始化op?
@@ -166,6 +194,7 @@ std::unique_ptr<ir::Program> PdOpLowerToKernelPass(ir::Program* prog) { | |||
phi::Place cpu_place(phi::AllocationType::CPU); | |||
|
|||
ir::IrContext* ctx = ir::IrContext::Instance(); | |||
ctx->GetOrRegisterDialect<paddle::dialect::PaddleDialect>(); |
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.
这里Dialect的MayBe注册逻辑放到这里感觉有点违和?IrContext 是个单例,我们期望是在某个地方统一注册所有的Dialect,还是说在某个模块用到了,就增量注册下?
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.
我理解是按需添加
paddle::dialect::OpYamlInfoInterface op_info_interface = | ||
(*it)->dyn_cast<paddle::dialect::OpYamlInfoInterface>(); | ||
std::string kernel_fn_str; | ||
std::vector<paddle::dialect::OpInputInfo> input_info; |
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.
std::vector<paddle::dialect::OpInputInfo> input_info; | |
std::vector<paddle::dialect::OpInputInfo> input_infos; |
|
||
if ((i < input_info.size()) && | ||
(!input_info[i].is_mutable_attribute) && | ||
(place != phi::TransToPhiPlace(kernel_key.backend()))) { |
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.
一般我们建议超过2个的条件join操作,使用一个单独的类似 bool need_transform = xxxx && xxx && xxx;
来提升代码可读性
// build memcopy op | ||
auto copy_kernel_key = kernel_key; | ||
copy_kernel_key.set_backend(phi::Backend::GPU); | ||
std::unordered_map<std::string, ir::Attribute> op1_attribute{ |
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.
这里的op1_attribute为什么带了一个数字1的后缀,有什么特殊含义么?以及下面的 op1 变量命名?
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.
这是个不好的习惯,我修正下
@@ -118,5 +118,22 @@ void TransDataBackend(const phi::SelectedRows* tensor, | |||
Backend target_backend, | |||
phi::SelectedRows* out); | |||
|
|||
inline bool NeedTransformPlace(const phi::Place& input, |
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.
inline bool NeedTransformPlace(const phi::Place& input, | |
inline bool NeedTransformPlace(const phi::Place& src_place, |
PR types
Others
PR changes
Others
Description
支持data transfer,当前仅支持place的transfer
Others
Pcard-67164