Phoslight opened a new pull request, #17950: URL: https://github.com/apache/tvm/pull/17950
This patch fixes a dangling reference issue that can be reproduced locally on macOS. This root cause is that the rvalue returned by `.as<>()` is destroyed at the end of the full-expression, before the for loop actually begins. A minimal example that demonstrates this issue: https://godbolt.org/z/99vWrK1rq Below is the call stack for reference. Thanks, ``` tests/python/relax/test_transform_lift_transform_params.py Fatal Python error: Segmentation fault Current thread 0x00000001fc9b4840 (most recent call first): File "/***/tvm/python/tvm/ir/transform.py", line 238 in __call__ File "/***/tvm/tests/python/relax/test_transform_lift_transform_params.py", line 1158 in test_share_transform_across_specified_functions File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/python.py", line 159 in pytest_pyfunc_call File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/python.py", line 1627 in runtest File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/runner.py", line 174 in pytest_runtest_call File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/runner.py", line 242 in <lambda> File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/runner.py", line 341 in from_call File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/runner.py", line 241 in call_and_report File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/runner.py", line 132 in runtestprotocol File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/runner.py", line 113 in pytest_runtest_protocol File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/main.py", line 362 in pytest_runtestloop File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/main.py", line 337 in _main File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/main.py", line 283 in wrap_session File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/main.py", line 330 in pytest_cmdline_main File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__ File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/config/__init__.py", line 175 in main File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/_pytest/config/__init__.py", line 201 in console_main File "/opt/homebrew/anaconda3/envs/test1/lib/python3.11/site-packages/pytest/__main__.py", line 9 in <module> File "<frozen runpy>", line 88 in _run_code File "<frozen runpy>", line 198 in _run_module_as_main [2] 24356 segmentation fault /opt/homebrew/anaconda3/envs/test1/bin/python -m pytest ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
