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

modify GetOutputIters of TrivialOp #64

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions paddle/cinn/hlir/framework/pir/trivial_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,24 @@ struct TrivialOp {
}

std::vector<ir::Var> GetOutputIters() const {
return ComposeUtils::GetOutputIters(
GetSingleStoreExpr(func_body).As<ir::Store>()->indices);
const ir::Expr& output_schedule_block_realize =
(SearchUtils::ChildScheduleBlocks *
SearchUtils::FindFather(GetFuncBody()) *
SearchUtils::FilterMaker([](const ir::Expr& e) -> bool {
return e.As<ir::ScheduleBlockRealize>();
})).GetSingle(GetFuncBody());

const std::vector<Expr>& output_iter_expr =
output_schedule_block_realize.As<ir::ScheduleBlockRealize>()
->iter_values;
std::vector<ir::Var> output_iter_vars;

std::transform(output_iter_expr.begin(),
output_iter_expr.end(),
output_iter_vars.begin(),
[](const Expr& expr) { return expr.as_var_ref(); });

return output_iter_vars;
}

ir::Expr* GetStoreValuePointer() const {
Expand Down Expand Up @@ -569,7 +585,7 @@ struct ReduceOp {
}

std::vector<ir::Var> GetAllIterVars() const {
ir::Expr compute_schedule_block_realize =
const ir::Expr& compute_schedule_block_realize =
(SearchUtils::ChildScheduleBlocks *
SearchUtils::ScheduleBlockIsNotInit *
SearchUtils::FindFather(GetFuncBody()) *
Expand All @@ -591,7 +607,7 @@ struct ReduceOp {
}

std::vector<ir::Var> GetOuterIterVars() const {
ir::Expr init_schedule_block_realize =
const ir::Expr& init_schedule_block_realize =
(SearchUtils::ChildScheduleBlocks * SearchUtils::ScheduleBlockIsInit *
SearchUtils::FindFather(GetFuncBody()) *
SearchUtils::FilterMaker([](const ir::Expr& e) -> bool {
Expand Down