Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix array OOB access in TVM #12199

Closed
gigiblender opened this issue Jul 27, 2022 · 3 comments
Closed

[Bug] Fix array OOB access in TVM #12199

gigiblender opened this issue Jul 27, 2022 · 3 comments
Assignees

Comments

@gigiblender
Copy link
Contributor

Once #12178 is merged, test_meta_schedule_task_scheduler.py::test_meta_schedule_task_scheduler_multiple_gradient_based will be skipped under the ci_minimal docker configuration. The reason is that the ci_minimal image compiles TVM with -D_GLIBCXX_ASSERTIONS and this test causes an array OOB access.

Expected behavior

Expected behavior is tests/python/unittest/test_meta_schedule_task_scheduler.py::test_meta_schedule_task_scheduler_multiple_gradient_based to pass.

Actual behavior

The test is failing with an array OOB access:

/usr/include/c++/7/bits/stl_vector.h:797: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = double; _Alloc = std::allocator<double>; std::vector<_Tp, _Alloc>::reference = double&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Fatal Python error: Aborted

Thread 0x00007efe55d0a700 (most recent call first):
  File "/usr/lib/python3.7/socket.py", line 212 in accept
  File "/usr/local/lib/python3.7/dist-packages/pytest_rerunfailures.py", line 429 in run_server
  File "/usr/lib/python3.7/threading.py", line 870 in run
  File "/usr/lib/python3.7/threading.py", line 926 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 890 in _bootstrap

Current thread 0x00007efe90045740 (most recent call first):
  File "/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 233 in __call__
  File "/tvm/python/tvm/meta_schedule/task_scheduler/task_scheduler.py", line 72 in tune
  File "/tvm/tests/python/unittest/test_meta_schedule_task_scheduler.py", line 402 in test_meta_schedule_task_scheduler_multiple_gradient_based
  File "/usr/local/lib/python3.7/dist-packages/_pytest/python.py", line 192 in pytest_pyfunc_call
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/local/lib/python3.7/dist-packages/_pytest/python.py", line 1761 in runtest
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 166 in pytest_runtest_call
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 259 in <lambda>
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 338 in from_call
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 259 in call_runtest_hook
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 219 in call_and_report
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 130 in runtestprotocol
  File "/usr/local/lib/python3.7/dist-packages/_pytest/runner.py", line 111 in pytest_runtest_protocol
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/local/lib/python3.7/dist-packages/_pytest/main.py", line 347 in pytest_runtestloop
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/local/lib/python3.7/dist-packages/_pytest/main.py", line 322 in _main
  File "/usr/local/lib/python3.7/dist-packages/_pytest/main.py", line 268 in wrap_session
  File "/usr/local/lib/python3.7/dist-packages/_pytest/main.py", line 315 in pytest_cmdline_main
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_callers.py", line 39 in _multicall
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/usr/local/lib/python3.7/dist-packages/pluggy/_hooks.py", line 265 in __call__
  File "/usr/local/lib/python3.7/dist-packages/_pytest/config/__init__.py", line 165 in main
  File "/usr/local/lib/python3.7/dist-packages/_pytest/config/__init__.py", line 187 in console_main
  File "/usr/local/lib/python3.7/dist-packages/pytest/__main__.py", line 5 in <module>
  File "/usr/lib/python3.7/runpy.py", line 85 in _run_code
  File "/usr/lib/python3.7/runpy.py", line 193 in _run_module_as_main
Aborted (core dumped)

Environment

ci_minimal image configuration

Steps to reproduce

Run TVM_FFI=ctypes python3 -m pytest -s -v tests/python/unittest/test_meta_schedule_task_scheduler.py -k "test_meta_schedule_task_scheduler_multiple_gradient_based"
from the ci_minimal docker container or
use the ci.pyscript:

python tests/scripts/ci.py minimal --verbose --tests tests/python/unittest/test_meta_schedule_task_scheduler.py::test_meta_schedule_task_scheduler_multiple_gradient_based
@vinx13
Copy link
Member

vinx13 commented Jul 29, 2022

cc @zxybazh

@zxybazh
Copy link
Member

zxybazh commented Aug 1, 2022

Thanks for reporting this issue. This PR #12273 should be able to fix the issue. Please rebase once the PR is merged.

junrushao pushed a commit that referenced this issue Aug 2, 2022
The previous median number calculation util function used the wrong index which could cause out of bound issue as mentioned in #12199 . This PR fixed this issue.
@junrushao
Copy link
Member

Closing because #12273 should fix this issue. Feel free to reopen if the problem persists!

xinetzone pushed a commit to daobook/tvm that referenced this issue Nov 25, 2022
The previous median number calculation util function used the wrong index which could cause out of bound issue as mentioned in apache#12199 . This PR fixed this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants