提交 b8d27934 编写于 作者: M Megvii Engine Team

fix(mgb/core): fix opr shallow copy in sublinear

retrive comp_node from output var instead of opr config in sublinear if all outputs were placed on same comp_node

GitOrigin-RevId: a1ed027dacaeae2533059d1eaae6f1cc7910db68
上级 075c4562
......@@ -1239,18 +1239,21 @@ OperatorNodeBase* SeqModifierForSublinearMemory::copy_opr_from_new_inputs(
// and config, we use instance id to differentiate them.
config.name(opr->name() + (recomp ? ":recomp" : ":dup"))
.instance_id(recomp ? nullptr : this);
if (!config.has_comp_node_set()) {
auto out_cn = opr->output(0)->comp_node();
for (auto i : opr->output()) {
auto cn = i->comp_node();
if (out_cn != cn) {
out_cn = {};
break;
}
// Note: if all outputs of op were placed on the same comp_node, since its
// stream maybe changed during seq_comp_node_opt, output's comp_node has
// higher priority than opr->config()
auto out_cn = opr->output(0)->comp_node();
for (auto i : opr->output()) {
auto cn = i->comp_node();
if (out_cn != cn) {
out_cn = {};
break;
}
if (out_cn.valid())
config.comp_node(out_cn);
}
if (out_cn.valid())
config.comp_node(out_cn);
auto opr_new = serialization::copy_opr_shallow(*opr, m_new_inputs, config);
mgb_assert(opr_new != opr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册