-
Notifications
You must be signed in to change notification settings - Fork 5.9k
【CINN】Enrich ability of index expr #68986
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
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
| // TODO(liuruyan): canby simplify into IndexExpr multiply. | ||
| ir::IndexExpr MulAndNormalize(const ir::IndexExpr &lhs, | ||
| const ir::IndexExpr &rhs); | ||
|
|
||
| int32_t CalculateExprComplexity(const Expr &expr, int count = 0); | ||
|
|
||
| // True means don't change sequence | ||
| bool IsCorrectPriority(const Expr &lhs, const Expr &rhs); | ||
|
|
||
| bool IsSumPartialBySymbol(const ir::IndexExpr &expr, | ||
| const ir::IndexExpr &symbol); | ||
|
|
||
| // If true is returned, the operation will be attempted on each subpart in | ||
| // outter `simplify` function. Note: this func dont deal the corner case, e.g. | ||
| // `IsDivisiblieBySymbol(f % S0 - f, S0)` is `false`. please use | ||
| // `ProveDivisible` for exact result. | ||
| bool IsDivisiblieBySymbol(const ir::IndexExpr &expr, | ||
| const ir::IndexExpr &symbol, | ||
| const ir::IrNodeTy &ty); | ||
|
|
||
| bool ProveDivisible(const ir::IndexExpr &lhs, const ir::IndexExpr &rhs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这几个接口再补充一些注释说明,能给出示例的尽量用例子说明一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下一个PR中进行添加
| return ir::Min::Make(a, b); | ||
| } | ||
|
|
||
| int32_t CalculateExprComplexity(const Expr &expr, int count) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里用Complexity是否准确?看着只是做节点数量的统计
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下一个PR中进行更改
| } | ||
| } | ||
|
|
||
| bool IsCorrectPriority(const Expr &lhs, const Expr &rhs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个看上去是做两个Expr的比较,CorrectPriority在语义上看不太出来返回true是左边Priority高还是右边Priority高
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下一个PR中进行更改
* enrich IndexEpxr * fix * fix bug
PR Category
CINN
PR Types
New features
Description
ProveDivisiblewithoutAutoSimplifyandanalyzer.IndexExpr, constant must be at therhsoperand inAddandMul. e.g.AddandMulnow . e.g.Addfor constants. e.g.IsSumPartialBySymbolfunc forAddandIsDivisiblieBySymbolfunc forDiv, It can judge whether the expression can be simplified. if return true, then will applySimplifySymbolicAddandSimplifySymbolicDivideto simplify.Normalizefunc forIndexExpr, Its function is to explicitly reconstruct anIndexExprand simplify it at the same time. It usually use when an unsimplifiedExpris converted to anIndexExprusingas_index(), e.g.Pcard-67164