Problem building TVM with MKL and DNNL

Hi,

I tried to build TVM 0.7dev on a Celeron J1900 CPU, as I wanted the best performance possible (for this platform) and tried setting it up with MKL and MKL-DNN.

I installed the libs from intels apt repositories, and enabled MKL in the config.cmake

But, if I try building TVM, it fails with

/home/max/tvm_mkl/src/runtime/contrib/dnnl/dnnl_json_runtime.cc:231:18: error: variable-sized object may not be initialized float bias[OC] = {0}; ^~

/home/max/tvm_mkl/src/runtime/contrib/dnnl/dnnl_json_runtime.cc:283:16: error: variable-sized object may not be initialized float bias[OC] = {0};

the config.cmake:

set(USE_CUDA OFF) set(USE_ROCM OFF) set(USE_SDACCEL OFF) set(USE_AOCL OFF) set(USE_OPENCL OFF) set(USE_METAL OFF) set(USE_VULKAN OFF) set(USE_OPENGL OFF) set(USE_MICRO OFF) set(USE_SGX OFF) set(SGX_MODE “SIM”) set(RUST_SGX_SDK “/path/to/rust-sgx-sdk”)

set(USE_RPC ON) set(USE_STACKVM_RUNTIME OFF) set(USE_GRAPH_RUNTIME ON) set(USE_GRAPH_RUNTIME_DEBUG OFF) set(USE_VM_PROFILER OFF) set(USE_MICRO_STANDALONE_RUNTIME OFF)

set(USE_LLVM ON) set(USE_BLAS mkl) set(USE_MKL_PATH /opt/intel/mkl) set(USE_MKLDNN ON) set(USE_OPENMP none) set(USE_RANDOM OFF) set(USE_NNPACK OFF)

set(USE_TFLITE OFF) set(USE_TENSORFLOW_PATH none) set(USE_FLATBUFFERS_PATH none) set(USE_EDGETPU OFF) set(USE_CUDNN OFF) set(USE_CUBLAS OFF) set(USE_MIOPEN OFF) set(USE_MPS OFF) set(USE_ROCBLAS OFF) set(USE_SORT ON) set(USE_DNNL_CODEGEN ON) set(USE_ARM_COMPUTE_LIB OFF) set(USE_ARM_COMPUTE_LIB_GRAPH_RUNTIME OFF) set(USE_ANTLR OFF)

set(USE_RELAY_DEBUG OFF) set(USE_VTA_FSIM OFF) set(USE_VTA_TSIM OFF) set(USE_VTA_FPGA OFF) set(USE_EXAMPLE_EXT_RUNTIME OFF) set(USE_THRUST OFF) set(USE_TF_TVMDSOOP OFF) set(USE_FALLBACK_STL_MAP OFF)

set(USE_HEXAGON_DEVICE OFF) set(USE_HEXAGON_SDK /path/to/sdk)

set(USE_TARGET_ONNX OFF) set(USE_STANDALONE_CRT ON)

Did you build and install oneDNN? I think

 set(USE_MKLDNN ON)

should point to the oneDNN install path.

1 Like

Yes, i’ve installed oneDNN through adding intel apt repository and have the libmkldnn.so lib in my /usr/local/lib/

from the output I would guess, that cmake and make have found it, but I am not sure…

okay, i’ve tried to use the path instead of on and that failed, but with on

cmake echos

-- Use BLAS library /usr/lib/x86_64-linux-gnu/libmkl_rt.so

-- Use MKLDNN library /usr/local/lib/libdnnl.so

-- Build with DNNL JSON runtime: /usr/local/lib/libdnnl.so

which seems correct…

Ok, it looks like mkl_cblas.h was missing, but I added the correct path to CPATH (/usr/include/mkl) and it still fails with the previously mentioned error message