Questions in lstm.py


#1

when i try tvm/topi/recipe/rnn/lstm.py and build the funtion, i get an error:

TVMError Traceback (most recent call last)
in ()
1 num_step = n_num_step
----> 2 flstm = tvm.build(s, [Xi2h, Wh2h, scan_h, scan_c], “cuda”)
3 ctx = tvm.gpu(0)
4
5 scan_h_np = np.zeros((num_step, batch_size, num_hidden)).astype(“float32”)

/export/userhome/yc/tvm-toolchain/tvm/python/tvm/build_module.pyc in build(inputs, args, target, target_host, name, binds)
583 device_modules = []
584 for tar, flist in target_flist.items():
–> 585 fhost, mdev = _build_for_device(flist, tar, target_host)
586 # Save the current lowered functions of the host and the device module.
587 fhost_all += fhost

/export/userhome/yc/tvm-toolchain/tvm/python/tvm/build_module.pyc in _build_for_device(flist, target, target_host)
416 if current_build_config().detect_global_barrier:
417 func = ir_pass.ThreadSync(func, “global”)
–> 418 func = ir_pass.ThreadSync(func, “shared”)
419 func = ir_pass.ThreadSync(func, “warp”)
420 warp_size = target.thread_warp_size

/export/userhome/yc/tvm-toolchain/tvm/python/tvm/_ffi/_cython/function.pxi in tvm._ffi._cy2.core.FunctionBase.call()
284 cdef TVMValue ret_val
285 cdef int ret_tcode
–> 286 FuncCall(self.chandle, args, &ret_val, &ret_tcode)
287 return make_ret(ret_val, ret_tcode)
288

/export/userhome/yc/tvm-toolchain/tvm/python/tvm/_ffi/_cython/function.pxi in tvm._ffi._cy2.core.FuncCall()
219 nargs = len(args)
220 if nargs <= 3:
–> 221 FuncCall3(chandle, args, nargs, ret_val, ret_tcode)
222 return 0
223

/export/userhome/yc/tvm-toolchain/tvm/python/tvm/_ffi/_cython/function.pxi in tvm._ffi._cy2.core.FuncCall3()
208 for i in range(nargs):
209 make_arg(args[i], &values[i], &tcodes[i], temp_args)
–> 210 CALL(TVMFuncCall(chandle, &values[0], &tcodes[0],
211 nargs, ret_val, ret_tcode))
212 return 0

/export/userhome/yc/tvm-toolchain/tvm/python/tvm/_ffi/_cython/base.pxi in tvm._ffi._cy2.core.CALL()
141 cdef inline CALL(int ret):
142 if ret != 0:
–> 143 raise TVMError(py_str(TVMGetLastError()))
144
145

TVMError: [20:02:49] /export/userhome/yc/tvm-toolchain/tvm/src/pass/storage_sync.cc:76: Check failed: condition_counter() == 0 (1 vs. 0) Cannot insert syncs inside condition

Stack trace returned 10 entries:
[bt] (0) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(dmlc::StackTrace()+0x47) [0x7f3f1bad8817]
[bt] (1) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x18) [0x7f3f1bad8ee8]
[bt] (2) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::ir::ThreadSyncPlanner::Summarize(std::vector<tvm::ir::StorageAccessVisitor::StmtEntry, std::allocatortvm::ir::StorageAccessVisitor::StmtEntry >, HalideIR::Internal::For const*)+0xa6f) [0x7f3f1bcc3e4f]
[bt] (3) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::ir::StorageAccessVisitor::Visit_(HalideIR::Internal::For const*)+0x10f) [0x7f3f1bca221f]
[bt] (4) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::IRFunctor<void (tvm::NodeRef const&, tvm::ir::IRVisitor*)>::operator()(tvm::NodeRef const&, tvm::ir::IRVisitor*) const+0x6a) [0x7f3f1bb2097a]
[bt] (5) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::IRFunctor<void (tvm::NodeRef const&, tvm::ir::IRVisitor*)>::operator()(tvm::NodeRef const&, tvm::ir::IRVisitor*) const+0x6a) [0x7f3f1bb2097a]
[bt] (6) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::ir::IRVisitor::Visit_(HalideIR::Internal::Block const*)+0x15) [0x7f3f1bc4df35]
[bt] (7) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::IRFunctor<void (tvm::NodeRef const&, tvm::ir::IRVisitor*)>::operator()(tvm::NodeRef const&, tvm::ir::IRVisitor*) const+0x6a) [0x7f3f1bb2097a]
[bt] (8) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::ir::StorageAccessVisitor::Visit_(HalideIR::Internal::IfThenElse const*)+0x79) [0x7f3f1bca3d09]
[bt] (9) /export/userhome/yc/tvm-toolchain/tvm/build/libtvm.so(tvm::IRFunctor<void (tvm::NodeRef const&, tvm::ir::IRVisitor*)>::operator()(tvm::NodeRef const&, tvm::ir::IRVisitor*) const+0x6a) [0x7f3f1bb2097a]

Can someone solve this problem?


#2

It has been fixed by PR #2126 :wink:


#3

Thank you very much!