-
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
[IR] Support GC and TraceRun for NewIr InterpreterCore #55772
[IR] Support GC and TraceRun for NewIr InterpreterCore #55772
Conversation
… dev/dependency_new_ir_exe
… dev/construct_event
… dev/construct_event
… dev/construct_event
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
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 overall
@@ -37,6 +37,19 @@ InterpreterCoreEventGarbageCollector::InterpreterCoreEventGarbageCollector( | |||
} | |||
} | |||
|
|||
InterpreterCoreEventGarbageCollector::InterpreterCoreEventGarbageCollector( | |||
const std::vector<std::unique_ptr<InstructionBase>>& vec_instruction) { |
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.
后续我们讨论下参数命名规范,是否需要以 type 的前缀来标记,比如vec_
、map_
。目前有的采用instructions
这种带 s
后缀来表示 list信息的(我个人是倾向于后者的,因为可以跟类型解耦。)
/*allow_spinning*/ true, | ||
/*track_task*/ false); | ||
queue_ = CreateSingleThreadedWorkQueue(options); | ||
for (auto& instruc : vec_instruction) { |
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.
对于for-loop的缩写变量命令也可以留意一下,instr
比 instruc
更常见?或者不想起名,直接instruction
来用(搭配前面的 instructions)可以很好区别。
} | ||
return -1; |
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_THROW?caller需要处理这个-1么?
|
||
auto op_downstream_map = dependency_builder_.OpDownstreamMap(); | ||
|
||
VLOG(4) << "1"; |
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.
下个PR可以清理下这里的调试log
|
||
std::stringstream ss; | ||
ss << "trace order: "; | ||
for (size_t idx = 0; idx < trace_execute_order_.size(); idx++) { |
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.
这里总会执行的,建议使用 if(VLOG_IS_ON(6)){XXX}
@@ -1725,5 +1686,455 @@ void NewIRInterpreter::BuildInstructionDependences() { | |||
} | |||
} | |||
|
|||
void NewIRInterpreter::RecordMemcpyD2H(InstructionBase* instr_node) { | |||
// NOTE(zhiqiu): hot fix for jit input var | |||
if (instr_node->Name() == "pd.memcpy_d2h") { |
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下的头文件,定义所有这些特殊Op name,这样我们就知道初期我们累计了多少TODO的分支逻辑了,后续也好专项清理
VLOG(4) << "var_ref_count_.size() : " << var_ref_count_.size(); | ||
for (size_t i = 0; i < last_live_ops_.size(); ++i) { | ||
std::set<size_t> minumum_last_live_ops; | ||
for (auto val : last_live_ops_[i]) { |
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相关的for循环?看起来总会执行?
refs_.emplace_back(std::make_shared<interpreter::VarRefInfo>( | ||
var_ref_count_[i], variable_list_[i])); | ||
} | ||
VLOG(4) << "calculate last_live_ops_ 3"; |
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 文案,或者考虑删除掉~~
PR types
New features
PR changes
Others
Description
基于新 IR InstructionBase 体系,支持 Gc 及 TraceRun,跑通 standalone_executor_new_ir_test 单测。
后续工作:
Others
Pcard-67164