tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Bug] debug_get_output function of debug_executor reports error in parameter passing.

Open youxiudeshouyeren opened this issue 1 year ago • 2 comments

In the debug_executor's debug_get_output function, the out parameter can be set to None, but in the C++ implementation of the function, there is no check to see if the out parameter is None, which can result in the program reporting an error without a prompt. The details are as follows:

  1. debug_get_output function in tvm/python/tvm/contrib/debugger/debug_executor.py image

  2. C++ implementation in tvm/src/runtime/graph_executor/debug/graph_executor_debug.cc. This function has no return value and copies Ndarray directly to the out parameter in python. image

  3. When out is None, this will raise a direct error: segment fault image

I would like to raise a pr to address this issue. Now there are two choices:

  1. check at python level that this out parameter cannot be None.
  2. check the number of arguments in C++ and return Ndarray directly when out is None. This operation has the same behavior as get_output function in executor. I prefer the second choice. Thanks for reading and what do you suggest?

@Hzfengsy

youxiudeshouyeren avatar Jan 30 '24 08:01 youxiudeshouyeren

The second one looks good to me. Could you send a PR to fix it?

Hzfengsy avatar Jan 30 '24 09:01 Hzfengsy

The second one looks good to me. Could you send a PR to fix it?

This pr(https://github.com/apache/tvm/pull/16492) is to fix it. Could you review it? Thanks!

youxiudeshouyeren avatar Jan 31 '24 02:01 youxiudeshouyeren

This bug has been fixed in #16492

youxiudeshouyeren avatar Feb 22 '24 06:02 youxiudeshouyeren