apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.82k stars 3.48k forks source link

[Bug] Building tvm with USE_DNNL=ON throws error #16556

Open IssacXid opened 9 months ago

IssacXid commented 9 months ago

Expected behavior

I have built oneDNN following this link https://oneapi-src.github.io/oneDNN/dev_guide_build.html. And I modify the config.cmake set(USE_DNNL ON). It should be able to build TVM with DNNL json BYOC feature and running the file /test/python/relay/test_external_codegen.py should result in all the unit test including DNNL to pass.

Actual behavior

While building, it throws this error:

error: ‘const struct dnnl::memory::desc’ has no member named ‘data’; did you mean ‘std::shared_ptr<dnnl_memory_desc> dnnl::handle<dnnl_memory_desc*>::data_’? (not accessible from this context)
   91 |   if (!(md->data.format_kind == blocked)) {

In file included from /usr/local/include/oneapi/dnnl/dnnl.hpp:35,
                 from /usr/local/include/dnnl.hpp:20,
                 from /home/dut3kor/tvm/src/relay/backend/contrib/dnnl/../../../../runtime/contrib/dnnl/dnnl_utils.h:35,
                 from /home/dut3kor/tvm/src/relay/backend/contrib/dnnl/query_layout.cc:37:
/usr/local/include/oneapi/dnnl/dnnl_common.hpp:130:60: note: declared private here

Some other errors are:

In function ‘std::string tvm::relay::contrib::get_optimal_layout_for_conv(std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string)’:
error: ‘desc’ is not a member of ‘dnnl::convolution_forward’
  257 |   auto conv_desc = dnnl::convolution_forward::desc(

Environment

OS: WSL in Windows Installed OneDNN from WSL terminal only

Steps to reproduce

Set USE_DNNL=ON, LLVM=ON in /build/config.cmake Build OneDNN using the instruction in https://oneapi-src.github.io/oneDNN/dev_guide_build.html mentioned for Linux. build TVM in WSL

Triage

mshr-h commented 8 months ago

The last commit for the DNNL backend was a year ago. I'm guessing the TVM relay backend isn't updated for the latest oneDNN. The oneDNN v3.0 has memory descriptor breaking changes which might cause the compilation error. Using an older oneDNN (such as 2.7? I don't know) may solve the problem.

vpirogov commented 8 months ago

Thanks, @mshr-h.

This is a duplicate for #13672.