From e9d044d4b9b71200a96adfa280848858c0f468c9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 13 Nov 2021 13:10:00 +0000 Subject: gentoo resync : 13.11.2021 --- sci-libs/miopen/Manifest | 9 +++ .../miopen-4.2.0-disable-no-inline-boost.patch | 14 ++++ .../files/miopen-4.2.0-gcc11-numeric_limits.patch | 14 ++++ .../miopen/files/miopen-4.3.0-enable-test.patch | 31 +++++++++ ...x-interface-include-in-HIP_COMPILER_FLAGS.patch | 17 +++++ sci-libs/miopen/files/miopen-4.3.0-no-strip.patch | 16 +++++ .../files/miopen-4.3.0-strip-xnack-in-flags.patch | 18 +++++ sci-libs/miopen/metadata.xml | 15 ++++ sci-libs/miopen/miopen-4.3.0.ebuild | 80 ++++++++++++++++++++++ 9 files changed, 214 insertions(+) create mode 100644 sci-libs/miopen/Manifest create mode 100644 sci-libs/miopen/files/miopen-4.2.0-disable-no-inline-boost.patch create mode 100644 sci-libs/miopen/files/miopen-4.2.0-gcc11-numeric_limits.patch create mode 100644 sci-libs/miopen/files/miopen-4.3.0-enable-test.patch create mode 100644 sci-libs/miopen/files/miopen-4.3.0-fix-interface-include-in-HIP_COMPILER_FLAGS.patch create mode 100644 sci-libs/miopen/files/miopen-4.3.0-no-strip.patch create mode 100644 sci-libs/miopen/files/miopen-4.3.0-strip-xnack-in-flags.patch create mode 100644 sci-libs/miopen/metadata.xml create mode 100644 sci-libs/miopen/miopen-4.3.0.ebuild (limited to 'sci-libs/miopen') diff --git a/sci-libs/miopen/Manifest b/sci-libs/miopen/Manifest new file mode 100644 index 000000000000..06961884f80a --- /dev/null +++ b/sci-libs/miopen/Manifest @@ -0,0 +1,9 @@ +AUX miopen-4.2.0-disable-no-inline-boost.patch 447 BLAKE2B ed62e94b4a557c06654ec7ea35300d3d737d4caf8f2421d119a4963c0a13ea4ad2ddeb990f95764e1063872d1dd12fdeb9c917d1a6d0409d0533d78642e03dcb SHA512 32785237505bbc291df6fc7ecb2a9dbf4320f7a8f97ebb0296392d7b5404c5072c21e254d579720c27391930ebe4e779b9d1de344f47905a9210fe0b8e4b7b28 +AUX miopen-4.2.0-gcc11-numeric_limits.patch 461 BLAKE2B 4502c7dc41e0e4ebf4105076c4415ce36e56e596bf98672ecf3d77de4a984499be0990a762c2b05d5e395a06c7df511c9f7629362c7849b31a0d2868b45d99d0 SHA512 04ce10c55af9b979651ef0c345bd12156c850139809601f29ab9305235499b53034efe1928a6dbb77d04114ddf8d93c71d37cc7bef373b07620c2169f88aebc3 +AUX miopen-4.3.0-enable-test.patch 1046 BLAKE2B a9a103eee9b3b6890c02349f36dba7c4cc4459969ebe07915d0cccd3aecbd0edab21de8acbdaee17daae602733965ec1bdda60456f2e0c6bd91ae9795c24622e SHA512 cadc3844aaa32713f0d630ae3ffb9a947c303cf80410785339187ad0ee3cce8bac1b201c12134ba0241c54c296e2752a1076a3826735ccfe4d2cf5f15504f390 +AUX miopen-4.3.0-fix-interface-include-in-HIP_COMPILER_FLAGS.patch 954 BLAKE2B 11f260c1ab9dd1569cf25363626e6431615f8853f334b0123d82b0e3404dcdb1b4ecd9e26658e2f39e4fa6a15ba672cb6940b0279e0ef22535e46992721fd060 SHA512 28724e7e1c1de5cee2d18b6c3da76fa857f95aee64a286262c8426149787f62d07f4a3892472cef91d3c091ec53c7f474a70616ce63e5fbbb4c531ed2ab91a50 +AUX miopen-4.3.0-no-strip.patch 530 BLAKE2B 7706c0cfb7497a116f1a8a30735615254c907b6a11af243aa2d4945c54fdfb117d6196f0b1fa38163d00d8c7313653cec6342464bde9bf120ccfaf1d795aa374 SHA512 feb4181dbde51a41702450ae7f09231d6a24d94d4a93085250ae07c511d24f45b0149e78ee782b222b6a76e7cfde920598084188a6bcc634875b0fc5979bb708 +AUX miopen-4.3.0-strip-xnack-in-flags.patch 1032 BLAKE2B 6cd0d65676edd394e8b8e06c3ec2a7e7bd16888c81f017f1608db7f658166c6354afc26eb71f70f1a94191ed49a87bc17263ef57b61c74bbace82a51e5dc11ec SHA512 d266707d57b7d05124e808c7ba10d7487a6c07a38285927270eb117422c761e3e382a56401a5f1527177e62fb43fe280e365c823969079842766b345dc0b5747 +DIST MIOpen-4.3.0.tar.gz 59405686 BLAKE2B fe91bd91a74023866883d6d0a2a8071a8fe40c4cff2fb4ef58fc6e343a05ac2a731f73e657f4d183ade4e5b7c1fbbe41f3f032918f6e50cb713073aee8d97dc5 SHA512 a8615b7738acfbc7f68d9417b0746c62630d2b48fb8485fafba4db65a4b277a8230f601d249d7e54f89ba25c14176429ca76ad8365a437b09d836b031b0c4fbb +EBUILD miopen-4.3.0.ebuild 2207 BLAKE2B 832fd084293d879ed5e71ff61c4c68fc268c38bbae73498355029e7d7e555ed1e216e9177f48fcd3bcdea8ff88a90cbc43c15663f9fcb9ed89fb4e2eada4aa26 SHA512 1a87523a8ee9fd56eee6c7936d28ef8cd6ec491c20a0cfdcba638b820b88f708de5c6add56fee9b08930537c5c7c5eb9c354bf2fc3d8d2f6ce51c599c71fee39 +MISC metadata.xml 452 BLAKE2B a5cb97ebc54cd63cd0f83b12d12d5be16e732e8151bdddfe1cd23655f8f271e7df45441268bc9a0d25c211c49dfcd6ce3901f0684ce43156514e78eab5e80058 SHA512 7e94c60c456503b4fe4f351ac322fae0ee5c3db8a43b43ba1a5aefb23d45495135d8370e82f1f5b8431fc12bef2f94a4f8c9bae2b0a28b25a621ed0684c424b3 diff --git a/sci-libs/miopen/files/miopen-4.2.0-disable-no-inline-boost.patch b/sci-libs/miopen/files/miopen-4.2.0-disable-no-inline-boost.patch new file mode 100644 index 000000000000..769217acd9d1 --- /dev/null +++ b/sci-libs/miopen/files/miopen-4.2.0-disable-no-inline-boost.patch @@ -0,0 +1,14 @@ +This let MIOpen compatible with >boost-1.72, for example 1.76 + +Suggested by: Michael Boone + +--- a/CMakeLists.txt 2021-07-23 01:26:15.377754243 -0700 ++++ b/CMakeLists.txt 2021-07-23 01:29:23.925685190 -0700 +@@ -216,6 +216,7 @@ + message(STATUS "Hip compiler flags: ${HIP_COMPILER_FLAGS}") + + add_definitions("-DHIP_COMPILER_FLAGS=${HIP_COMPILER_FLAGS}") ++add_definitions("-DBOOST_CONTAINER_DISABLE_NOINLINE") + + + # HIP diff --git a/sci-libs/miopen/files/miopen-4.2.0-gcc11-numeric_limits.patch b/sci-libs/miopen/files/miopen-4.2.0-gcc11-numeric_limits.patch new file mode 100644 index 000000000000..73997ce5d4db --- /dev/null +++ b/sci-libs/miopen/files/miopen-4.2.0-gcc11-numeric_limits.patch @@ -0,0 +1,14 @@ +See: https://stackoverflow.com/questions/4798936/numeric-limits-was-not-declared-in-this-scope-no-matching-function-for-call-t + +https://www.gnu.org/software/gcc/gcc-11/porting_to.html#header-dep-changes + +--- MIOpen-rocm-4.2.0/src/include/miopen/float_equal.hpp ++++ MIOpen-rocm-4.2.0/src/include/miopen/float_equal.hpp +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #ifdef _MSC_VER + #include + #endif diff --git a/sci-libs/miopen/files/miopen-4.3.0-enable-test.patch b/sci-libs/miopen/files/miopen-4.3.0-enable-test.patch new file mode 100644 index 000000000000..68d2f143bf4e --- /dev/null +++ b/sci-libs/miopen/files/miopen-4.3.0-enable-test.patch @@ -0,0 +1,31 @@ +This create option BUILD_TESTS for miopen, like other rocm math libs, and + +testing executables are always built if test enabled. The original behaviour, is + +always add test/CMakeLists.txt without adding test exes as targets, and compile them + +during test. +--- orig/CMakeLists.txt ++++ MIOpen-rocm-4.3.0/CMakeLists.txt +@@ -590,6 +590,9 @@ add_subdirectory(src) + if(MIOPEN_BUILD_DRIVER) + add_subdirectory(driver) + endif() +-add_subdirectory(test) ++option(BUILD_TESTS "Build binaries for tests" OFF) ++if(BUILD_TESTS) ++ add_subdirectory(test) ++endif() + add_subdirectory(speedtests) + add_subdirectory(utils) +--- orig/test/CMakeLists.txt ++++ MIOpen-rocm-4.3.0/test/CMakeLists.txt +@@ -142,7 +142,7 @@ function(add_test_command NAME EXE) + endfunction() + + function(add_test_executable TEST_NAME) +- add_executable (${TEST_NAME} EXCLUDE_FROM_ALL ${ARGN}) ++ add_executable (${TEST_NAME} ${ARGN}) + clang_tidy_check(${TEST_NAME}) + target_link_libraries(${TEST_NAME} ${CMAKE_THREAD_LIBS_INIT}) + # Cmake does not add flags correctly for gcc diff --git a/sci-libs/miopen/files/miopen-4.3.0-fix-interface-include-in-HIP_COMPILER_FLAGS.patch b/sci-libs/miopen/files/miopen-4.3.0-fix-interface-include-in-HIP_COMPILER_FLAGS.patch new file mode 100644 index 000000000000..5c2762a32548 --- /dev/null +++ b/sci-libs/miopen/files/miopen-4.3.0-fix-interface-include-in-HIP_COMPILER_FLAGS.patch @@ -0,0 +1,17 @@ +The interface inlude directories of hip::device should be included using -I, not -isystem; + +otherwise compilation at MIOpen runtime will fail due to cstdlib cannot find or similar errors. + +Suggested-by: Yuyi Wang +Signed-off-by: Yiyang Wu +--- orig/cmake/TargetFlags.cmake ++++ MIOpen-rocm-4.3.0/cmake/TargetFlags.cmake +@@ -41,7 +41,7 @@ function(target_flags FLAGS TARGET) + set(_flags) + append_flags(_flags ${TARGET} "INTERFACE_COMPILE_OPTIONS" "") + append_flags(_flags ${TARGET} "INTERFACE_COMPILE_DEFINITIONS" "-D") +- append_flags(_flags ${TARGET} "INTERFACE_INCLUDE_DIRECTORIES" "-isystem ") ++ append_flags(_flags ${TARGET} "INTERFACE_INCLUDE_DIRECTORIES" "-I ") + append_flags(_flags ${TARGET} "INTERFACE_LINK_DIRECTORIES" "-L ") + append_flags(_flags ${TARGET} "INTERFACE_LINK_OPTIONS" "") + append_link_flags(_flags ${TARGET} "INTERFACE_LINK_LIBRARIES" "") diff --git a/sci-libs/miopen/files/miopen-4.3.0-no-strip.patch b/sci-libs/miopen/files/miopen-4.3.0-no-strip.patch new file mode 100644 index 000000000000..2d0565821063 --- /dev/null +++ b/sci-libs/miopen/files/miopen-4.3.0-no-strip.patch @@ -0,0 +1,16 @@ +Don't strip for release. Let portage handle stripping. +--- orig/CMakeLists.txt ++++ MIOpen-rocm-4.3.0/CMakeLists.txt +@@ -69,12 +69,6 @@ set(MIOPEN_ENABLE_SQLITE_BACKOFF On CACH + option( BUILD_DEV "Build for development only" OFF) + + +-# Strip symbols for release +-if(NOT WIN32 AND NOT APPLE) +- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s") +- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s") +-endif() +- + rocm_setup_version(VERSION 2.12.0) + + list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ) diff --git a/sci-libs/miopen/files/miopen-4.3.0-strip-xnack-in-flags.patch b/sci-libs/miopen/files/miopen-4.3.0-strip-xnack-in-flags.patch new file mode 100644 index 000000000000..dc6db68c2afc --- /dev/null +++ b/sci-libs/miopen/files/miopen-4.3.0-strip-xnack-in-flags.patch @@ -0,0 +1,18 @@ +if options like :xnack- exists in ${AMDGPU_TARGETS}, CMakeLists cannot handle HIP_COMPILER_FLAGS well + +the original regex replace should include :+- so xnack- is stripped as well. Otherwise clang complation at MIOpen runtime will fail. + +Signed-off-by: Yiyang Wu +--- orig/CMakeLists.txt ++++ MIOpen-rocm-4.3.0/CMakeLists.txt +@@ -191,8 +191,8 @@ find_package(hip REQUIRED PATHS /opt/roc + message(STATUS "Build with HIP ${hip_VERSION}") + target_flags(HIP_COMPILER_FLAGS hip::device) + # Remove cuda arch flags +-string(REGEX REPLACE --cuda-gpu-arch=[a-z0-9]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}") +-string(REGEX REPLACE --offload-arch=[a-z0-9]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}") ++string(REGEX REPLACE --cuda-gpu-arch=[a-z0-9:+-]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}") ++string(REGEX REPLACE --offload-arch=[a-z0-9:+-]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}") + + # Override HIP version in config.h, if necessary. + # The variables set by find_package() can't be overwritten, diff --git a/sci-libs/miopen/metadata.xml b/sci-libs/miopen/metadata.xml new file mode 100644 index 000000000000..da47ad0ef39f --- /dev/null +++ b/sci-libs/miopen/metadata.xml @@ -0,0 +1,15 @@ + + + + + sci@gentoo.org + + + gentoo@holzke.net + Wilfried Holzke + + + xgreenlandforwyy@gmail.com + Yiyang Wu + + diff --git a/sci-libs/miopen/miopen-4.3.0.ebuild b/sci-libs/miopen/miopen-4.3.0.ebuild new file mode 100644 index 000000000000..3e754480664e --- /dev/null +++ b/sci-libs/miopen/miopen-4.3.0.ebuild @@ -0,0 +1,80 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake + +DESCRIPTION="AMD's Machine Intelligence Library" +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/MIOpen" +SRC_URI="https://github.com/ROCmSoftwarePlatform/MIOpen/archive/rocm-${PV}.tar.gz -> MIOpen-${PV}.tar.gz" + +LICENSE="MIT" +KEYWORDS="~amd64" +SLOT="0/$(ver_cut 1-2)" + +IUSE="debug test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-util/hip:${SLOT} + >=dev-db/sqlite-3.17 + dev-libs/ocl-icd + dev-util/rocm-clang-ocl:${SLOT} + sci-libs/rocBLAS:${SLOT} + >=dev-libs/boost-1.72 +" + +DEPEND="${RDEPEND}" + +BDEPEND="dev-libs/half:0/1" + +S="${WORKDIR}/MIOpen-rocm-${PV}" + +PATCHES=( + "${FILESDIR}/${PN}-4.2.0-disable-no-inline-boost.patch" + "${FILESDIR}/${PN}-4.2.0-gcc11-numeric_limits.patch" + "${FILESDIR}/${PN}-4.3.0-strip-xnack-in-flags.patch" + "${FILESDIR}/${PN}-4.3.0-fix-interface-include-in-HIP_COMPILER_FLAGS.patch" + "${FILESDIR}/${PN}-4.3.0-enable-test.patch" + "${FILESDIR}/${PN}-4.3.0-no-strip.patch" +) + +src_prepare() { + sed -e "s:/opt/rocm/llvm:""${EPREFIX}""/usr/lib/llvm/roc/ NO_DEFAULT_PATH:" \ + -e "s:/opt/rocm/hip:""${EPREFIX}""/usr/lib/hip/ NO_DEFAULT_PATH:" \ + -e '/set( MIOPEN_INSTALL_DIR/s:miopen:${CMAKE_INSTALL_PREFIX}:' \ + -e '/set(MIOPEN_SYSTEM_DB_PATH/s:${CMAKE_INSTALL_PREFIX}/::' \ + -e '/MIOPEN_TIDY_ERRORS ALL/d' \ + -i CMakeLists.txt || die + + sed -e "/rocm_install_symlink_subdir(\${MIOPEN_INSTALL_DIR})/d" -i src/CMakeLists.txt || die + sed -e "/add_test/s:--build \${CMAKE_CURRENT_BINARY_DIR}:--build ${BUILD_DIR}:" -i test/CMakeLists.txt || die + + sed -e "s:\${AMD_DEVICE_LIBS_PREFIX}/lib:${EPREFIX}/usr/lib/amdgcn/bitcode:" -i cmake/hip-config.cmake || die + + cmake_src_prepare +} + +src_configure() { + if ! use debug; then + append-cflags "-DNDEBUG" + append-cxxflags "-DNDEBUG" + CMAKE_BUILD_TYPE="Release" + else + CMAKE_BUILD_TYPE="Debug" + fi + + export CXX="${EPREFIX}/usr/lib/llvm/roc/bin/clang++" + + local mycmakeargs=( + -DCMAKE_SKIP_RPATH=ON + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" + -DMIOPEN_BACKEND=HIP + -DBoost_USE_STATIC_LIBS=OFF + -DBUILD_TESTS=$(usex test ON OFF) + ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"} + ) + + cmake_src_configure +} -- cgit v1.2.3