cdl-saarland / rv

RV: A Unified Region Vectorizer for LLVM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading plugin with opt gives an error

Kazhuu opened this issue · comments

Building with latest LLVM 12 master and RV with latest master. LLVM is built with each component as a shared library, not a single shared library (BUILD_SHARED_LIBS=ON). then install to some local directory. Loading plugin with clang seems to work fine but when loading with opt with ~/local/llvm/rv/bin/opt -load=/home/kazooie/local/llvm/rv/lib/libRV.so gives:

opt: CommandLine Error: Option 'rv-cns' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/kazooie/local/llvm/rv/bin/opt -load=/home/kazooie/local/llvm/rv/lib/libRV.so 
 #0 0x00007f3aeebc75ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:22
 #1 0x00007f3aeebc7671 PrintStackTraceSignalHandler(void*) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/Unix/Signals.inc:630:1
 #2 0x00007f3aeebc5381 llvm::sys::RunSignalHandlers() /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/Signals.cpp:71:20
 #3 0x00007f3aeebc6f4a SignalHandler(int) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/Unix/Signals.inc:405:1
 #4 0x00007f3af37640f0 __restore_rt (/usr/lib/libpthread.so.0+0x140f0)
 #5 0x00007f3aee472615 raise (/usr/lib/libc.so.6+0x3d615)
 #6 0x00007f3aee45b862 abort (/usr/lib/libc.so.6+0x26862)
 #7 0x00007f3aeea761f2 llvm::install_bad_alloc_error_handler(void (*)(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool), void*) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/ErrorHandling.cpp:130:61
 #8 0x00007f3aeea75fad llvm::report_fatal_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/ErrorHandling.cpp:86:77
 #9 0x00007f3aeea2d151 (anonymous namespace)::CommandLineParser::addOption(llvm::cl::Option*, llvm::cl::SubCommand*) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:245:17
#10 0x00007f3aeea2d2e0 (anonymous namespace)::CommandLineParser::addOption(llvm::cl::Option*, bool) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:261:16
#11 0x00007f3aeea2e439 llvm::cl::Option::addArgument() /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:446:20
#12 0x00007f3aeea41a98 llvm::cl::opt<bool, false, llvm::cl::parser<bool> >::done() /home/kazooie/extra/programming/llvm-project/llvm/include/llvm/Support/CommandLine.h:1463:22
#13 0x00007f3aec74b006 llvm::cl::opt<bool, false, llvm::cl::parser<bool> >::opt<char [7], llvm::cl::desc, llvm::cl::initializer<bool>, llvm::cl::NumOccurrencesFlag, llvm::cl::cat>(char const (&) [7], llvm::cl::desc const&, llvm::cl::initializer<bool> const&, llvm::cl::NumOccurrencesFlag const&, llvm::cl::cat const&) /home/kazooie/extra/programming/llvm-project/llvm/include/llvm/Support/CommandLine.h:1487:3
#14 0x00007f3aec74a570 __static_initialization_and_destruction_0(int, int) /home/kazooie/extra/programming/llvm-project/rv/src/registerPasses.cpp:45:5
#15 0x00007f3aec74a656 _GLOBAL__sub_I_registerPasses.cpp /home/kazooie/extra/programming/llvm-project/rv/src/registerPasses.cpp:99:42
#16 0x00007f3af497b2de call_init.part.0 (/lib64/ld-linux-x86-64.so.2+0x112de)
#17 0x00007f3af497b3c8 _dl_init (/lib64/ld-linux-x86-64.so.2+0x113c8)
#18 0x00007f3aee5700e5 _dl_catch_exception (/usr/lib/libc.so.6+0x13b0e5)
#19 0x00007f3af497f705 dl_open_worker (/lib64/ld-linux-x86-64.so.2+0x15705)
#20 0x00007f3aee570088 _dl_catch_exception (/usr/lib/libc.so.6+0x13b088)
#21 0x00007f3af497ef3e _dl_open (/lib64/ld-linux-x86-64.so.2+0x14f3e)
#22 0x00007f3aecf1434c (/usr/lib/libdl.so.2+0x134c)
#23 0x00007f3aee570088 _dl_catch_exception (/usr/lib/libc.so.6+0x13b088)
#24 0x00007f3aee570153 _dl_catch_error (/usr/lib/libc.so.6+0x13b153)
#25 0x00007f3aecf14b89 (/usr/lib/libdl.so.2+0x1b89)
#26 0x00007f3aecf143d8 dlopen (/usr/lib/libdl.so.2+0x13d8)
#27 0x00007f3aeeba7ee1 llvm::sys::DynamicLibrary::HandleSet::DLOpen(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/Unix/DynamicLibrary.inc:28:26
#28 0x00007f3aeeba80c8 llvm::sys::DynamicLibrary::getPermanentLibrary(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/DynamicLibrary.cpp:154:35
#29 0x00007f3aeeb003ba llvm::sys::DynamicLibrary::LoadLibraryPermanently(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) /home/kazooie/extra/programming/llvm-project/llvm/include/llvm/Support/DynamicLibrary.h:87:51
#30 0x00007f3aeeb00169 llvm::PluginLoader::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/PluginLoader.cpp:28:3
#31 0x000056075c3ba75c void llvm::cl::opt_storage<llvm::PluginLoader, false, true>::setValue<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/kazooie/extra/programming/llvm-project/llvm/include/llvm/Support/CommandLine.h:1362:5
#32 0x000056075c3b9917 llvm::cl::opt<llvm::PluginLoader, false, llvm::cl::parser<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::handleOccurrence(unsigned int, llvm::StringRef, llvm::StringRef) /home/kazooie/extra/programming/llvm-project/llvm/include/llvm/Support/CommandLine.h:1418:22
#33 0x00007f3aeea34889 llvm::cl::Option::addOccurrence(unsigned int, llvm::StringRef, llvm::StringRef, bool) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:1700:46
#34 0x00007f3aeea2f18a CommaSeparateAndAddOccurrence(llvm::cl::Option*, unsigned int, llvm::StringRef, llvm::StringRef, bool) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:647:32
#35 0x00007f3aeea2f544 ProvideOption(llvm::cl::Option*, llvm::StringRef, llvm::StringRef, int, char const* const*, int&) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:687:41
#36 0x00007f3aeea33c9b (anonymous namespace)::CommandLineParser::ParseCommandLineOptions(int, char const* const*, llvm::StringRef, llvm::raw_ostream*, bool) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:1545:36
#37 0x00007f3aeea3290b llvm::cl::ParseCommandLineOptions(int, char const* const*, llvm::StringRef, llvm::raw_ostream*, char const*, bool) /home/kazooie/extra/programming/llvm-project/llvm/lib/Support/CommandLine.cpp:1312:47
#38 0x000056075c3a0e41 main /home/kazooie/extra/programming/llvm-project/llvm/tools/opt/opt.cpp:590:30
#39 0x00007f3aee45d152 __libc_start_main (/usr/lib/libc.so.6+0x28152)
#40 0x000056075c36761e _start (/home/kazooie/local/llvm/rv/bin/opt+0x2261e)
[1]    79773 abort (core dumped)  ~/local/llvm/rv/bin/opt -load=/home/kazooie/local/llvm/rv/lib/libRV.so

Is this because LLVM being configured to be built as a multiple shared libraries rather than one single shared library? I found this similar discussion apache/tvm#1461.

I could reproduce this. Something is funny about the rv-cns registration (the string "rv-cns" was used twice: as an cl::opt and then again as a pass name, likely causing the conflict)

6d3e3d3 fixes the issue for me. Could you check whether this works for you?

Now it's working and I get the loop vectorizer working with opt rv_in.ll --load=libRV.so -o rv_out.ll -S --rv-loopvec --rv-loop-vectorize. Thanks. This can be closed now.