Skip to content

【CINN】Schedule simplify binding under static shape #69164

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

Merged
merged 11 commits into from
Nov 18, 2024

Conversation

liuruyan
Copy link
Contributor

@liuruyan liuruyan commented Nov 4, 2024

PR Category

CINN

PR Types

New features

Description

  1. IndexExpr adds a func IsDynamic to determine whether the expression contains dynamic shape.
  2. In Cast::Make, if it is IndexExpr and is converted to int64, avoid explicit cast and directly modify the IndexExprtype.
  3. Split/fuse schedule access IterExpr simplification process under static shape.
  4. Indice2AbsOffset enrich simplification capabilities since the expression has been normalized by IterExpr
  5. Add corner case

TODO:Change name of simplify_corner_case.cc to simplify_special_case.cc

Pcard-67164

Copy link

paddle-bot bot commented Nov 4, 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.

@liuruyan liuruyan changed the title Replace simplify 【CINN】sch simplify binding Nov 7, 2024
@liuruyan liuruyan changed the title 【CINN】sch simplify binding 【CINN】Schedule simplify binding under static shape Nov 15, 2024
@@ -37,6 +38,9 @@ Expr PrecedingAxisToAbsOffset(const std::vector<Expr> &shape,

Expr CastIfNeeded(Expr body, Type type);

ir::IndexExpr MergeMulMod(SymbolicExprAnalyzer *analyzer,
Copy link
Contributor

Choose a reason for hiding this comment

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

加些注释说明

Comment on lines +357 to +374
// Get outter loops of current loops.
Expr root = this->GetRootBlock(loop);
std::vector<Expr> outter_loops = GetLoopsOfExpr(loop, root);

// TODO(liujinnan): Deal dynamic shape.
if (!ContainDynamicShape(root)) {
// Create an analyzer of outter loops and new fused loop.
std::vector<Expr> combine_loops = outter_loops;
combine_loops.push_back(new_node);
common::cas_intervals_t var_intervals_t =
common::CollectVarIntervalsOfExprs(combine_loops);
common::SymbolicExprAnalyzer ana{var_intervals_t};

// Simplify the bindings of new fused loop.
VLOG(4) << "Before SimplifyBindings in split, ir is:\n" << new_node;
common::SimplifyBlockBinding::SimplifyBindings(new_node, outter_loops, ana);
VLOG(4) << "After SimplifyBindings in split, ir is:\n" << new_node;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这段代码重复的有点多,看能不能提取一下

@zyfncg zyfncg merged commit 35a727e into PaddlePaddle:develop Nov 18, 2024
27 of 28 checks passed
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