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

[DimExpr] DimExpr support print #60146

Merged
merged 9 commits into from
Dec 27, 2023
Merged

Conversation

jiahy0825
Copy link
Contributor

PR types

New features

PR changes

Others

Description

pcard-76996

[DimExpr] DimExpr support print

See test/cpp/pir/shape_dialect/symbol_dim_expr_test.cc for the print result.

Copy link

paddle-bot bot commented Dec 19, 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.

@@ -239,4 +240,8 @@ class ValueShape {

using ValueShapeDimExprs = ValueShape<DimExpr>;
Copy link
Contributor

Choose a reason for hiding this comment

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

这个地方不该应再叫ValueShape了吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

命名修改完毕:#60056

DimExprBuilder builder{nullptr};
DimExpr sym0 = DimExpr("S0");
DimExpr sym1 = DimExpr("S1");
ASSERT_EQ((ToTxtString(sym0 + sym1)), "Add(S0, S1)");
Copy link
Contributor

Choose a reason for hiding this comment

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

函数名是否有点冗长,ToString就可以吧,或者PIR里其实都用的是Print,我觉得可以保持一致

Copy link
Contributor Author

@jiahy0825 jiahy0825 Dec 25, 2023

Choose a reason for hiding this comment

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

有道理,本函数的返回值是 std::string,因此改成了 ToString
DimExpr 已经重载了 operator<< 函数,因此打印时还可以直接调用 VLOG,例如 VLOG(1)<<dim_expr

Copy link
Contributor

@lanxianghit lanxianghit left a comment

Choose a reason for hiding this comment

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

LGTM

@jiahy0825 jiahy0825 merged commit bf4b4b7 into PaddlePaddle:develop Dec 27, 2023
29 checks passed
Wanglongzhi2001 pushed a commit to Wanglongzhi2001/Paddle that referenced this pull request Jan 7, 2024
* DimExpr support print

* ToTxtString

* Fix ASSERT_EQ bug

* Fix typo

* Fix unittest

* ToTxtString->ToString

* Fix windows CI

* ShapeOrData cannot use IR_API
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.

3 participants