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

Fix string argument mismatch in GraphRuntimeCodegen #5933

Merged
merged 1 commit into from
Jun 28, 2020

Conversation

merrymercy
Copy link
Member

@merrymercy merrymercy commented Jun 26, 2020

During autotvm task extraction, the following error occurred.

Extract tasks...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/ubuntu/incubator-tvm/python/tvm/autotvm/task/relay_integration.py", line 58, in _lower
    grc.codegen(opt_mod["main"])
  File "/home/ubuntu/incubator-tvm/python/tvm/relay/backend/graph_runtime_codegen.py", line 88, in codegen
    arr = self._get_param_by_name(key)
  File "/home/ubuntu/incubator-tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 225, in __call__
    raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
  [bt] (3) /home/ubuntu/incubator-tvm/build/libtvm.so(TVMFuncCall+0x65) [0x7fba4b96bac5]
  [bt] (2) /home/ubuntu/incubator-tvm/build/libtvm.so(std::_Function_handler<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), tvm::relay::backend::GraphRuntimeCodegenModule::GetFunction(std::__cxx11::basic_string<char, std::cha
r_traits<char>, std::allocator<char> > const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#5}>::_M_invoke(std::_Any_data const&, tvm::runtime::TVMArgs&&, tvm::runtime
::TVMRetValue*&&)+0x67) [0x7fba4b803b77]
  [bt] (1) /home/ubuntu/incubator-tvm/build/libtvm.so(tvm::runtime::TVMArgValue::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >[abi:cxx11]() const+0x13c) [0x7fba4af6c52c]
  [bt] (0) /home/ubuntu/incubator-tvm/build/libtvm.so(+0x3ea6e2) [0x7fba4af636e2]
  File "/home/ubuntu/incubator-tvm/include/tvm/runtime/packed_func.h", line 491
TVMError: Check failed: type_code_ == kTVMStr (8 vs. 11) : expected str but get Object

This was introduced by the recent std::string->String update.

To prevent future errors, should we allow implicit conversion from python str to tvm String when calling packed function?

@merrymercy merrymercy changed the title Fix argument mismatch in GraphRuntimeCodegen Fix string argument mismatch in GraphRuntimeCodegen Jun 26, 2020
@@ -85,7 +85,7 @@ def codegen(self, func):
param_names = self._list_params_name()
params = {}
for key in param_names:
arr = self._get_param_by_name(key)
arr = self._get_param_by_name(str(key))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something that we need to update in GraphRuntimeCodegen instead, to explicit get an String instead of str

@tqchen tqchen added the status: need update need update based on feedbacks label Jun 26, 2020
@tqchen tqchen self-assigned this Jun 26, 2020
@merrymercy
Copy link
Member Author

@tqchen comments are addressed

@tqchen tqchen merged commit ff7a152 into apache:master Jun 28, 2020
@tqchen
Copy link
Member

tqchen commented Jun 28, 2020

Thanks @merrymercy

@tqchen tqchen added status: accepted and removed status: need update need update based on feedbacks labels Jun 28, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 30, 2020
@merrymercy merrymercy deleted the pr-fix-str branch July 2, 2020 20:39
zhiics pushed a commit to neo-ai/tvm that referenced this pull request Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants