rocmPackages: msgpack → msgpack-cxx

This commit is contained in:
Luna Nova
2025-09-14 19:16:50 -07:00
parent ec1179bfa5
commit d844a2f111
4 changed files with 47 additions and 9 deletions
@@ -10,7 +10,8 @@
clr,
gfortran,
gtest,
msgpack,
boost,
msgpack-cxx,
amd-blis,
libxml2,
python3,
@@ -65,7 +66,7 @@ let
# FIXME(LunNova@): cmake files need patched to include this properly or
# maybe we improve the toolchain to use config files + assemble a sysroot
# so system wide include assumptions work
cFlags = "-Wno-switch -fopenmp -I${zstd.dev}/include -I${amd-blis}/include/blis/ -I${msgpack}/include";
cFlags = "-Wno-switch -fopenmp -I${lib.getDev zstd}/include -I${amd-blis}/include/blis/ -I${lib.getDev msgpack-cxx}/include";
in
stdenv.mkDerivation (finalAttrs: {
pname = "hipblaslt${clr.gpuArchSuffix}";
@@ -146,7 +147,7 @@ stdenv.mkDerivation (finalAttrs: {
lapack-reference
# Tensile deps - not optional, building without tensile isn't actually supported
msgpack # FIXME: not included in cmake!
msgpack-cxx
libxml2
python3Packages.msgpack
python3Packages.joblib
@@ -158,7 +159,7 @@ stdenv.mkDerivation (finalAttrs: {
];
cmakeFlags = [
"-Wno-dev"
(lib.cmakeFeature "Boost_INCLUDE_DIR" "${lib.getDev boost}/include") # msgpack FindBoost fails to find boost
(lib.cmakeFeature "GPU_TARGETS" gpuTargets')
(lib.cmakeBool "BUILD_TESTING" buildTests)
(lib.cmakeBool "HIPBLASLT_ENABLE_BLIS" true)
@@ -18,7 +18,8 @@
abseil-cpp,
half,
nlohmann_json,
msgpack,
boost,
msgpack-cxx,
sqlite,
oneDNN,
blaze,
@@ -83,6 +84,10 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-8iOBoRBygTvn9eX5f9cG0kBHKgKSeflqHkV6Qwh/ruA=";
};
patches = [
./msgpack-6-compat.patch
];
nativeBuildInputs = [
pkg-config
cmake
@@ -112,7 +117,8 @@ stdenv.mkDerivation (finalAttrs: {
protobuf
half
nlohmann_json
msgpack
boost
msgpack-cxx
sqlite
oneDNN'
blaze
@@ -0,0 +1,29 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1dba2c8d..7795ba78 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -358,13 +358,19 @@ target_link_libraries(migraphx PRIVATE nlohmann_json::nlohmann_json)
find_package(SQLite3 REQUIRED)
target_link_libraries(migraphx PRIVATE SQLite::SQLite3)
-find_package(msgpackc-cxx QUIET)
-if(NOT msgpackc-cxx_FOUND)
- find_package(msgpack REQUIRED)
+# See: https://github.com/msgpack/msgpack-c/wiki/Q%26A#how-to-support-both-msgpack-c-c-version-5x-and-6x-
+# Prefer 6.x (msgpack-cxx)
+find_package(msgpack-cxx)
+if(msgpack-cxx_FOUND)
+ message(STATUS "Found msgpack-cxx (>=6.x)")
+else()
+ find_package(msgpackc-cxx REQUIRED NAMES msgpackc-cxx msgpack)
+ message(STATUS "Found msgpackc-cxx (<=5.x)")
+ add_library(msgpack-cxx ALIAS msgpackc-cxx)
endif()
-target_link_libraries(migraphx PRIVATE msgpackc-cxx)
+target_link_libraries(migraphx PRIVATE msgpack-cxx)
# Make this available to the tests
-target_link_libraries(migraphx INTERFACE $<BUILD_INTERFACE:msgpackc-cxx>)
+target_link_libraries(migraphx INTERFACE $<BUILD_INTERFACE:msgpack-cxx>)
add_library(migraphx_all_targets INTERFACE)
@@ -10,7 +10,8 @@
clr,
python3,
tensile,
msgpack,
boost,
msgpack-cxx,
libxml2,
gtest,
gfortran,
@@ -71,7 +72,7 @@ stdenv.mkDerivation (finalAttrs: {
]
++ lib.optionals buildTensile [
zstd
msgpack
msgpack-cxx
libxml2
python3Packages.msgpack
python3Packages.zstandard
@@ -87,12 +88,13 @@ stdenv.mkDerivation (finalAttrs: {
python3Packages.pyyaml
];
env.CXXFLAGS = "-fopenmp -I${hipblas-common}/include -I${roctracer}/include";
env.CXXFLAGS = "-fopenmp -I${lib.getDev boost}/include -I${hipblas-common}/include -I${roctracer}/include";
# Fails to link tests with undefined symbol: cblas_*
env.LDFLAGS = lib.optionalString (buildTests || buildBenchmarks) "-Wl,--as-needed -lcblas";
env.TENSILE_ROCM_ASSEMBLER_PATH = "${stdenv.cc}/bin/clang++";
cmakeFlags = [
(lib.cmakeFeature "Boost_INCLUDE_DIR" "${lib.getDev boost}/include") # msgpack FindBoost fails to find boost
(lib.cmakeFeature "CMAKE_EXECUTE_PROCESS_COMMAND_ECHO" "STDERR")
(lib.cmakeFeature "CMAKE_Fortran_COMPILER" "${lib.getBin gfortran}/bin/gfortran")
(lib.cmakeFeature "CMAKE_Fortran_COMPILER_AR" "${lib.getBin gfortran}/bin/ar")