Skip to content

Add resource_handle to TVM_DLL_EXPORT_TYPED_FUNC. - #7338

Merged
tqchen merged 1 commit into
apache:mainfrom
areusch:fix-export-typed-func
Jan 26, 2021
Merged

Add resource_handle to TVM_DLL_EXPORT_TYPED_FUNC.#7338
tqchen merged 1 commit into
apache:mainfrom
areusch:fix-export-typed-func

Conversation

@areusch

@areusch areusch commented Jan 25, 2021

Copy link
Copy Markdown
Contributor

 * In apache#5921, resource_handle was added as a parameter to
   TVMBackendPackedCFunc, which is the typedef for functions called by
   LibraryModule's function lookup.
 * It appears TVM_DLL_EXPORT_TYPED_FUNC was overlooked in that PR,
   although there don't seem to be any runtime affects known so
   far. However, making this definition proper to avoid any compiler
   warnings/debug tool problems.
 * See also https://discuss.tvm.apache.org/t/rfc-misra-c-changes-for-rpc-support/7098/5
@areusch

areusch commented Jan 25, 2021

Copy link
Copy Markdown
Contributor Author

@jinchenglee @tqchen

@areusch
areusch marked this pull request as ready for review January 26, 2021 06:29
@tqchen
tqchen merged commit ab8bc0a into apache:main Jan 26, 2021
@tqchen

tqchen commented Jan 26, 2021

Copy link
Copy Markdown
Member

Thanks @jinchenglee @areusch !

@jinchenglee

jinchenglee commented Jan 26, 2021

Copy link
Copy Markdown
Contributor

@areusch , there's another macro in packed_func.h needs same fix. You are actually fixing TVM_DLL_EXPORT_PACKED_FUNC in the commit.

#define TVM_DLL_EXPORT_TYPED_FUNC(ExportName, Function)                                     \
  extern "C" {                                                                              \
  TVM_DLL int ExportName(TVMValue* args, int* type_code, int num_args, TVMValue* out_value, \
                         int* out_type_code) {                                              \
    try {                                                                                   \
      auto f = Function;                                                                    \
      using FType = ::tvm::runtime::detail::function_signature<decltype(f)>::FType;         \
      ::tvm::runtime::TVMRetValue rv;                                                       \
      ::tvm::runtime::detail::unpack_call_by_signature<FType>::run(                         \
          f, ::tvm::runtime::TVMArgs(args, type_code, num_args), &rv);                      \
      rv.MoveToCHost(out_value, out_type_code);                                             \
      return 0;                                                                             \
    } catch (const ::std::runtime_error& _except_) {                                        \
      TVMAPISetLastError(_except_.what());                                                  \
      return -1;                                                                            \
    }                                                                                       \
  }                                                                                         \
  }

@areusch

areusch commented Jan 26, 2021

Copy link
Copy Markdown
Contributor Author

@jinchenglee gotcha, do you want to submit a PR?

@jinchenglee

Copy link
Copy Markdown
Contributor

@areusch , created PR #7343 .

alexwong pushed a commit to alexwong/tvm that referenced this pull request Feb 11, 2021
* In apache#5921, resource_handle was added as a parameter to
   TVMBackendPackedCFunc, which is the typedef for functions called by
   LibraryModule's function lookup.
 * It appears TVM_DLL_EXPORT_TYPED_FUNC was overlooked in that PR,
   although there don't seem to be any runtime affects known so
   far. However, making this definition proper to avoid any compiler
   warnings/debug tool problems.
 * See also https://discuss.tvm.apache.org/t/rfc-misra-c-changes-for-rpc-support/7098/5
electriclilies pushed a commit to electriclilies/tvm that referenced this pull request Feb 18, 2021
* In apache#5921, resource_handle was added as a parameter to
   TVMBackendPackedCFunc, which is the typedef for functions called by
   LibraryModule's function lookup.
 * It appears TVM_DLL_EXPORT_TYPED_FUNC was overlooked in that PR,
   although there don't seem to be any runtime affects known so
   far. However, making this definition proper to avoid any compiler
   warnings/debug tool problems.
 * See also https://discuss.tvm.apache.org/t/rfc-misra-c-changes-for-rpc-support/7098/5
Lokiiiiii pushed a commit to Lokiiiiii/tvm that referenced this pull request Mar 2, 2021
* In apache#5921, resource_handle was added as a parameter to
   TVMBackendPackedCFunc, which is the typedef for functions called by
   LibraryModule's function lookup.
 * It appears TVM_DLL_EXPORT_TYPED_FUNC was overlooked in that PR,
   although there don't seem to be any runtime affects known so
   far. However, making this definition proper to avoid any compiler
   warnings/debug tool problems.
 * See also https://discuss.tvm.apache.org/t/rfc-misra-c-changes-for-rpc-support/7098/5
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Mar 2, 2021
* In apache#5921, resource_handle was added as a parameter to
   TVMBackendPackedCFunc, which is the typedef for functions called by
   LibraryModule's function lookup.
 * It appears TVM_DLL_EXPORT_TYPED_FUNC was overlooked in that PR,
   although there don't seem to be any runtime affects known so
   far. However, making this definition proper to avoid any compiler
   warnings/debug tool problems.
 * See also https://discuss.tvm.apache.org/t/rfc-misra-c-changes-for-rpc-support/7098/5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants