summaryrefslogtreecommitdiff
path: root/sci-libs/miopen
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2025-01-07 06:41:06 +0000
committerV3n3RiX <venerix@koprulu.sector>2025-01-07 06:41:06 +0000
commitd69399c7befdd98cda62d6a1788ae2aa7f104c5e (patch)
treeeac7184f4cfe7d67580c1d0a0d9942a91e6cb4ee /sci-libs/miopen
parente4d9d6796d5018e338f0b27a3bc97716195bf0b8 (diff)
gentoo auto-resync : 07:01:2025 - 06:41:06
Diffstat (limited to 'sci-libs/miopen')
-rw-r--r--sci-libs/miopen/Manifest9
-rw-r--r--sci-libs/miopen/files/miopen-6.1.1-fix-libcxx.patch246
-rw-r--r--sci-libs/miopen/files/miopen-6.3.0-conditional-ck-components.patch46
-rw-r--r--sci-libs/miopen/files/miopen-6.3.0-isnan-include.patch19
-rw-r--r--sci-libs/miopen/metadata.xml6
-rw-r--r--sci-libs/miopen/miopen-6.1.1.ebuild2
-rw-r--r--sci-libs/miopen/miopen-6.3.0.ebuild134
7 files changed, 459 insertions, 3 deletions
diff --git a/sci-libs/miopen/Manifest b/sci-libs/miopen/Manifest
index 5f2d233001b2..8264574e838f 100644
--- a/sci-libs/miopen/Manifest
+++ b/sci-libs/miopen/Manifest
@@ -10,11 +10,16 @@ AUX miopen-5.1.3-include-array.patch 343 BLAKE2B 993a8f3e301f4c16088ca216b2d820b
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
AUX miopen-6.1.1-build-all-tests.patch 548 BLAKE2B be700c5401e288a4da5423047303a316ea82fc928c88e46be3da9cd41ac473bf6e232b68d1791e2fea0534c8233e4c2431c9a7536a24125651ce2f55aea1e667 SHA512 c8df1b24d61c9b7a132b77bddacb3d614653257c61b8b5936ea666a3e130b76a183618d5384abe5b871ae144bf9b2f2cf622850a59e7d5c53cf89adbf9dfa32b
+AUX miopen-6.1.1-fix-libcxx.patch 7454 BLAKE2B 143e69445abef40e30879ad8e38730b585a1acb17c7fee711dcc9f957cc42805ccd79457aabfd77587c790b8bb99b87c7b9d39525977b5e940a665134bf49856 SHA512 7605ab2db5c2f6d7a06ffd073f8b6bae77f04c710ffa08364af079817e5686c18e468159afec43832029c9b099a34678bd4269f10f31c141beb44ff2a59fea76
+AUX miopen-6.3.0-conditional-ck-components.patch 2393 BLAKE2B cf41a17b7078664042d851ddf99ed9a702f30f6b2d9f2af9f8c164066e8cc127cd7bf99d950e4cae4d8718887c96632171804a17fd0a2dcb36a73e24299b79c0 SHA512 281c9f64c924c1cd7acf808678f52b7b32417b2b6532c0d9413b71e08c85392b296cde88a9fa50f3f18a91091a280cfaa1820ac389196d9637b0a57e4807e090
+AUX miopen-6.3.0-isnan-include.patch 636 BLAKE2B 78eb4506461059191ef7999ea8252a0c50e99317ae32d25ee19f26cdc8086cca7cfbffa2b87cde8fc298696483961067929e5c68e5851582d8e94256ab08d770 SHA512 91154725cc22b52f5d6f72fe6bf11f496b033a16889f08041e81c4a814f5095ae75dcad1a00e8e93b7102c712f8b9f5ed58efc86f0fb949e85db0560ecb83468
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 MIOpen-6.1.1.tar.gz 101935496 BLAKE2B 5aadaa5eefa1b22dedfe87deb36f8acdbe57962cac8b7b6b20bc76f136ef29f0441e48112010280c2e674a1ae9fd202ca3e07be47cf4a4bc797234d6dc618be5 SHA512 b8860583919bf2f3e0da7ace30fdb0595ab45b85a367be3737e0b15a22a5565b8d6660c652ee070f21c36ac7d17ef3ba8e2eda7ed89bd6a0c65a4df799626d1a
+DIST MIOpen-6.3.0.tar.gz 104152308 BLAKE2B 46c238314393599a1bd4d3c49b0c95386b36cbee1831bf442ab127082b4c740116e81cf643c773627125b59c3974a2344753939b4287aa4adbbc51e4c4833988 SHA512 14ca2967ed6545ad68c362128be93b8e6a9d4aa69e16e989b187463d15351eca2fc437d07e88c41f693138131a7449add607333c698e24efaf0207077e15ae55
DIST gtest-1.11.0_p20210611.tar.gz 887296 BLAKE2B 8f29b7028a6dd8190a113cd93398705b23b61d88bee38beaf9dcc0dfc8a463aed7fcd3719f6f1b131d4363aa57231629aaeffa108f6558efb58416cfface6d6e SHA512 cf9e7f3fd3e31ce6677eac355fb8bfe19c5b56a8ec3af8b9417d0904cdf5da92f99f7411a08131cc9fa4fc7d38e6a71fcfac993648e47b269a74a27de7607f7a
EBUILD miopen-5.1.3-r1.ebuild 3182 BLAKE2B a6ae78e487ea88d31693fcf1b96a7ce6a1cb0505311c2f101be498bcafce5436cc678ca83e10dafc27549b3121c01cbf0c5d2a35e7f6117de086879002ecc138 SHA512 2165e4d250f125f699963bc7b6f1c22598467e962c9aac1bb7eeff24d6091fa3b72a696a11e1ab80ea18710525ef00f99889cc5b972068e23340c4eb14b621ef
EBUILD miopen-5.7.1-r1.ebuild 3338 BLAKE2B bbd84a39a04c4ef9e1b2dc42ff1bbe7b7e4ceda90ca0c82f416a05a55b1324727418e1c2c1446fe7a82800d23380cfb9a3e30463289a18e9af20ab10239cbfc7 SHA512 5a8ddf01d2c088325fd377499f80b3c1f84881d52596b53450f2ce07714e53a552304bd8a24aecf394a57ee039fd6f364642f93e7920d8d9df63bb7dd312057e
-EBUILD miopen-6.1.1.ebuild 2339 BLAKE2B ffc1c4e15f8762046b8cf5bad5f36c311132913b92d1da4f994ad4ce2e8010ae7c12614b09e1e5b1fb5701a3cd2ba11f95592137603a64ae245084fc04e76072 SHA512 3e22489631a1116e9ab02cd9cef39964ba5be9a1af71daef2d4b002a420f607ee6358552d830f12e4bfe3ce4b869157599bd907f5bfac5ed5bad04c4f0f1d841
-MISC metadata.xml 646 BLAKE2B 76ad8db32707d804dcee5a8ff3adb66444464aa2bef2e3415326b485b67f6b0c26a36e45b30cd632b0e41e96cbcfad9c785f5145ddbf89fcdabe66456b35d22a SHA512 d7b219b8800178385725fc92fe72fe65c291a451963263271731580548e3319f2bac83e73bba66d3a6442aa6f9dfc8ff8955cdbbfd7f057825dda992e8dfe772
+EBUILD miopen-6.1.1.ebuild 2347 BLAKE2B e00b587186711d0a4d51cf354c9cac89fdf0d3a3b05be358adcbb30a1e2cf86f68ad3c4ea136d2015755d814f9f347662343e84be8d7a6aa9f7366f193fa3108 SHA512 d94bef9186d91886d3fcc9310a9d2b12dc6885efb1dc340d8c78e8cf1899a180cf4cd8db2f0749f6ffde19f10e9db23d768d3690ddc758b17b3281c02248e0ae
+EBUILD miopen-6.3.0.ebuild 3562 BLAKE2B 86359acdab8fc60cf038fa829ec1c9a1a68717c3d3eb72fef93a36d106b4ca2453616ad4b4682ed25ca5658414f0a082b840dfbdf6bd82cd2d9d965315a3fcff SHA512 3d20eaf391ffe598e7707a1e12d41ae0e0383dc38b4b97a5b9848f13365547456bd504d9776a71d54798c6bfbfdfa0628f63eec1d4ad9afdb107a3c547cf9198
+MISC metadata.xml 992 BLAKE2B 1dc36cb359f2ccd2bf0eb0f5fda6140710db00346584a04c212dc3bebea553f51cf62b5749be317582422c26784190ec07164a0f06ff99c684fa1e8145a8959d SHA512 c0eec9a57ce335830b0cbfd59752905d4c06a647dd416c0434f78caf676d56ed3f9d9a706fea4e45c3cbdd40706f31fc0116ebb77dd3e8d9a3d6b905622bc3c8
diff --git a/sci-libs/miopen/files/miopen-6.1.1-fix-libcxx.patch b/sci-libs/miopen/files/miopen-6.1.1-fix-libcxx.patch
new file mode 100644
index 000000000000..0ce842d1470a
--- /dev/null
+++ b/sci-libs/miopen/files/miopen-6.1.1-fix-libcxx.patch
@@ -0,0 +1,246 @@
+--- a/cmake/EnableCompilerWarnings.cmake
++++ b/cmake/EnableCompilerWarnings.cmake
+@@ -70,6 +70,7 @@ set(__clang_cxx_compile_options
+ -Wno-unused-command-line-argument
+ -Wno-weak-vtables
+ -Wno-covered-switch-default
++ -Wno-switch-default
+ -Wno-unused-result
+ -Wno-unsafe-buffer-usage
+ -Wno-deprecated-declarations
+--- a/src/include/miopen/bfloat16.hpp
++++ b/src/include/miopen/bfloat16.hpp
+@@ -28,6 +28,7 @@
+ #include <boost/operators.hpp>
+ #include <iostream>
+ #include <miopen/config.h>
++#include <miopen/libcxx_compat.hpp>
+
+ class bfloat16 : boost::totally_ordered<bfloat16, boost::arithmetic<bfloat16>>
+ {
+@@ -152,7 +153,7 @@ private:
+ std::uint16_t data_;
+ };
+
+-namespace std {
++NAMESPACE_STD_BEGIN
+ template <>
+ class numeric_limits<bfloat16>
+ {
+@@ -173,5 +174,5 @@ public:
+ return bfloat16::generate(0x0001); // 0x0.02p-126
+ }
+ };
+-} // namespace std
++NAMESPACE_STD_END
+ #endif
+--- /dev/null
++++ b/src/include/miopen/libcxx_compat.hpp
+@@ -0,0 +1,44 @@
++/*******************************************************************************
++ *
++ * MIT License
++ *
++ * Copyright (c) 2024 Advanced Micro Devices, Inc.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this software and associated documentation files (the "Software"), to deal
++ * in the Software without restriction, including without limitation the rights
++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++ * copies of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in all
++ * copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ *
++ *******************************************************************************/
++#ifndef LIBCXX_COMPAT_HPP_
++#define LIBCXX_COMPAT_HPP_
++
++// Definitions for libc++ compatibility
++#ifdef __has_include
++#if __has_include (<__config>)
++#include <__config>
++#endif
++#endif
++
++#ifdef _LIBCPP_VERSION
++#define NAMESPACE_STD_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
++#define NAMESPACE_STD_END _LIBCPP_END_NAMESPACE_STD
++#else
++#define NAMESPACE_STD_BEGIN namespace std {
++#define NAMESPACE_STD_END }
++#endif
++
++#endif
+--- a/src/kernels/hip_float8.hpp
++++ b/src/kernels/hip_float8.hpp
+@@ -26,6 +26,7 @@
+ #pragma once
+
+ #include "miopen_cstdint.hpp"
++#include "libcxx_compat.hpp"
+
+ #ifndef MIOPEN_ENABLE_F8_DEVICE_CODE
+ #define MIOPEN_ENABLE_F8_DEVICE_CODE 0
+@@ -590,7 +591,7 @@ public:
+ // from the precompiled header.
+ #else
+ // NOLINTBEGIN(cert-dcl58-cpp)
+-namespace std {
++NAMESPACE_STD_BEGIN
+ inline bool isfinite(miopen_f8::hip_f8<miopen_f8::hip_f8_type::fp8> x) // NOLINT
+ {
+ return !(x.is_inf() || x.is_nan());
+@@ -611,12 +612,12 @@ inline bool isnan(miopen_f8::hip_f8<miopen_f8::hip_f8_type::bf8> x) // NOLINT
+ return x.is_nan();
+ }
+
+-} // namespace std
++NAMESPACE_STD_END
+ // NOLINTEND(cert-dcl58-cpp)
+ #endif
+
+ // NOLINTBEGIN(cert-dcl58-cpp)
+-namespace std {
++NAMESPACE_STD_BEGIN
+
+ template <typename T>
+ class numeric_limits;
+@@ -633,7 +634,7 @@ class numeric_limits<miopen_f8::hip_f8<miopen_f8::hip_f8_type::bf8>>
+ {
+ };
+
+-} // namespace std
++NAMESPACE_STD_END
+ // NOLINTEND(cert-dcl58-cpp)
+
+ template <miopen_f8::hip_f8_type T>
+--- /dev/null
++++ b/src/kernels/libcxx_compat.hpp
+@@ -0,0 +1,41 @@
++/*******************************************************************************
++ *
++ * MIT License
++ *
++ * Copyright (c) 2024 Advanced Micro Devices, Inc.
++ *
++ * Permission is hereby granted, free of charge, to any person obtaining a copy
++ * of this software and associated documentation files (the "Software"), to deal
++ * in the Software without restriction, including without limitation the rights
++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++ * copies of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be included in all
++ * copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ *
++ *******************************************************************************/
++#pragma once
++
++// Definitions for libc++ compatibility
++#ifdef __has_include
++#if __has_include (<__config>)
++#include <__config>
++#endif
++#endif
++
++#ifdef _LIBCPP_VERSION
++#define NAMESPACE_STD_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
++#define NAMESPACE_STD_END _LIBCPP_END_NAMESPACE_STD
++#else
++#define NAMESPACE_STD_BEGIN namespace std {
++#define NAMESPACE_STD_END }
++#endif
+--- a/src/kernels/miopen_limits.hpp
++++ b/src/kernels/miopen_limits.hpp
+@@ -33,8 +33,9 @@
+
+ #define MIOPEN_ENABLE_F8_DEVICE_CODE 1
+ #include "hip_float8.hpp"
++#include "libcxx_compat.hpp"
+
+-namespace std {
++NAMESPACE_STD_BEGIN
+
+ template <typename T>
+ class numeric_limits;
+@@ -91,7 +92,7 @@ public:
+ };
+ #endif
+
+-} // namespace std
++NAMESPACE_STD_END
+
+ #else
+
+--- a/src/kernels/miopen_type_traits.hpp
++++ b/src/kernels/miopen_type_traits.hpp
+@@ -26,8 +26,9 @@
+ #pragma once
+
+ #ifdef MIOPEN_DONT_USE_HIP_RUNTIME_HEADERS
++#include "libcxx_compat.hpp"
+
+-namespace std {
++NAMESPACE_STD_BEGIN
+
+ template <class T>
+ struct remove_reference
+@@ -140,7 +141,7 @@ struct conditional<false, X, Y>
+ template <bool predicate, typename X, typename Y>
+ using conditional_t = typename conditional<predicate, X, Y>::type;
+
+-} // namespace std
++NAMESPACE_STD_END
+ #else
+
+ #include <type_traits> // std::remove_reference, std::remove_cv, is_pointer
+--- a/src/kernels/miopen_utility.hpp
++++ b/src/kernels/miopen_utility.hpp
+@@ -28,8 +28,9 @@
+ #ifdef MIOPEN_DONT_USE_HIP_RUNTIME_HEADERS
+
+ #include "miopen_type_traits.hpp" // std::remove_reference
++#include "libcxx_compat.hpp"
+
+-namespace std {
++NAMESPACE_STD_BEGIN
+
+ template <typename T>
+ constexpr T&& forward(typename remove_reference<T>::type& t_) noexcept
+@@ -43,7 +44,7 @@ constexpr T&& forward(typename remove_reference<T>::type&& t_) noexcept
+ return static_cast<T&&>(t_);
+ }
+
+-} // namespace std
++NAMESPACE_STD_END
+
+ #else
+
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -481,6 +481,7 @@ if( MIOPEN_BACKEND MATCHES "OpenCL" OR MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN
+ kernels/gpr_alloc.inc
+ kernels/hip_atomic.hpp
+ kernels/hip_f8_impl.hpp
++ kernels/libcxx_compat.hpp
+ kernels/hip_float8.hpp
+ kernels/inst_wrappers.inc
+ kernels/miopen_cstdint.hpp
diff --git a/sci-libs/miopen/files/miopen-6.3.0-conditional-ck-components.patch b/sci-libs/miopen/files/miopen-6.3.0-conditional-ck-components.patch
new file mode 100644
index 000000000000..b4332d5a1ca6
--- /dev/null
+++ b/sci-libs/miopen/files/miopen-6.3.0-conditional-ck-components.patch
@@ -0,0 +1,46 @@
+composable_kernel does not build some functions/targets depending on GPU.
+Upstream bug: https://github.com/ROCm/composable_kernel/issues/1646
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -847,10 +847,6 @@ target_include_directories(MIOpen PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/include>
+ )
+
+-if(MIOPEN_USE_COMPOSABLEKERNEL)
+-set(MIOPEN_CK_LINK_FLAGS composable_kernel::device_other_operations composable_kernel::device_gemm_operations composable_kernel::device_conv_operations composable_kernel::device_reduction_operations composable_kernel::device_mha_operations hip::host)
+-endif()
+-
+ if(WIN32)
+ # Refer to https://en.cppreference.com/w/cpp/language/types for details.
+ target_compile_options(MIOpen PRIVATE $<BUILD_INTERFACE:$<$<CXX_COMPILER_ID:Clang>:-U__LP64__>>)
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -327,7 +327,27 @@ add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:HIP_COMPILER_FLAGS=${HIP_COMPI
+ # HIP
+ if( MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIPNOGPU")
+ if(MIOPEN_USE_COMPOSABLEKERNEL)
+- find_package(composable_kernel 1.0.0 COMPONENTS device_other_operations device_gemm_operations device_conv_operations device_reduction_operations device_mha_operations)
++ set(MIOPEN_CK_LINK_FLAGS hip::host)
++ set(COMPONENTS_LIST device_other_operations device_gemm_operations device_conv_operations device_reduction_operations device_mha_operations)
++ foreach(component IN LISTS COMPONENTS_LIST)
++ find_package(composable_kernel 1.0.0 COMPONENTS ${component} QUIET)
++ if(TARGET composable_kernel::${component})
++ list(APPEND MIOPEN_CK_LINK_FLAGS "composable_kernel::${component}")
++ else()
++ message(WARNING "CK component '${component}' not found.")
++ endif()
++ endforeach()
++ if(AMDGPU_TARGETS MATCHES "gfx94" OR AMDGPU_TARGETS MATCHES "gfx90a")
++ add_definitions(-DMIOPEN_USE_CK_MHA_OPS=1)
++ else()
++ add_definitions(-DMIOPEN_USE_CK_MHA_OPS=0)
++ endif()
++ if(AMDGPU_TARGETS MATCHES "gfx9")
++ add_definitions(-DMIOPEN_USE_CK_XDL_OPS=1)
++ else()
++ add_definitions(-DMIOPEN_USE_CK_XDL_OPS=0)
++ endif()
++
+ endif()
+ if( MIOPEN_BACKEND STREQUAL "HIPNOGPU")
+ set(MIOPEN_MODE_NOGPU 1)
diff --git a/sci-libs/miopen/files/miopen-6.3.0-isnan-include.patch b/sci-libs/miopen/files/miopen-6.3.0-isnan-include.patch
new file mode 100644
index 000000000000..c7672e96a117
--- /dev/null
+++ b/sci-libs/miopen/files/miopen-6.3.0-isnan-include.patch
@@ -0,0 +1,19 @@
+--- a/driver/reducecalculation_driver.hpp
++++ b/driver/reducecalculation_driver.hpp
+@@ -34,6 +34,7 @@
+ #include <algorithm>
+ #include <cfloat>
+ #include <cstdlib>
++#include <cmath>
+ #include <memory>
+ #include <miopen/miopen.h>
+ #include <miopen/tensor.hpp>
+@@ -77,7 +78,7 @@ int32_t mloReduceCalculationForwardRunHost(miopenTensorDescriptor_t inputDesc,
+ for(size_t i = 0; i < reduce_size; ++i)
+ {
+ Tcheck val = static_cast<Tcheck>(input[input_idx]);
+- if(nanPropagation && isnan(val))
++ if(nanPropagation && std::isnan(val))
+ {
+ val = 0.0f;
+ }
diff --git a/sci-libs/miopen/metadata.xml b/sci-libs/miopen/metadata.xml
index e08e7753394d..07d78ddb5aa1 100644
--- a/sci-libs/miopen/metadata.xml
+++ b/sci-libs/miopen/metadata.xml
@@ -19,4 +19,10 @@
<upstream>
<remote-id type="github">ROCm/MIOpen</remote-id>
</upstream>
+ <use>
+ <flag name="composable-kernel">Use composable-kernel for GEMM-like and reduction-like operators.</flag>
+ <flag name="hipblaslt">Use hipBLASLt for some non-batched and strided batched problems.</flag>
+ <flag name="rocblas">Build with rocBLAS support</flag>
+ <flag name="roctracer">Build with roctracer support</flag>
+ </use>
</pkgmetadata>
diff --git a/sci-libs/miopen/miopen-6.1.1.ebuild b/sci-libs/miopen/miopen-6.1.1.ebuild
index f272f435ece8..6cf70cea3434 100644
--- a/sci-libs/miopen/miopen-6.1.1.ebuild
+++ b/sci-libs/miopen/miopen-6.1.1.ebuild
@@ -21,7 +21,7 @@ IUSE="debug test"
RESTRICT="!test? ( test )"
RDEPEND="
- dev-util/hip
+ dev-util/hip:${SLOT}
>=dev-db/sqlite-3.17
sci-libs/rocBLAS:${SLOT}[${ROCM_USEDEP}]
sci-libs/composable-kernel:${SLOT}[${ROCM_USEDEP}]
diff --git a/sci-libs/miopen/miopen-6.3.0.ebuild b/sci-libs/miopen/miopen-6.3.0.ebuild
new file mode 100644
index 000000000000..45b1214c37cd
--- /dev/null
+++ b/sci-libs/miopen/miopen-6.3.0.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ROCM_VERSION=${PV}
+LLVM_COMPAT=( 19 )
+
+inherit cmake flag-o-matic llvm-r1 rocm
+
+DESCRIPTION="AMD's Machine Intelligence Library"
+HOMEPAGE="https://github.com/ROCm/MIOpen"
+SRC_URI="https://github.com/ROCm/MIOpen/archive/rocm-${PV}.tar.gz -> MIOpen-${PV}.tar.gz"
+S="${WORKDIR}/MIOpen-rocm-${PV}"
+
+LICENSE="MIT"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+
+IUSE="composable-kernel debug hipblaslt rocblas roctracer test"
+
+# tests can freeze machine depending on gpu/kernel
+RESTRICT="test"
+
+RDEPEND="
+ dev-util/hip:${SLOT}
+ >=dev-db/sqlite-3.17
+ sci-libs/rocRAND:${SLOT}[${ROCM_USEDEP}]
+ >=dev-libs/boost-1.72
+ dev-cpp/nlohmann_json
+ dev-cpp/frugally-deep
+
+ composable-kernel? ( sci-libs/composable-kernel:${SLOT}[${ROCM_USEDEP}] )
+ hipblaslt? (
+ sci-libs/hipBLAS:${SLOT}[${ROCM_USEDEP}]
+ sci-libs/hipBLASLt:${SLOT}
+ )
+ rocblas? ( sci-libs/rocBLAS:${SLOT}[${ROCM_USEDEP}] )
+ roctracer? ( dev-util/roctracer:${SLOT}[${ROCM_USEDEP}] )
+"
+
+DEPEND="${RDEPEND}"
+
+BDEPEND="
+ >=dev-libs/half-1.12.0-r1
+ dev-build/rocm-cmake
+ test? ( dev-cpp/gtest )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-6.1.1-build-all-tests.patch
+ "${FILESDIR}"/${PN}-6.1.1-fix-libcxx.patch
+ "${FILESDIR}"/${PN}-6.3.0-conditional-ck-components.patch
+ "${FILESDIR}"/${PN}-6.3.0-isnan-include.patch
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ # complementary replacements for conditional-ck-components patch
+ find src -name '*mha*.cpp' -type f | while IFS= read -r file; do
+ sed -i "s/MIOPEN_USE_COMPOSABLEKERNEL/MIOPEN_USE_CK_MHA_OPS/g" "$file" || die
+ done
+
+ sed -i "s/MIOPEN_USE_COMPOSABLEKERNEL/MIOPEN_USE_CK_XDL_OPS/g" \
+ src/mlo_dir_conv.cpp \
+ src/solver/conv_ck_igemm_fwd_bias_res_add_activ_fused.cpp \
+ src/solver/conv_ck_igemm_fwd_bias_activ_fused.cpp || die
+ find src -name '*xdl*.cpp' -type f | while IFS= read -r file; do
+ sed -i "s/MIOPEN_USE_COMPOSABLEKERNEL/MIOPEN_USE_CK_XDL_OPS/g" "$file" || die
+ done
+
+ sed -e '/MIOPEN_TIDY_ERRORS ALL/d' \
+ -e 's/FLAGS_RELEASE} -s/FLAGS_RELEASE}/g' \
+ -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
+}
+
+src_configure() {
+ rocm_use_hipcc
+
+ 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
+ -DMIOPEN_USE_ROCTRACER=$(usex roctracer ON OFF)
+ -DMIOPEN_USE_ROCBLAS=$(usex rocblas ON OFF)
+ -DMIOPEN_USE_HIPBLASLT=$(usex hipblaslt ON OFF)
+ -DMIOPEN_USE_COMPOSABLEKERNEL=$(usex composable-kernel ON OFF)
+ -DBUILD_TESTING=$(usex test ON OFF)
+ -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF
+ -DROCM_SYMLINK_LIBS=OFF
+ -DMIOPEN_HIP_COMPILER="${ESYSROOT}/usr/bin/hipcc"
+ -DMIOPEN_AMDGCN_ASSEMBLER="$(get_llvm_prefix)/bin/clang"
+ -DHIP_OC_COMPILER="$(get_llvm_prefix)/bin/clang"
+ )
+
+ if use test; then
+ mycmakeargs+=(
+ -DMIOPEN_TEST_ALL=ON
+ -DMIOPEN_TEST_GDB=OFF
+ )
+ # needed by rocminfo
+ addpredict /dev/random
+ check_amdgpu
+ fi
+
+ cmake_src_configure
+}
+
+src_test() {
+ check_amdgpu
+ LD_LIBRARY_PATH="${BUILD_DIR}"/lib MIOPEN_SYSTEM_DB_PATH="${BUILD_DIR}"/share/miopen/db/ cmake_src_test -j1
+}
+
+src_install() {
+ cmake_src_install
+}