Describe the bug
Codes crashed with RuntimeError: [verify.cpp:visit@60] stmt_list->parent == current_block after updating from 0.6.10 to 0.6.17 / 0.6.20
To Reproduce
# Related memory allocation part
grid_snode = ti.root.dense(ti.ij, self.grid_pos)
grid_snode.place(self.grid_num_particles)
grid_snode.dense(ti.k, self.max_num_particles_per_cell).place(self.grid2particles)
nb_node = ti.root.dynamic(ti.i, max_num_particles)
nb_node.place(self.particle_num_neighbors)
nb_node.dense(ti.j, self.max_num_neighbors).place(self.particle_neighbors)
@ti.kernel
def search_neighbors(self):
for p_i in range(self.particle_num[None]):
pos_i = self.particle_positions[p_i]
nb_i = 0
# if self.is_fluid(p_i) == 1 or self.is_fluid(p_i) == 0:
# Compute the grid index on the fly
cell = self.compute_grid_index(pos_i)
for offs in ti.static(
ti.grouped(ti.ndrange(*((-1, 2),) * self.dim))):
cell_to_check = cell + offs
if self.is_in_grid(cell_to_check) == 1:
for j in range(self.grid_num_particles[cell_to_check]):
p_j = self.grid2particles[cell_to_check, j]
if nb_i < self.max_num_neighbors and p_j != p_i and (
pos_i - self.particle_positions[p_j]
).norm() < self.dh * 2.00:
self.particle_neighbors[p_i, nb_i] = p_j
nb_i.atomic_add(1)
self.particle_num_neighbors[p_i] = nb_i
Full codes can be found at the link below and the program can be easily executed in command line.
Full codes
This function is quite similar to pbf2d example (The pbf2d can executed smoothly on the 0.6.20), but it raises the RuntimeError: [verify.cpp:visit@60] stmt_list->parent == current_block error. I tried to debug it, and found if comment the third loop, the codes will work fine, but still struggle to solve the issue.
It will be great if someone could give any suggestions. Thanks a lot!
Log/Screenshots
[Taichi] mode=release
[Taichi] version 0.6.20, llvm 10.0.0, commit cc621a0c, python 3.7.6
[Taichi] Starting on arch=x64
Method use: PCISPH
(2, 3660)
[E 07/22/20 15:51:28.111] [verify.cpp:visit@60] stmt_list->parent == current_block
***********************************
* Taichi Compiler Stack Traceback *
***********************************
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::Logger::error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::IRVerifier::visit(taichi::lang::Block*)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::IRVerifier::visit(taichi::lang::Block*)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::IRVerifier::visit(taichi::lang::Block*)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::irpass::analysis::verify(taichi::lang::IRNode*)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::irpass::compile_to_offloads(taichi::lang::IRNode*, taichi::lang::CompileConfig const&, bool, bool, bool, bool, bool, bool, bool)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::Kernel::lower(bool)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::Program::compile(taichi::lang::Kernel&)
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::Kernel::compile()
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::Kernel::operator()()
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so(+0x670034) [0x7f3b19ca8034]
/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/core/../lib/taichi_core.so(+0x5afaff) [0x7f3b19be7aff]
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyMethodDef_RawFastCallDict
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyCFunction_FastCallDict
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyObject_Call_Prepend
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: PyObject_Call
/mnt/Ocean/work_environment/anaconda3/bin/python3.7(+0x17515a) [0x55a3053e315a]
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyObject_FastCallKeywords
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalFrameDefault
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalCodeWithName
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyFunction_FastCallDict
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalFrameDefault
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalCodeWithName
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyFunction_FastCallDict
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyObject_Call_Prepend
/mnt/Ocean/work_environment/anaconda3/bin/python3.7(+0x17512a) [0x55a3053e312a]
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: PyObject_Call
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalFrameDefault
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalCodeWithName
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyFunction_FastCallDict
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyObject_Call_Prepend
/mnt/Ocean/work_environment/anaconda3/bin/python3.7(+0x17512a) [0x55a3053e312a]
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyObject_FastCallKeywords
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalFrameDefault
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyFunction_FastCallKeywords
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalFrameDefault
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyFunction_FastCallKeywords
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalFrameDefault
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _PyEval_EvalCodeWithName
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: PyEval_EvalCodeEx
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: PyEval_EvalCode
/mnt/Ocean/work_environment/anaconda3/bin/python3.7(+0x21c974) [0x55a30548a974]
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: PyRun_FileExFlags
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: PyRun_SimpleFileExFlags
/mnt/Ocean/work_environment/anaconda3/bin/python3.7(+0x227f95) [0x55a305495f95]
/mnt/Ocean/work_environment/anaconda3/bin/python3.7: _Py_UnixMain
/lib/x86_64-linux-gnu/libc.so.6: __libc_start_main
/mnt/Ocean/work_environment/anaconda3/bin/python3.7(+0x1d0990) [0x55a30543e990]
Internal Error occurred, check this page for possible solutions:
https://taichi.readthedocs.io/en/stable/install.html#troubleshooting
Traceback (most recent call last):
File "/home/mz618/PycharmProjects/SPH_Taichi/scene.py", line 112, in <module>
main()
File "/home/mz618/PycharmProjects/SPH_Taichi/scene.py", line 58, in main
dt = sph.step(frame, t, total_start)
File "/home/mz618/PycharmProjects/SPH_Taichi/engine/sph_solver.py", line 768, in step
self.search_neighbors()
File "/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/lang/kernel.py", line 595, in __call__
return self._primal(self._kernel_owner, *args, **kwargs)
File "/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/lang/kernel.py", line 491, in __call__
return self.compiled_functions[key](*args)
File "/mnt/Ocean/work_environment/anaconda3/lib/python3.7/site-packages/taichi/lang/kernel.py", line 454, in func__
t_kernel()
RuntimeError: [verify.cpp:visit@60] stmt_list->parent == current_block
Process finished with exit code 1
If you have local commits (e.g. compile fixes before you reproduce the bug), please make sure you first make a PR to fix the build errors and then report the bug.
Thank for reporting this! Believe our great intern @xumingkuan will soon solve the issue and your SPH will run happily!
Hmm, i tried running this on both master and v0.6.20, but couldn't even reproduce it..
Thanks for help! I re-install taichi and tried the codes both on v0.6.17and v0.6.20. The same problem still exists when running on v.0.6.17 , but surprisingly to me, it now works on v0.6.20. Although I am not quite sure why it didn't work both on the two versions yesterday (maybe my machine mess something up when upgrading from v0.6.17 to v0.6.20), I can just work on the latest version.
Thanks a lot!
Does ti.init(ti.cpu) solve the problem?
Sorry! Didn't see arch=x64 in the log...
Hmm, i tried running this on both master and v0.6.20, but couldn't even reproduce it..
Did you reproduce this issue on ti.init(ti.cpu)?
Most helpful comment
Thanks for help! I re-install taichi and tried the codes both on
v0.6.17andv0.6.20. The same problem still exists when running onv.0.6.17, but surprisingly to me, it now works onv0.6.20. Although I am not quite sure why it didn't work both on the two versions yesterday (maybe my machine mess something up when upgrading fromv0.6.17tov0.6.20), I can just work on the latest version.Thanks a lot!