Browse Source

fix(gopt): fix reorder arith chain pass

GitOrigin-RevId: d3257ac43a
tags/v0.5.0
Megvii Engine Team Xu Xinran 5 years ago
parent
commit
49fdddef8d
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      src/gopt/impl/basic_arith/chain.cpp

+ 10
- 0
src/gopt/impl/basic_arith/chain.cpp View File

@@ -617,6 +617,16 @@ VarNode* ReorderArithChainPass::Impl::reduce_shp2terms(Mode mode) {
}
}

{
// sorted by id(), so the same set of input terms would get the
// same reduced var
auto cmp = [](const ShapedVars::value_type &a,
const ShapedVars::value_type &b) {
return a.second->id() < b.second->id();
};
small_sort(m_const_terms.begin(), m_const_terms.end(), cmp);
small_sort(m_nonconst_terms.begin(), m_nonconst_terms.end(), cmp);
}
merge_shaped_terms(mode, m_const_terms, true);

auto &&all_terms = m_const_terms;


Loading…
Cancel
Save