summaryrefslogtreecommitdiff
path: root/sci-libs/miopen
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-03-09 01:07:53 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-03-09 01:07:53 +0000
commit4464bf26d93bdcc80e0b1330fe9c9caef26b34fc (patch)
tree62f9e9438bf700cf277191db5d7c3a641bc972dc /sci-libs/miopen
parent8edd4a48a39640822abe6ddb7b2a1d5b2da4ea70 (diff)
gentoo auto-resync : 09:03:2024 - 01:07:53
Diffstat (limited to 'sci-libs/miopen')
-rw-r--r--sci-libs/miopen/Manifest6
-rw-r--r--sci-libs/miopen/files/miopen-5.7.1-fix-miopendriver-gemm.patch74
-rw-r--r--sci-libs/miopen/metadata.xml3
-rw-r--r--sci-libs/miopen/miopen-5.7.1-r1.ebuild122
4 files changed, 204 insertions, 1 deletions
diff --git a/sci-libs/miopen/Manifest b/sci-libs/miopen/Manifest
index a881f0b2ea27..671f703e1bc3 100644
--- a/sci-libs/miopen/Manifest
+++ b/sci-libs/miopen/Manifest
@@ -8,6 +8,10 @@ AUX miopen-5.1.3-deprecate-clang-ocl.patch 2884 BLAKE2B 4f45f66d87dea51d9f87878f
AUX miopen-5.1.3-gfx1031.patch 19268 BLAKE2B b3d10c57601fd5f39ae431d101687863de34b149ee08df25c987d18ef0bd89d8419a4a18659a22060093eba1cf97c2774e92abf8a38449a202e8770070b29dbf SHA512 44fb3445065087a3952ac143fba88addb4cc634dbd13e15d85d234c64fabba9cf7b83d8161a361e847375a2bc92efc86489e12cfa23ecce1b035d2ccb028db56
AUX miopen-5.1.3-include-array.patch 343 BLAKE2B 993a8f3e301f4c16088ca216b2d820b17ceb42eeda4550b4291a70e00592281f992bf184407d024a0f8b2207a26fef2d56c26ef95e7a452d3b97090e1335a404 SHA512 887ac13f25c1bfd524bb2a3be701bf688f002a95ef8218cb798e41feaeb0678dbbd2ffaf905c59070a125001093bf5ede1bb6a77fdfe6f7a4ff19cbccfdc6624
AUX miopen-5.1.3-no-strip.patch 608 BLAKE2B 3173d95219542a48c6dcd2b87e7157dcf483ff714c3d1c1c47aab8fc8af7b1fd4f6ac52b9d8e892cc25bff973597f4a05426fa4714b0764733b810867af59cfe SHA512 201357718203ee9a4062362541c483e069321b825708c6aa0e8892cc7722bcd520808797307e320df34c4fbf0003198f7a46717d5ff3819b1e2c3a5a3a045725
+AUX miopen-5.7.1-fix-miopendriver-gemm.patch 2818 BLAKE2B fd839ec500b297272f70cc1ee2fa87e74b8a70197cc72291c99c1372c9eeb7f2af33de8067fa1dc42d873bd96f93615074521c00f00b0676835c912ec0e2b73b SHA512 22c852082e0de5115acfa208c325cdb7870823dfe3b5984887c848b702a2fc5072c1d1944b218e27776f0e116d391c6039c3f8485ca65282e9699f3fc1885985
DIST MIOpen-5.1.3.tar.gz 88118329 BLAKE2B d24722ffc5f5dab6d6a1de2ce34193ad2f25c9a2562e38c52e010a29870f01d9ea1c56970ba0601a088c8286e97958ee95d0da27fc8082126dd2ebe5ccb36b70 SHA512 a14e28cfcb12e5061e0e7b999ef3e67fa0a0e897e31bc50e7288b8a23eb1791312e33d3b697021c2b654ccc065ae1b046c1cfd77ba8e04b0f3e87e9cc0626dcd
+DIST MIOpen-5.7.1.tar.gz 100751593 BLAKE2B c5f847fe4374ab22737c281a65401125012328412d584fc09244b431ea6265d6d5028429115ee15fa8b04cbe0edd020e4e7ac8deb22561183ed76cb8c3d4d9d4 SHA512 3354b3b154f29a6337403abc5a71ec47c0b2558320c5a1b0cbfbbdb370c4fada2db12d4a19a312b5e30ca2e2302ee50ece3390603e84d132b2212a168e9523fa
+DIST gtest-1.11.0_p20210611.tar.gz 887296 BLAKE2B 8f29b7028a6dd8190a113cd93398705b23b61d88bee38beaf9dcc0dfc8a463aed7fcd3719f6f1b131d4363aa57231629aaeffa108f6558efb58416cfface6d6e SHA512 cf9e7f3fd3e31ce6677eac355fb8bfe19c5b56a8ec3af8b9417d0904cdf5da92f99f7411a08131cc9fa4fc7d38e6a71fcfac993648e47b269a74a27de7607f7a
EBUILD miopen-5.1.3-r1.ebuild 3131 BLAKE2B 70a9e8325d5611aaad84ebba69873c1177bad75b5a7c90ccee74dc26a3283ee555c0826203851b2ea1234837cd0ec26103c8891b5ba6fdca27a18659bcb59e4d SHA512 a61ebfdbe769d5f7d463c293df8b0f17f5a8c5e732c67d6c3be492fe0ffe433a5c9a30d5c735fb6661cdf1ea96a2edce76d7429936ff295b197522017717a36a
-MISC metadata.xml 453 BLAKE2B 4c1e76cbc277e93a92a95cda405973cc72863882ab9a6729a07976e7815119e985688387c14fc5017fd6e85aaa64eaa72b900375c7f7428eb6bbb2569c5ecaa6 SHA512 0e42066a5ac8720d1b561bcf23269013d9cceff52a9ddd6a6e0af58c7d2628c335bb290e0dc6c262a0542e286f54fd07cb487dd908343fac5cfca07410df6e56
+EBUILD miopen-5.7.1-r1.ebuild 3287 BLAKE2B 926b187675d85525e3679a5a95f8c9451bd6e5758ca91d6e65b3341aa624d3c5dbfd2682960ca3d05dc241bde69a447eae8d8d582bb676dd45d7e8b9afc2c47f SHA512 823bfc7f122c9ed91ef3fca2af6ea027b163f1564a87f0d60603348888465770d0c300f97fa46194658dc14002cf78dbb55567c4b4880350f70336788bc1e886
+MISC metadata.xml 549 BLAKE2B 6bf2f670de2b8f61584d0a930dd65c4c36c251a68a232d0de5bdf3a732b242c7cbddff642ee37909fe54506c7f231c86adf53d71816f46469320e90925076fc1 SHA512 f5d23eacb988af92506012ccaa2d32a0b7e3d2c93b10bfce1eee6ac51ae113bc572a39e2386fd4816fe62ed563b0cb384d5480bd2bd44184cf77f5e53d8ded61
diff --git a/sci-libs/miopen/files/miopen-5.7.1-fix-miopendriver-gemm.patch b/sci-libs/miopen/files/miopen-5.7.1-fix-miopendriver-gemm.patch
new file mode 100644
index 000000000000..859667f3da30
--- /dev/null
+++ b/sci-libs/miopen/files/miopen-5.7.1-fix-miopendriver-gemm.patch
@@ -0,0 +1,74 @@
+Fix uninitialized variable in MIOpenDriver gemm and restore gemmfp16 for testing
+Upstream bug: https://github.com/ROCmSoftwarePlatform/MIOpen/issues/2505
+--- a/driver/driver.hpp
++++ b/driver/driver.hpp
+@@ -141,7 +141,7 @@ inline void PadBufferSize(size_t& sz, int datatype_sz)
+ printf("Usage: ./driver *base_arg* *other_args*\n");
+ printf("Supported Base Arguments: conv[fp16|int8|bfp16], CBAInfer[fp16], "
+ "pool[fp16], lrn[fp16], "
+- "activ[fp16], softmax[fp16], bnorm[fp16], rnn[fp16], gemm, ctc, dropout[fp16], "
++ "activ[fp16], softmax[fp16], bnorm[fp16], rnn[fp16], gemm[fp16], ctc, dropout[fp16], "
+ "tensorop[fp16], reduce[fp16,fp64]\n");
+ exit(0); // NOLINT (concurrency-mt-unsafe)
+ }
+@@ -160,7 +160,7 @@ inline std::string ParseBaseArg(int argc, char* argv[])
+ arg != "CBAInfer" && arg != "CBAInferfp16" && arg != "pool" && arg != "poolfp16" &&
+ arg != "lrn" && arg != "lrnfp16" && arg != "activ" && arg != "activfp16" &&
+ arg != "softmax" && arg != "softmaxfp16" && arg != "bnorm" && arg != "bnormfp16" &&
+- arg != "rnn" && arg != "rnnfp16" && arg != "gemm" /*&& arg != "gemmfp16"*/ && arg != "ctc" &&
++ arg != "rnn" && arg != "rnnfp16" && arg != "gemm" && arg != "gemmfp16" && arg != "ctc" &&
+ arg != "dropout" && arg != "dropoutfp16" && arg != "tensorop" && arg != "tensoropfp16" &&
+ arg != "reduce" && arg != "reducefp16" && arg != "reducefp64" && arg != "--version")
+ {
+--- a/driver/gemm_driver.hpp
++++ b/driver/gemm_driver.hpp
+@@ -207,6 +207,19 @@ int GemmDriver<T>::GetandSetData()
+ gemm_desc.strideB = gemm_desc.k * gemm_desc.n;
+ gemm_desc.strideC = gemm_desc.m * gemm_desc.n;
+
++ if constexpr (std::is_same_v<T, float>)
++ {
++ gemm_desc.dataType = miopenFloat;
++ }
++ else if constexpr (std::is_same_v<T, float16>)
++ {
++ gemm_desc.dataType = miopenHalf;
++ }
++ else
++ {
++ static_assert(!"unsupported type");
++ }
++
+ return (0);
+ }
+
+@@ -230,9 +243,9 @@ int GemmDriver<T>::AllocateBuffersAndCopy()
+ a = std::vector<T>(a_sz);
+ b = std::vector<T>(b_sz);
+ #if GEMM_DRIVER_DEBUG
+- c = std::vector<T>(c_sz, 1.);
++ c = std::vector<T>(c_sz, static_cast<T>(1.));
+ #else
+- c = std::vector<T>(c_sz, 0.);
++ c = std::vector<T>(c_sz, static_cast<T>(0.));
+ #endif
+ chost = c;
+
+--- a/driver/main.cpp
++++ b/driver/main.cpp
+@@ -125,11 +125,10 @@ int main(int argc, char* argv[])
+ {
+ drv = new GemmDriver<float>();
+ }
+-// TODO half is not supported in gemm
+-// else if(base_arg == "gemmfp16")
+-// {
+-// drv = new GemmDriver<float16>();
+-// }
++ else if(base_arg == "gemmfp16")
++ {
++ drv = new GemmDriver<float16>();
++ }
+ #endif
+ else if(base_arg == "bnorm")
+ {
diff --git a/sci-libs/miopen/metadata.xml b/sci-libs/miopen/metadata.xml
index e74d41fd607c..08c299887077 100644
--- a/sci-libs/miopen/metadata.xml
+++ b/sci-libs/miopen/metadata.xml
@@ -12,4 +12,7 @@
<email>xgreenlandforwyy@gmail.com</email>
<name>Yiyang Wu</name>
</maintainer>
+ <upstream>
+ <remote-id type="github">ROCmSoftwarePlatform/MIOpen</remote-id>
+ </upstream>
</pkgmetadata>
diff --git a/sci-libs/miopen/miopen-5.7.1-r1.ebuild b/sci-libs/miopen/miopen-5.7.1-r1.ebuild
new file mode 100644
index 000000000000..93bcde8190ae
--- /dev/null
+++ b/sci-libs/miopen/miopen-5.7.1-r1.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ROCM_VERSION=${PV}
+
+inherit cmake flag-o-matic llvm rocm
+
+GTEST_COMMIT="e2239ee6043f73722e7aa812a459f54a28552929"
+GTEST_FILE="gtest-1.11.0_p20210611.tar.gz"
+
+LLVM_MAX_SLOT=17
+
+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
+ test? ( https://github.com/google/googletest/archive/${GTEST_COMMIT}.tar.gz -> ${GTEST_FILE} )"
+
+LICENSE="MIT"
+KEYWORDS="~amd64"
+SLOT="0/$(ver_cut 1-2)"
+
+IUSE="debug test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ dev-util/hip
+ >=dev-db/sqlite-3.17
+ sci-libs/rocBLAS:${SLOT}[${ROCM_USEDEP}]
+ sci-libs/composable-kernel:${SLOT}[${ROCM_USEDEP}]
+ >=dev-libs/boost-1.72
+ dev-cpp/nlohmann_json
+ dev-cpp/frugally-deep
+"
+
+DEPEND="${RDEPEND}"
+
+BDEPEND="dev-libs/half:0/1
+ dev-build/rocm-cmake
+"
+
+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-fix-interface-include-in-HIP_COMPILER_FLAGS.patch"
+ "${FILESDIR}/${PN}-4.3.0-enable-test.patch"
+ "${FILESDIR}/${PN}-5.1.3-no-strip.patch"
+ "${FILESDIR}/${PN}-5.1.3-include-array.patch"
+ "${FILESDIR}/${PN}-5.7.1-fix-miopendriver-gemm.patch"
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed -e "s:/opt/rocm/llvm:$(get_llvm_prefix ${LLVM_MAX_SLOT}) NO_DEFAULT_PATH:" \
+ -e "s:/opt/rocm/hip:$(hipconfig -p) NO_DEFAULT_PATH:" \
+ -e '/set( MIOPEN_INSTALL_DIR/s:miopen:${CMAKE_INSTALL_PREFIX}:' \
+ -e '/MIOPEN_TIDY_ERRORS ALL/d' \
+ -e 's:find_program(UNZIPPER lbunzip2 bunzip2):find_program(UNZIPPER NAMES lbunzip2 bunzip2):' \
+ -i CMakeLists.txt || die
+
+ sed -e "/add_test/s:--build \${CMAKE_CURRENT_BINARY_DIR}:--build ${BUILD_DIR}:" \
+ -i test/CMakeLists.txt || die
+
+ sed -e "s:\${PROJECT_BINARY_DIR}/miopen/include:\${PROJECT_BINARY_DIR}/include:" \
+ -i src/CMakeLists.txt || die
+
+ sed -e "s:\${AMD_DEVICE_LIBS_PREFIX}/lib:${EPREFIX}/usr/lib/amdgcn/bitcode:" -i cmake/hip-config.cmake || die
+}
+
+src_configure() {
+ if ! use debug; then
+ append-cflags "-DNDEBUG"
+ append-cxxflags "-DNDEBUG"
+ CMAKE_BUILD_TYPE="Release"
+ else
+ CMAKE_BUILD_TYPE="Debug"
+ fi
+
+ local mycmakeargs=(
+ -DCMAKE_SKIP_RPATH=ON
+ -DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DMIOPEN_BACKEND=HIP
+ -DBoost_USE_STATIC_LIBS=OFF
+ -DMIOPEN_USE_MLIR=OFF
+ -DBUILD_TESTS=$(usex test ON OFF)
+ -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF
+ -DROCM_SYMLINK_LIBS=OFF
+ )
+
+ if use test; then
+ mycmakeargs+=(
+ -DMIOPEN_TEST_ALL=ON
+ -DBUILD_TESTING=ON
+ -DMIOPEN_TEST_GDB=OFF
+ -DGOOGLETEST_DIR="${WORKDIR}/googletest-${GTEST_COMMIT}"
+ )
+ for gpu_target in ${AMDGPU_TARGETS}; do
+ mycmakeargs+=(-DMIOPEN_TEST_${gpu_target^^}=ON )
+ done
+ fi
+
+ addpredict /dev/kfd
+ addpredict /dev/dri/
+ append-cxxflags "--rocm-path=$(hipconfig -R)"
+ append-cxxflags "--hip-device-lib-path=${EPREFIX}/usr/lib/amdgcn/bitcode"
+ CXX="$(get_llvm_prefix ${LLVM_MAX_SLOT})/bin/clang++" cmake_src_configure
+}
+
+src_test() {
+ check_amdgpu
+ LD_LIBRARY_PATH="${BUILD_DIR}"/lib cmake_src_test -j1
+}
+
+src_install() {
+ cmake_src_install
+}