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

[PIR][CUSTOM PASS] Part1: Reconstruct drr #60783

Merged
merged 6 commits into from
Jan 16, 2024

Conversation

yuanlehome
Copy link
Contributor

@yuanlehome yuanlehome commented Jan 12, 2024

PR types

New features

PR changes

Others

Description

为了支持外部用户使用C++写自定义Pass,需要为Pir/Drr等梳理规范include头文件。作为Part1,本PR将Drr重构了一下,规范出include文件夹。修改主要是如下几点:

  1. 删掉IrValue/IrOperation/TensorInterface等对Pir的外层封装,用户可直接与Pir相关基础组件交互(这些组件后面也会暴露给用户);
  2. 改造了下DrrPatternBase基类,用户继承其后,必须实现operator()和name()纯虚函数,可选实现benefit()虚函数;
  3. 同步修改存量Pass和Demo;
  4. 清理一些文件中无用/无效的include头文件。

修改前Drr目录:
image
修改后Drr目录:
image

Others

Pcard-71500

Copy link

paddle-bot bot commented Jan 12, 2024

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

@yuanlehome yuanlehome changed the title [DRR] Reconstruct drr [CUSTOM PASS] Part1: Reconstruct drr Jan 15, 2024
Comment on lines 42 to 45
virtual std::string pattern_name() const = 0;

// Give the drr pattern benefit.
virtual uint32_t pattern_benefit() const { return 1; }
Copy link
Contributor

@zyfncg zyfncg Jan 15, 2024

Choose a reason for hiding this comment

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

这两个函数命名用大写是不是更规范一些?
image

Copy link
Contributor Author

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.

讨论后,将pattern_name()改为name(), pattern_benefit()改为benefit(),更加直观简洁

@yuanlehome yuanlehome changed the title [CUSTOM PASS] Part1: Reconstruct drr [PIR][CUSTOM PASS] Part1: Reconstruct drr Jan 15, 2024
Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@yuanlehome yuanlehome merged commit 22e8933 into PaddlePaddle:develop Jan 16, 2024
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.

5 participants