mirror of https://github.com/Jittor/Jittor
fix sidx<0 in atomic tuner
This commit is contained in:
parent
727dbc70b8
commit
fc5ee8573e
|
@ -69,6 +69,8 @@ class TestAtomicTunerClass(unittest.TestCase):
|
|||
'atomictuner: move atomicAdd to loop -1',
|
||||
'atomictuner: move atomicAdd to loop -1',
|
||||
])
|
||||
|
||||
self.check(lambda x: x.reindex_reduce("add", x.shape, ["i2","i3","i0","i1"]), [])
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
@ -218,7 +218,7 @@ static void tune_atomic(Pass* pass, KernelIR* ir, bool is_cuda, int tdim, vector
|
|||
|
||||
auto def=p->father->find_define(didx);
|
||||
ASSERT(def != nullptr);
|
||||
if (def->father == loops[sidx])
|
||||
if (sidx>=0 && def->father == loops[sidx])
|
||||
return true;
|
||||
auto& loop_i = loops.at(sidx+1);
|
||||
code = OpCompiler::precompile(defs, t) + ";";
|
||||
|
|
Loading…
Reference in New Issue