Commit 4073125d by yuliujq Committed by Wuwei Lin

[Bugfix] fskip of EliminateCommonSubexpr cannot always return false (#4620)

* 'fskip' will not always return false

fskip returns false at the end of PackedFunc, discards return true in 'cast' case

* Update build_module.cc
parent efab2c7c
...@@ -318,6 +318,7 @@ class RelayBuildModule : public runtime::ModuleNode { ...@@ -318,6 +318,7 @@ class RelayBuildModule : public runtime::ModuleNode {
pass_seqs.push_back(transform::SimplifyInference()); pass_seqs.push_back(transform::SimplifyInference());
PackedFunc fskip = PackedFunc([](TVMArgs args, TVMRetValue* rv) { PackedFunc fskip = PackedFunc([](TVMArgs args, TVMRetValue* rv) {
Expr expr = args[0]; Expr expr = args[0];
*rv = false;
if (expr.as<CallNode>()) { if (expr.as<CallNode>()) {
auto call_node = expr.as<CallNode>(); auto call_node = expr.as<CallNode>();
auto op_node = call_node->op.as<OpNode>(); auto op_node = call_node->op.as<OpNode>();
...@@ -328,7 +329,6 @@ class RelayBuildModule : public runtime::ModuleNode { ...@@ -328,7 +329,6 @@ class RelayBuildModule : public runtime::ModuleNode {
} }
} }
} }
*rv = false;
}); });
pass_seqs.push_back(transform::EliminateCommonSubexpr(fskip)); pass_seqs.push_back(transform::EliminateCommonSubexpr(fskip));
pass_seqs.push_back(transform::CombineParallelConv2D(3)); pass_seqs.push_back(transform::CombineParallelConv2D(3));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment