Closed yuwenjun1988 closed 2 years ago
The DNNL C codegen is just a POC, set(USE_DNNL JSON)
or set(USE_DNNL ON)
to use the JSON runtime instead, for more details please refer to https://github.com/apache/tvm-rfcs/blob/main/rfcs/0069-byoc-onednn-integration.md.
1、Expected behavior No Crash
2、Actual behavior Crash Stack
(1)test_dnnl.py:1758:
test_dnnl.py:1414: in check_result check_vm_result() test_dnnl.py:1397: in check_vm_result exe = relay.vm.compile(mod, target=target, params=params) ../../../python/tvm/relay/backend/vm.py:67: in compile compiler.lower(mod, target, target_host) ../../../python/tvm/relay/backend/vm.py:126: in lower self._lower(mod, raw_targets)
self = <tvm.runtime.packed_func.PackedFunc object at 0x7f3698105080> args = (#[version = "0.0.5"] def @main(%in_0: Tensor[(2, 10), uint8] / ty=Tensor[(2, 10), uint8] /) -> Tensor[(2, 16), uint...AATUMAAIjBAAAOwwAAyEEAAPBBAABCwwAAEUMAANDBAAA/Qw==" ], "attrs": {"tvm_version": "0.11.dev0"} }, [llvm -keys=cpu ]) temp_args = [], values = <tvm._ffi._ctypes.packed_func.TVMValue_Array_2 object at 0x7f368e874ac0>, tcodes = <tvm._ffi._ctypes.packed_func.c_int_Array_2 object at 0x7f368e874cc0>
(2)test_dnnl.py:940:
test_dnnl.py:228: in run_and_verify_func run_and_verify( test_dnnl.py:196: in run_and_verify func = relay.create_executor( ../../../python/tvm/relay/backend/interpreter.py:171: in evaluate return self._make_executor() ../../../python/tvm/relay/build_module.py:519: in _make_executor mod = build(self.mod, target=self.target) ../../../python/tvm/relay/build_module.py:364: in build graph_json, runtime_mod, params = bld_mod.build( ../../../python/tvm/relay/build_module.py:161: in build self._build(
self = <tvm.runtime.packed_func.PackedFunc object at 0x7f368e77a800> args = (#[version = "0.0.5"] def @main(%x: Tensor[(1, 16), float32] / ty=Tensor[(1, 16), float32] /) -> Tensor[(1, 32), flo... ], "attrs": {"tvm_version": "0.11.dev0"} }, [llvm -keys=cpu ], None, graph{"link-params": (bool)0}, cpp, None, ...) temp_args = [], values = <tvm._ffi._ctypes.packed_func.TVMValue_Array_8 object at 0x7f368e67f5c0>, tcodes = <tvm._ffi._ctypes.packed_func.c_int_Array_8 object at 0x7f368e67f7c0>
Environment Ubuntu 18.04 TVM 0.11.dev0 Any environment details, such as: Operating System, TVM version, etc
2、Steps to reproduce
(1)run tvm/tests/python/contrib/test_dnnl.py
(2) If in config.cmake set(USE_DNNL ON), it is successed. But if in config.cmake set(USE_DNNL C_SRC), it is failed. And if in config.cmake set(USE_DNNL C_SRC), compilation is also problematic and DNNL.cmake also is modified. I modified the compilation problem and DNNL.cmake locally. You can try set(USE_DNNL C_SRC),and run test_dnnl.py.
compile error message: /mnt/e/code/tvm/src/relay/backend/contrib/dnnl/codegen.cc: In member function ‘tvm::relay::contrib::GenerateBodyOutput tvm::relay::contrib::CodegenDNNL::GenerateCompositeFunctionCall(const tvm::relay::FunctionNode, const tvm::relay::CallNode)’: /mnt/e/code/tvm/src/relay/backend/contrib/dnnl/codegen.cc:279:99: error: call of overloaded ‘GetRootCall(const tvm::relay::CallNode, int,)’ is ambiguous
const auto conv_call = GetRootCall(callee->body.as(), 1, {"nn.conv2d", "nn.relu"});
^
In file included from /mnt/e/code/tvm/src/relay/backend/contrib/dnnl/codegen.cc:37:0:
/mnt/e/code/tvm/src/relay/backend/contrib/dnnl/../../utils.h:532:24: note: candidate: const tvm::relay::CallNode tvm::relay::backend::GetRootCall(const tvm::relay::CallNode, int, const std::vector<std::__cxx11::basic_string >&)
inline const CallNode GetRootCall(const CallNode current_call, int depth,
^
~~/mnt/e/code/tvm/src/relay/backend/contrib/dnnl/../../utils.h:581:24: note: candidate: const tvm::relay::CallNode tvm::relay::backend::GetRootCall(const tvm::relay::CallNode, int, const string&) inline const CallNode GetRootCall(const CallNode current_call, int maxdepth, ^~~/mnt/e/code/tvm/src/relay/backend/contrib/dnnl/codegen.cc: In member function ‘virtual void tvm::relay::contrib::DNNLConstantUpdater::VisitExpr(const tvm::relay::CallNode*)’: /mnt/e/code/tvm/src/relay/backend/contrib/dnnl/codegen.cc:596:29: error: ‘BindToCallNodeArgs’ was not declared in this scope auto args = root_cn ? BindToCallNodeArgs(args_loc, cn) : cn->args; ^~~~~~ /mnt/e/code/tvm/src/relay/backend/contrib/dnnl/codegen.cc:599:30: error: unable to deduce ‘auto&&’ from ‘args’ for (const auto& arg : args) { ^~~~ CMakeFiles/tvm_objs.dir/build.make:8307: recipe for target 'CMakeFiles/tvm_objs.dir/src/relay/backend/contrib/dnnl/codegen.cc.o' failed make[2]: [CMakeFiles/tvm_objs.dir/src/relay/backend/contrib/dnnl/codegen.cc.o] Error 1 CMakeFiles/Makefile2:850: recipe for target 'CMakeFiles/tvm_objs.dir/all' failed make[1]: [CMakeFiles/tvm_objs.dir/all] Error 2 Makefile:145: recipe for target 'all' failed make: *** [all] Error 2