polish loop var find out

This commit is contained in:
Dun Liang 2021-02-01 14:24:34 +08:00
parent 71bff3118e
commit 4ec9ace622
2 changed files with 15 additions and 1 deletions

View File

@ -8,7 +8,7 @@
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.2.2.25'
__version__ = '1.2.2.26'
from . import lock
with lock.lock_scope():
ori_int = int

View File

@ -245,6 +245,20 @@ void LoopVarAnalyzePass::run() {
auto name2 = pm->oc->get_name_by_op_output(opa, j);
replace_vars.emplace_back(name1, name2);
}
// dirty fix wrong array fuse
if (max_elm_size>1)
for (int i=0; i<this->op->ops.size(); i++) {
auto op = this->op->ops[i];
if (op->type() == OpType::element &&
op->name() != string("array") &&
op->outputs().front()->num == 1) {
replace_vars.emplace_back("op"+S(i)+"_xstride0", "0");
replace_vars.emplace_back("op"+S(i)+"_ystride0", "0");
replace_vars.emplace_back("op"+S(i)+"_zstride0", "0");
}
}
LOGvvv << "replace_vars" << replace_vars;
ir->replace(replace_vars);