LLVM error "option ... registered more than once" while loading libtvm.so


#1

Hi. I’ve faced LLVM error in tests after enabling llvm on my machine. Error goes from very early stage of loading libtvm.so library, the exact place is ctype.CDLL call located in python/tvm/_ffi/base.py, executed from any import tvm statement.

The error says

: CommandLine Error: Option 'disable-symbolication' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

After some googling I’ve found the https://github.com/CastXML/CastXML/issues/102#issuecomment-372488956
discussion suggesting to replace ${LLVM_LIBS} with LLVM in cmake rules. It seems to work in my case. Could anyone who is more familiar with llvm please explain the problem and possibly review the solution?

Note: I’m using latest tvm (cmake-based build system) and llvm-5.0


[SOLVED] Using OpenCL without LLVM
OpenCL Runtime error
#2

I am using llvm 5.0 and it work fine.
But with llvm4.0 I see some issue then moved to 5.0


#3

Thank you for the reply. I’ve re-checked the issue and it seems that the problem is actual at least for my particular Linux distribution. Below is a patch witch seems to fix it. Thanks.

diff --git a/cmake/modules/LLVM.cmake b/cmake/modules/LLVM.cmake
index 3e896a60..1246efe2 100644
--- a/cmake/modules/LLVM.cmake
+++ b/cmake/modules/LLVM.cmake
@@ -10,7 +10,7 @@ if(NOT USE_LLVM STREQUAL "OFF")
   # Set flags that are only needed for LLVM target
   add_definitions(-DTVM_LLVM_VERSION=${TVM_LLVM_VERSION})
   file(GLOB COMPILER_LLVM_SRCS src/codegen/llvm/*.cc)
-  list(APPEND TVM_LINKER_LIBS ${LLVM_LIBS})
+  list(APPEND TVM_LINKER_LIBS LLVM)
   list(APPEND COMPILER_SRCS ${COMPILER_LLVM_SRCS})
   if(NOT MSVC)
     set_source_files_properties(${COMPILER_LLVM_SRCS}

#4

Same problem on Manjaro Linux with LLVM 6.0


#5

Marty1885, did my solution help in your case?


#6

Yes it fixes the problem. Thank you! :smiley:


#7

Sent the patch as a pull-request https://github.com/dmlc/tvm/pull/1461


#8

@grwlf I currently still run into this error running on Ubuntu 18.04, LLVM 6.0 or LLVM 5.0, target = “opencl”.


#9

Strange, that should be fixed long time ago. But I didn’t try opencl. Actually, for me it was for any application, at the time of import tvm.

If I remember correctly, this problem appeared only if I put USE_LLVM ON. If I put full path to llvm config, the problem didn’t come. You could try this.


#10

It’s not about TVM actually it’s about LLVM used in a NEO OpenCL driver which is required for GEN9+ and alternative, but recommended for other generation of the Intel graphics. I created MR to IGC, you can try this fix in the meanwhile… Current approach doesn’t work for any project that loads some LLVM before NEO’s one


OpenCL Runtime error
#11

This happens when you compile TVM runtime with both set(USE_OPENCL ON) and set(USE_LLVM ON)
You should enable only ONE option but not both.


#12

@apivovarov, either/or is not interesting because it’s common concept to employ both CPU and GPU running Intel to utilize all available resources of the system.


#13

tvm supports two build modes. Full build and runtime build

make
make runtime

full build is needed to compile the model
runtime build is needed to build tvm for edge device

LLVM is needed only to compile models, it is not needed to run the model. So, you do not want to enable it when you build runtime.

OPENCL is not needed for model compilations, it is only needed to run opencl model.
In most of the cases we enable it for runtime build only.