apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.45k stars 3.41k forks source link

[Bug] utest got segmentation fault #14806

Closed zhaoyang-star closed 1 year ago

zhaoyang-star commented 1 year ago

Run python3 -Xfaulthandler -m pytest tests/python/relay/test_op_level1.py got segmentation fault. Run other test_*.py also met the seg fault. It seems that Seg Fault happened when using ctypes with Python and C++. Does anyone meet similar error? Thanks in advance.

(env_tvm) root@12800db2b9db:/z/Dev/tvm# python3 -Xfaulthandler -m pytest tests/python/relay/test_op_level1.py
Fatal Python error: Segmentation fault

Current thread 0x00007f5896dc5740 (most recent call first):
  File "/z/Dev/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 227 in __call__
  File "/z/Dev/tvm/python/tvm/runtime/module.py", line 687 in enabled
  File "/z/Dev/tvm/python/tvm/testing/utils.py", line 424 in _get_targets
  File "/z/Dev/tvm/python/tvm/testing/utils.py", line 526 in enabled_targets
  File "/z/Dev/tvm/python/tvm/testing/plugin.py", line 69 in pytest_configure
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pluggy/_hooks.py", line 277 in call_historic
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1046 in _do_configure
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/_pytest/main.py", line 265 in wrap_session
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/_pytest/config/__init__.py", line 166 in main
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/_pytest/config/__init__.py", line 189 in console_main
  File "/z/env_init/env_tvm/lib/python3.8/site-packages/pytest/__main__.py", line 5 in <module>
  File "/usr/lib/python3.8/runpy.py", line 87 in _run_code
  File "/usr/lib/python3.8/runpy.py", line 194 in _run_module_as_main
Segmentation fault (core dumped)

Environment

Operating System: Linux 12800db2b9db 5.19.0-40-generic #41~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC TVM version: v0.11.1 Python version: 3.8.10

zhaoyang-star commented 1 year ago

I found the reason is that my OS is Ubuntu 20.04, while the prebuild llvm used is 16.0.0-x86_64-linux-gnu-ubuntu-18.04. I replese it with 16.0.0-x86_64-linux-gnu-ubuntu-20.04 and it works.