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

Cinn trivalop fuse #58

Merged
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
11 changes: 9 additions & 2 deletions paddle/cinn/hlir/framework/pir/trivial_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ std::set<Expr> GetStoreFromBody(const ir::Expr& body) {
return store_tensor_exprs;
}

<<<<<<< HEAD
bool CheckIterEq(std::vector<ir::Var> up_iter, std::vector<ir::Var> down_iter) {
TODO
}
Expand Down Expand Up @@ -415,6 +414,14 @@ struct FusionNode {
}

bool IsTrivial() { return std::holds_alternative<TrivialOp>(fusible_op); }

ir::Expr GetExpr(){
if (IsTrivial()){
return std::get<TrivialOp>(fusible_op).GetFuncBody();
}else{
return std::get<ReduceOp>(fusible_op).GetFuncBody();
}
}
};

TrivialOp TTFusion(TrivialOp upstream, TrivialOp downstream) {
Expand Down Expand Up @@ -648,7 +655,7 @@ struct FusionGraph {
std::vector<ir::Expr> GetExprResults() {
std::vector<ir::Expr> output_exprs;
for (const auto& node : all_fusion_nodes_) {
output_exprs.emplace_back(node->op_compute_body);
output_exprs.emplace_back(node->GetExpr());
}
return output_exprs;
}
Expand Down