未验证 提交 edfc1ab8 编写于 作者: 傅剑寒 提交者: GitHub

rewrite SimplifyForLoop (#56350)

上级 b1573431
...@@ -182,6 +182,7 @@ std::shared_ptr<OpStrategy> StrategyForReduce( ...@@ -182,6 +182,7 @@ std::shared_ptr<OpStrategy> StrategyForReduce(
// support the length-1 for loop yet. So we simplify here. The todo // support the length-1 for loop yet. So we simplify here. The todo
// is that remove SimplifyForLoops below and change reduction schedule // is that remove SimplifyForLoops below and change reduction schedule
optim::SimplifyForLoops(&temp); optim::SimplifyForLoops(&temp);
optim::SimplifyBlocks(&temp);
vec_ast.emplace_back(temp); vec_ast.emplace_back(temp);
} else if (arg_pack[i].is_tensor()) { } else if (arg_pack[i].is_tensor()) {
Expr temp = arg_pack[i]; Expr temp = arg_pack[i];
......
...@@ -339,12 +339,9 @@ struct SimplifyForLoopsMutator : public ir::IRMutator<> { ...@@ -339,12 +339,9 @@ struct SimplifyForLoopsMutator : public ir::IRMutator<> {
std::string var_name = node->loop_var->name; std::string var_name = node->loop_var->name;
var_intervals.emplace( var_intervals.emplace(
var_name, common::CasInterval{min_i->value, extent_i->value - 1}); var_name, common::CasInterval{min_i->value, extent_i->value - 1});
if (node->body.As<ir::Block>() &&
node->body.As<ir::Block>()->stmts.size() == 1) { *expr = node->body;
*expr = node->body.As<ir::Block>()->stmts[0];
} else {
*expr = node->body;
}
Visit(expr, expr); Visit(expr, expr);
var_intervals.erase(var_name); var_intervals.erase(var_name);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册