relay.build fails: module 'tvm.codegen' has no attribute 'llvm_version_major'

On FreeBSD I am getting this failure:

$ python3.6 my.py input (1, 224, 224, 3) Traceback (most recent call last):

File “my.py”, line 58, in graph, lib, params = relay.build(mod, target, params=params)

File “/usr/local/lib/python3.6/site-packages/tvm/relay/build_module.py”, line 244, in build graph_json, mod, params = bld_mod.build(func, target, target_host, params)

File “/usr/local/lib/python3.6/site-packages/tvm/relay/build_module.py”, line 109, in build self._build(func, target, target_host)

File “tvm/_ffi/_cython/./function.pxi”, line 304, in tvm._ffi._cy3.core.FunctionBase.call

File “tvm/_ffi/_cython/./function.pxi”, line 239, in tvm._ffi._cy3.core.FuncCall

File “tvm/_ffi/_cython/./function.pxi”, line 228, in tvm._ffi._cy3.core.FuncCall3

File “tvm/_ffi/_cython/./base.pxi”, line 160, in tvm._ffi._cy3.core.CALL

AttributeError: Traceback (most recent call last): [bt] (7) 0x80cc17ee1 <tvm::relay::legalize::Legalizer::VisitExpr_(tvm::relay::CallNode const*)+0x31> at /usr/local/lib/libtvm.so [bt] (6) 0x80cd7074f <tvm::relay::ExprMutator::VisitExpr_(tvm::relay::CallNode const*)+0x21f> at /usr/local/lib/libtvm.so [bt] (5) 0x80cd6f1bc <tvm::relay::ExprMutator::VisitExpr(tvm::relay::Expr const&)+0x10c> at /usr/local/lib/libtvm.so [bt] (4) 0x80cbee7b3 <ZN3tvm5relay11ExprFunctorIFNS0_4ExprERKS2_EE9VisitExprES4+0xa3> at /usr/local/lib/libtvm.so [bt] (3) 0x80cbeeaf8 <tvm::NodeFunctor<tvm::relay::Expr()(tvm::runtime::ObjectRef const&tvm::relay::ExprFunctor<tvm::relay::Expr()(tvm::relay::Expr const&)>)>::operator()(tvm::runtime::ObjectRef const&, tvm::relay::ExprFunctor<tvm::relay::Expr()(tvm::relay::Expr const&)>) const+0x138> at /usr/local/lib/libtvm.so [bt] (2) 0x80cbf0528 <ZZN3tvm5relay11ExprFunctorIFNS0_4ExprERKS2_EE10InitVTableEvENUlRKNS_7runtime9ObjectRefEPS6_E4_8__invokeESA_SB+0x18> at /usr/local/lib/libtvm.so [bt] (1) 0x80cc18253 <tvm::relay::legalize::Legalizer::VisitExpr_(tvm::relay::CallNode const*)+0x3a3> at /usr/local/lib/libtvm.so [bt] (0) 0x80ce2fc0c <TVMCbArgToReturn+0x74c> at /usr/local/lib/libtvm.so File “tvm/_ffi/_cython/./function.pxi”, line 55, in tvm._ffi._cy3.core.tvm_callback File “/usr/local/lib/python3.6/site-packages/tvm/relay/op/nn/_nn.py”, line 246, in legalize_conv2d return topi.nn.conv2d_legalize(attrs, inputs, types) File “”, line 2, in conv2d_legalize File “/usr/local/lib/python3.6/site-packages/tvm/target.py”, line 382, in dispatch_func return dispatch_dict[k](*args, **kwargs) File “/usr/local/lib/python3.6/site-packages/topi/x86/conv2d_alter_op.py”, line 261, in _conv2d_legalize if _is_int8_hw_support(data_dtype, kernel_dtype): File “/usr/local/lib/python3.6/site-packages/topi/x86/conv2d_int8.py”, line 60, in _is_int8_hw_support llvm_version = tvm.codegen.llvm_version_major() AttributeError: module ‘tvm.codegen’ has no attribute ‘llvm_version_major’

This is likely due to the fact that you have not build tvm with LLVM support

Hello tq: I got the same issue, my env is 7700HQ / kabylake, Ubuntu 16.04, python 3.5. I installed llvm 4.0.1, then build tvm 0.7.dev0 on based it. Is there a possibility llvm version not compatible, could you please recommend a llvm+tvm combi ? BR

Check the value of USE_LLVM in your config.cmake.