As explained in this post I am currently trying to build a TFLite model which uses the topi.vision.non_max_supression operator. As explained in the post, I found a workaround to be able to build the model, but now there are problems in the generated C code.
TVM is generating the following code as part of the non_max_suppression operator:
if (TVMBackendGetFuncFromEnv(__tvm_module_ctx, "tvm.contrib.sort.argsort_nms", &tvm_contrib_sort_argsort_nms_packed) != 0) {
return -1;
}
When I try to compile this code, I get that __tvm_module_ctx is not declared. As far as I can tell, this is because there is a specific case where this variable is generated (see file src/target/source/codegen_c_host.cc). According to this, this __tvm_module_ctx is only generated when the AOT executor is defined (it is) and when the runtime name is Cpp (it is not).
So this is the first question: can the CRT runtime also be supported here?
I also noticed that the TVMBackendGetFuncFromEnv is not in the generated code. As far as i understand, this line of code that is generating trouble is generated because of the te.extern and the tvm.tir.call_packed in the argsort declared in tvm/topi/sort.py.
So this is the second question: can this argsort be generated without calling call_packed and te.extern?