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

[NewIR]Replace frontend::Program & hlir::Graph with ::ir::Program in CINN #55186

Merged
merged 5 commits into from
Jul 19, 2023

Conversation

Aurelius84
Copy link
Contributor

@Aurelius84 Aurelius84 commented Jul 6, 2023

PR types

New features

PR changes

Others

Description

Pcard-67164

What's New?

see:#56880

以GraphCompiler组件为切入点,解耦CINN框架中的 frontend::Program 和 hlir::frameowork::Graph 与后端AST的依赖,新增 NewIRCompiler,直接上承 ::ir::Program,下接 AST 和 LowerFunc。

为了尽可能保证不影响现有CINN自身的迭代,此PR以及后续适配工作都将「新增并行模块」,方便后续一键切换。

此机制打通工作分为如下几个阶段:

  • 新增 NewIRCompiler 组件,实现 ::ir::Program → Runtime::Instruction 的 lowering 和执行
  • 新增 Runtime Dialect 组件,实现 ::ir::Program → Runtime Dialect 的整理流程
  • 替换主框架端执行逻辑,打通简单网络的 Paddle+CINN 执行流程
  • 优化CINN在::ir 层的组件设计,实现新IR模式流畅一键切换,方便后续推全
  • 统一Paddle 与 CINN 中的部分数据结构,移除::ir 与CINN之间的 Convert 逻辑
  • 适配 build_cinn_pass,支持fusion group 的编译执行

TODO项:

  • 详见代码中注释,后续会提PR逐个支持并删除
image image

@paddle-bot
Copy link

paddle-bot bot commented Jul 6, 2023

你的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.

@paddle-bot
Copy link

paddle-bot bot commented Jul 6, 2023

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@Aurelius84 Aurelius84 force-pushed the ir_cinn branch 2 times, most recently from 1056850 to 2dc6cbc Compare July 6, 2023 08:54
@Aurelius84 Aurelius84 force-pushed the ir_cinn branch 2 times, most recently from a978e4f to 69e99df Compare July 17, 2023 09:45
fix compilation problem

fix conflict

fix conflict

fix unittest

fix unittet

fix cmake

fix cmake
Comment on lines +20 to +21
#include "paddle/fluid/ir/dialect/pd_attribute.h"
#include "paddle/phi/common/data_type.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

cinn对于其他目录的头文件依赖目前有约束要求吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

如果有依赖约束,那可能需要看怎么统一Paddle和CINN底层数据结构了,比如这里的datatype,是否可以独立出来。

Copy link
Contributor

Choose a reason for hiding this comment

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

是的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我来记一下这个TODO,因为目前发现还有很多其他基础数据结构需要独立和统一的

Copy link
Contributor

@zyfncg zyfncg left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants