Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL(mesa)+OpenCL applications segfault due to multiple LLVMs #46

Closed
kraiskil opened this issue Jan 8, 2014 · 4 comments
Closed

OpenGL(mesa)+OpenCL applications segfault due to multiple LLVMs #46

kraiskil opened this issue Jan 8, 2014 · 4 comments

Comments

@kraiskil
Copy link
Member

kraiskil commented Jan 8, 2014

This is one of the problems already recorded in issue #44 and partially fixed in d86c335.

When an application links against mesa and pocl (even via ICD), and the mesa backend used is LLVMpipe, mesa will jump to the LLVM symbols introduced when LLVM was linked to pocl.

Commit d86c335, added -Bsymbolic flag to linker (on GNU systems). This fixed the inverse issue, i.e. libpocl jumped to the LLVM symbols found in mesa.

Sample backtrace:
#0 0x00007ffff6079475 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff607c6f0 in *__GI_abort () at abort.c:92
#2 0x00007ffff6072621 in *__GI___assert_fail (assertion=0x7ffff1923ca0 "findOption(Name) == Values.size() && "Option already exists!"", file=, line=675, function=0x7

ffff1f77660 "void llvm::cl::parser::addLiteralOption(const char_, const DT&, const char_) [with DT = llvm::ScheduleDAGSDNodes* ()(llvm::SelectionDAGISel, llvm::CodeGenOpt:
:Level); DataType = llvm::Sche"...) at assert.c:81
#3 0x00007ffff07cab7c in void llvm::cl::parser<llvm::ScheduleDAGSDNodes* ()(llvm::SelectionDAGISel, llvm::CodeGenOpt::Level)>::addLiteralOption<llvm::ScheduleDAGSDNodes* (*)(llvm::

SelectionDAGISel_, llvm::CodeGenOpt::Level)>(char const_, llvm::ScheduleDAGSDNodes* (* const&)(llvm::SelectionDAGISel_, llvm::CodeGenOpt::Level), char const_) clone .part.609 fro
m /opt/llvm/3.4//lib/libLLVM-3.4.so
#4 0x00007ffff159618e in llvm::RegisterPassParserllvm::RegisterScheduler::NotifyAdd(char const_, void_ ()(), char const) () from /opt/llvm/3.4//lib/libLLVM-3.4.so
#5 0x00007fffeeff8236 in llvm::MachinePassRegistry::Remove(llvm::MachinePassRegistryNode*) () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so

kraiskil pushed a commit that referenced this issue Jan 9, 2014
@kraiskil
Copy link
Member Author

kraiskil commented Jan 9, 2014

The above is only a work-around, a proper fix would be to detect this sort of mesa-GLX lib at configure time.

@pjaaskel
Copy link
Member

pjaaskel commented Jan 9, 2014

One can argue whether this is really a pocl or LLVMpipe bug ;)

@kraiskil
Copy link
Member Author

kraiskil commented Jan 9, 2014

Mesa bug, or even LLVM? If mesa uses the LLVM C++ API (which is known to change), then mesa should link with -Bsymbolic. If mesa uses the LLVM C API, then this is an issue with LLVM-C (IIRC, the llvm libs expose both C and C++ API in the same libraries, so there is no solution for this). Or then it is a distro bug, in that they build some package wrong.

LLVM discourages using the shared libraries (http://llvm.org/docs/CMake.html#frequently-used-cmake-variables). Probably just because of these sort of issues.

So this is still a pocl issue (marking this issue 'enhancement', not 'bug' :)).
Especially since this issue popped up with the API mode, so it shows in 0.9 for the first time, and therefore a lot of OpenGL-OpenCL mixed users will end up in a situation where "it works with ${VENDOR}-OCL, segfaults with pocl".

@pjaaskel
Copy link
Member

The old multiple LLVM issue(s). There's a newer bug with a link to the LLVM bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants