Skip to content
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 executor]Support CINN use InterpreterCore #48911

Merged

Conversation

zhangbo9674
Copy link
Contributor

@zhangbo9674 zhangbo9674 commented Dec 8, 2022

PR types

New features

PR changes

Others

Describe

CINN 后端执行支持 InterpreterCore,具体工作包括:

  • CinnLaunchContext 添加成员变量:unique_ptrframework::ProgramDesc、unique_ptrframework::InterpreterCore以及成员函数:InitializeInterpreterCore,用于创建&缓存新执行器后端执行所需数据结构,设计思路可类比原PE执行逻辑。
  • cinn_launch_op kernel实现添加采用新执行器执行逻辑,通过FLAGS_enable_interpretercore_launch_cinn控制是否生效。

@paddle-bot
Copy link

paddle-bot bot commented Dec 8, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

CtfGo
CtfGo previously approved these changes Dec 21, 2022
Copy link
Contributor

@CtfGo CtfGo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

zhiqiu
zhiqiu previously approved these changes Dec 23, 2022
Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 108 to 109
framework::Scope* scope1 = new framework::Scope();
RunAndCheck(place, scope1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
framework::Scope* scope1 = new framework::Scope();
RunAndCheck(place, scope1);
framework::Scope scope1;
RunAndCheck(place, &scope1);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, tks!

@zhangbo9674 zhangbo9674 dismissed stale reviews from zhiqiu and CtfGo via e280de5 December 23, 2022 07:16
Copy link
Member

@zhhsplendid zhhsplendid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

framework::Scope& exec_scope = scope.NewScope();
auto* pe = launch_context->InitializePE(place, &exec_scope);
pe->RunWithoutFetch(launch_context->GetSkipEagerVars());
if (FLAGS_enable_interpretercore_launch_cinn) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

从逻辑上,把interpreter core 放在pe的判断外面,是不是更好一些

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据@CtfGo的review意见,目前CINN的一些开发工作通过FLAGS_enable_pe_launch_cinn控制,因此暂时将新执行器模块放在这个flag的控制下,后续清理pe的工作开展的时候会吧FLAGS_enable_pe_launch_cinn全局替换为FLAGS_enable_interpretercore_launch_cinn

Copy link
Contributor

@From00 From00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for mutable_data

Copy link
Contributor

@zhiqiu zhiqiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhangbo9674 zhangbo9674 merged commit 2ca3d3f into PaddlePaddle:develop Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants