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

[IR] refactor the verify module. #54895

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

winter-wang
Copy link
Contributor

@winter-wang winter-wang commented Jun 26, 2023

PR types

New features

PR changes

APIs

Description

新IR的verify重构。

1. Verify函数重构

之前的verify的函数形式是

class ConcreteOp : OpBase<ConcreteOp, .....>{
   static void Verify(const std::vector<ir::OpResult> &inputs,
                                const std::vector<ir::Type> &outputs,
                                const ir::AttributeMap &attributes);
}

这种形式的用法是在oepration创建之前其参数进行verify。

但随着pass引入的operation mutation操作,operation在创建之后,也有可能因为mutation操作导致它变得不合法。

因此,本pr将Verify重构为

class ConcreteOp : OpBase<ConcreteOp, .....>{
   void Verify();
}

用法是在oepration创建之后随时可以其进行Verify。这样,pass在对operation进行mutation之后,也可以方便地进行Verify。

2. fluid下Verify函数自动生成模块重构

本pr将paddle/fluid/ir/dialect/下新建 op_verify_gen.py文件。 对op的verify函数生成逻辑进行了模块化分割。

Other

Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Jun 26, 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.

@winter-wang winter-wang force-pushed the ir_develop_2 branch 4 times, most recently from cbcd746 to 92a1a11 Compare June 27, 2023 02:54
@winter-wang winter-wang changed the title Ir develop 2 [IR] refactor the verify module. Jun 27, 2023
@winter-wang winter-wang force-pushed the ir_develop_2 branch 3 times, most recently from d019e74 to e596527 Compare June 27, 2023 03:43
@winter-wang winter-wang merged commit 9665226 into PaddlePaddle:develop Jun 27, 2023
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.

2 participants