Hello @cgerum,
By importing the .py file in init.py file, the AnnotateTarget function gave compiler="imp"
as output after resolving the above error by using the registration like this:
@tvm.ir.register_op_attr("add", "target.imp")
def _imp_add_wrapper(expr):
return True
instead of the way given in DNNL byoc doc like:
@tvm.ir.register_op_attr("add", "target.imp")
def _imp_add_wrapper(args, attrs):
return True
in the .py file. But now I’m getting this error:
Traceback (most recent call last):
File "crossapplication.py", line 56, in <module>
lib = relay.build(mod, target=target, params=None)
File "/home/dut3kor/tvm/python/tvm/relay/build_module.py", line 364, in build
graph_json, runtime_mod, params = bld_mod.build(
File "/home/dut3kor/tvm/python/tvm/relay/build_module.py", line 161, in build
self._build(
File "/home/dut3kor/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 239, in __call__
raise_last_ffi_error()
File "/home/dut3kor/tvm/python/tvm/_ffi/base.py", line 481, in raise_last_ffi_error
raise py_err
tvm._ffi.base.TVMError: Traceback (most recent call last):
17: tvm::relay::backend::RelayBuildModule::GetFunction(tvm::runtime::String const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#3}::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
16: tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::IRModule, tvm::runtime::String const&)
15: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::relay::backend::GraphExecutorCodegenModule::GetFunction(tvm::runtime::String const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
14: tvm::relay::backend::GraphExecutorCodegen::Codegen(tvm::IRModule, tvm::relay::Function, tvm::runtime::String)
13: tvm::transform::Pass::operator()(tvm::IRModule) const
12: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
11: tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
10: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
9: tvm::transform::ModulePassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
8: _ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS_8IRModuleES5_NS_9transform11PassContextEEE17AssignTypedLambdaIZNS_5relay3tec7LowerTEENS0_6StringENS_17CompilationConfigESt8functionIFvNS_8BaseFuncEEEEUlS5_S7_E_EEvT_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SL_SP_
7: tvm::relay::tec::LowerTE(tvm::IRModule const&, tvm::runtime::String const&, std::function<void (tvm::BaseFunc)>, tvm::CompilationConfig)
6: tvm::relay::tec::TECompilerImpl::LowerExternalFunctions()
5: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::runtime::TypedPackedFunc<tvm::runtime::Module (tvm::runtime::ObjectRef const&)>::AssignTypedLambda<tvm::runtime::Module (*)(tvm::runtime::ObjectRef const&)>(tvm::runtime::Module (*)(tvm::runtime::ObjectRef const&), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
4: tvm::relay::contrib::IMPCompiler(tvm::runtime::ObjectRef const&)
3: tvm::relay::contrib::IMPModuleCodegen::CreateCSourceModule(tvm::runtime::ObjectRef const&)
2: _ZN3tvm7runtime13PackedFuncObj
1: tvm::runtime::TypedPackedFunc<tvm::runtime::Module (tvm::runtime::String, tvm::runtime::String, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>)>::AssignTypedLambda<tvm::codegen::{lambda(tvm::runtime::String, tvm::runtime::String, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>)#1}>(tvm::codegen::{lambda(tvm::runtime::String, tvm::runtime::String, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>)#1}, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const, tvm::runtime::TVMRetValue) const
0: tvm::runtime::TVMMovableArgValueWithContext_::operator tvm::runtime::Array<tvm::runtime::String, void><tvm::runtime::Array<tvm::runtime::String, void> >() const
18: tvm::relay::backend::RelayBuildModule::GetFunction(tvm::runtime::String const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#3}::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const
17: tvm::relay::backend::RelayBuildModule::BuildRelay(tvm::IRModule, tvm::runtime::String const&)
16: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::relay::backend::GraphExecutorCodegenModule::GetFunction(tvm::runtime::String const&, tvm::runtime::ObjectPtr<tvm::runtime::Object> const&)::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
15: tvm::relay::backend::GraphExecutorCodegen::Codegen(tvm::IRModule, tvm::relay::Function, tvm::runtime::String)
14: tvm::transform::Pass::operator()(tvm::IRModule) const
13: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
12: tvm::transform::SequentialNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
11: tvm::transform::Pass::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
10: tvm::transform::ModulePassNode::operator()(tvm::IRModule, tvm::transform::PassContext const&) const
9: _ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS_8IRModuleES5_NS_9transform11PassContextEEE17AssignTypedLambdaIZNS_5relay3tec7LowerTEENS0_6StringENS_17CompilationConfigESt8functionIFvNS_8BaseFuncEEEEUlS5_S7_E_EEvT_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SL_SP_
8: tvm::relay::tec::LowerTE(tvm::IRModule const&, tvm::runtime::String const&, std::function<void (tvm::BaseFunc)>, tvm::CompilationConfig)
7: tvm::relay::tec::TECompilerImpl::LowerExternalFunctions()
6: tvm::runtime::PackedFuncObj::Extractor<tvm::runtime::PackedFuncSubObj<tvm::runtime::TypedPackedFunc<tvm::runtime::Module (tvm::runtime::ObjectRef const&)>::AssignTypedLambda<tvm::runtime::Module (*)(tvm::runtime::ObjectRef const&)>(tvm::runtime::Module (*)(tvm::runtime::ObjectRef const&), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}> >::Call(tvm::runtime::PackedFuncObj const*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)
5: tvm::relay::contrib::IMPCompiler(tvm::runtime::ObjectRef const&)
4: tvm::relay::contrib::IMPModuleCodegen::CreateCSourceModule(tvm::runtime::ObjectRef const&)
3: _ZN3tvm7runtime13PackedFuncObj
2: tvm::runtime::TypedPackedFunc<tvm::runtime::Module (tvm::runtime::String, tvm::runtime::String, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>)>::AssignTypedLambda<tvm::codegen::{lambda(tvm::runtime::String, tvm::runtime::String, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>)#1}>(tvm::codegen::{lambda(tvm::runtime::String, tvm::runtime::String, tvm::runtime::Array<tvm::runtime::String, void>, tvm::runtime::Array<tvm::runtime::String, void>)#1}, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const, tvm::runtime::TVMRetValue) const
1: tvm::runtime::TVMMovableArgValueWithContext_::operator tvm::runtime::Array<tvm::runtime::String, void><tvm::runtime::Array<tvm::runtime::String, void> >() const
0: tvm::runtime::Array<tvm::runtime::String, void> tvm::runtime::TVMPODValue_::AsObjectRef<tvm::runtime::Array<tvm::runtime::String, void> >() const
File "/home/dut3kor/tvm/include/tvm/runtime/packed_func.h", line 785
TVMError: In function runtime.CSourceModuleCreate(0: runtime.String, 1: runtime.String, 2: Array<runtime.String>, 3: Array<runtime.String>) -> runtime.Module: error while converting argument 2: [15:02:14] /home/dut3kor/tvm/include/tvm/runtime/packed_func.h:2056: InternalError: Check failed: (!checked_type.defined()) is false: Expected Array[runtime.String], but got runtime.String
Can you give some suggestions on this?
Thanks in advance.