CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Inference]Pir support input/output hook #63101
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
using PirHookFunc = | ||
std::function<void(InstructionBase*, ValueExecutionInfo*, Scope*)>; |
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.
这个和上面的IfInstruction里的不需要重复写这个using,paddle/fluid/framework/new_executor/new_executor_defs.h里写过之后,应该都是可以直接用的
using HookFunc = std::function<void(OperatorBase*, Scope*)>; | ||
using PirHookFunc = | ||
std::function<void(InstructionBase*, ValueExecutionInfo*, Scope*)>; |
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/fluid/framework/new_executor/new_executor_defs.h头文件
@@ -723,8 +723,16 @@ void PirInterpreter::BuildInstruction() { | |||
} | |||
} else if (op.dialect()->name() == "pd_op") { | |||
if (op.isa<paddle::dialect::IfOp>()) { // NOLINT | |||
vec_instruction_base_.emplace_back(std::make_unique<IfInstruction>( | |||
op_idx++, place_, &op, value_exe_info_.get(), execution_config_)); | |||
std::unique_ptr<IfInstruction> ifInstrPtr = |
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.
变量的命名我们一般都是小写+下划线,其他地方一并改下
void SetOutputHooks(const std::vector<PirHookFunc>& hookfuncs) override { | ||
pir_output_hookfuncs_ = hookfuncs; | ||
} | ||
|
||
void SetInputHooks(const std::vector<PirHookFunc>& hookfuncs) override { | ||
pir_input_hookfuncs_ = hookfuncs; | ||
} | ||
|
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.
这个文件的修改是完全不需要的哈,这是旧IR相关的
std::vector<PirHookFunc> pir_output_hookfuncs_; | ||
std::vector<PirHookFunc> pir_input_hookfuncs_; | ||
|
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.
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
Inference
PR Types
New features
Description
Python示例:
predictor会在每个op调用时打印op的input信息和output信息

输出结果示例(op name:op id 、tensor name 、tensor value):