[Issue]: msgpack symbols in migraphx conflict with the ones in rocroller

Open
#4,366 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp, sqlite

Research direction

Start with src/msgpack.cpp and reproduce the failure using LD_PRELOAD=/opt/rocm/lib/librocroller.so.1 migraphx_app. Compare the visibility approach with the related recent LLVM symbol-conflict fix in migraphx_gpu, then verify that loading a compiled MXR file works without msgpack or other dependency conflicts.

Written by the indexing model from the issue text.

Description

Problem Description

I've run into a problem that msgpackc-cxx symbols in rocroller from TheRock build and the ones in libmigraphx.so are conflicting, and being shared libraries with the symbols public, one or the other will break. In my case rocroller was loaded first and I see following error when trying to load a compiled binary mxr file (with migraphx::load(path, options)):

MIGraphX Error: /workspace/AMDMIGraphX/src/value.cpp:371: at: Not an object for field: version
exception: Failed to call function

From LD_DEBUG=bindings:

      3813:	binding file /opt/rocm/lib/../lib/migraphx/lib/libmigraphx.so.2013000 [0] to /opt/rocm/lib/librocroller.so.1 [0]: normal symbol `_ZTIN7msgpack2v113size_overflowE'
      3813:	binding file /opt/rocm/lib/../lib/migraphx/lib/libmigraphx.so.2013000 [0] to /opt/rocm/lib/librocroller.so.1 [0]: normal symbol `_ZN7msgpack2v117bin_size_overflowD0Ev'
      3813:	binding file /opt/rocm/lib/../lib/migraphx/lib/libmigraphx.so.2013000 [0] to /opt/rocm/lib/librocroller.so.1 [0]: normal symbol `_ZN7msgpack2v111parse_errorD0Ev'
      3813:	binding file /opt/rocm/lib/../lib/migraphx/lib/libmigraphx.so.2013000 [0] to /opt/rocm/lib/librocroller.so.1 [0]: normal symbol `_ZTSN7msgpack2v117str_size_overflowE'
      3813:	binding file /opt/rocm/lib/../lib/migraphx/lib/libmigraphx.so.2013000 [0] to /opt/rocm/lib/librocroller.so.1 [0]: normal symbol `_ZN7msgpack2v110type_errorD0Ev'

A quick hacky fix for me was:

diff --git a/src/msgpack.cpp b/src/msgpack.cpp
index 2ee49071a..b497714c1 100644
--- a/src/msgpack.cpp
+++ b/src/msgpack.cpp
@@ -23,7 +23,10 @@
  */
 #include <migraphx/msgpack.hpp>
 #include <migraphx/serialize.hpp>
+
+#pragma GCC visibility push(hidden)
 #include <msgpack.hpp>
+#pragma GCC visibility pop
 
 namespace migraphx {
 inline namespace MIGRAPHX_INLINE_NS {
@@ -52,6 +55,7 @@ static void msgpack_chunk_for_each(Iterator start, Iterator last, F f)
 } // namespace MIGRAPHX_INLINE_NS
 } // namespace migraphx
 
+#pragma GCC visibility push(hidden)
 namespace msgpack {
 MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
 {
@@ -206,6 +210,7 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
     } // namespace adaptor
 } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
 } // namespace msgpack
+#pragma GCC visibility pop
 
 namespace migraphx {
 inline namespace MIGRAPHX_INLINE_NS {

Things started to work after this patch was applied.

Aside from msgpack, I also see other symbol conflicts: libsqlite3 is pulled from several places (/opt/rocm/lib/rocm_sysdeps/lib/librocm_sysdeps_sqlite3.so and /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 for me)

Related to recent llvm symbol conflict fix in migraphx_gpu @pfultz2

Operating System

Ubuntu Any

CPU

Ryzen

GPU

Other

Other

Any

ROCm Version

ROCm 6.0.0

Steps to Reproduce

Run your migraphx app with:

LD_PRELOAD=/opt/rocm/lib/librocroller.so.1 migraphx_app
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

Dominant language
C++
Stars
333
Forks
150
Avg merge
4d 19h
Merged PRs (30d)
54

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ROCm/AMDMIGraphX

All issues in ROCm/AMDMIGraphX

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.