guix_mirror_bot pushed a commit to branch master
in repository guix.

commit dea0a3842b80c036f071b84893f19c8ce38fc7c2
Author: David Elsing <[email protected]>
AuthorDate: Tue Feb 3 21:33:21 2026 +0100

    gnu: Add miopen.
    
    * gnu/packages/rocm-libs.scm (miopen): New variable.
    * gnu/packages/patches/miopen-zstd.patch (miopen): New patch.
    * gnu/local.mk (dist_patch_DATA): Register it.
    
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/local.mk                           |  1 +
 gnu/packages/patches/miopen-zstd.patch | 16 ++++++++
 gnu/packages/rocm-libs.scm             | 75 ++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 24425d0281..a33b86e388 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1907,6 +1907,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/minisat-friend-declaration.patch                \
   %D%/packages/patches/minisat-install.patch                   \
   %D%/packages/patches/miniz-for-pytorch.patch                 \
+  %D%/packages/patches/miopen-zstd.patch                       \
   %D%/packages/patches/mit-krb5-hurd.patch                     \
   %D%/packages/patches/mitm-cache-head-requests.patch          \
   %D%/packages/patches/mpc123-initialize-ao.patch              \
diff --git a/gnu/packages/patches/miopen-zstd.patch 
b/gnu/packages/patches/miopen-zstd.patch
new file mode 100644
index 0000000000..4e7e9bf917
--- /dev/null
+++ b/gnu/packages/patches/miopen-zstd.patch
@@ -0,0 +1,16 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 377dbe3..8d65dfd 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -846,10 +846,7 @@ if(HAS_LIB_STD_FILESYSTEM)
+     target_link_libraries(MIOpen PRIVATE stdc++fs)
+ endif()
+ 
+-find_package(zstd)
+-if(zstd_FOUND)
+-    target_link_libraries(MIOpen PRIVATE 
$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)
+-endif()
++target_link_libraries(MIOpen PRIVATE zstd)
+ 
+ function(target_internal_library TARGET)
+     target_link_libraries(${TARGET} PRIVATE ${ARGN})
diff --git a/gnu/packages/rocm-libs.scm b/gnu/packages/rocm-libs.scm
index 3d7522d3f8..0d63415e0a 100644
--- a/gnu/packages/rocm-libs.scm
+++ b/gnu/packages/rocm-libs.scm
@@ -24,14 +24,17 @@
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module (gnu packages)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages base)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages logging)
+  #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pretty-print)
@@ -42,6 +45,7 @@
   #:use-module (gnu packages rocm)
   #:use-module (gnu packages rocm-tools)
   #:use-module (gnu packages serialization)
+  #:use-module (gnu packages sqlite)
   #:use-module (srfi srfi-1))
 
 ;; The components are tightly integrated and can only be upgraded as a unit. If
@@ -796,3 +800,74 @@ GPUs using the HIP programming language.")
 half-precision floating point type (IEEE 754 conformant) together with common
 operations on this type.")
     (license license:expat)))
+
+(define-public miopen
+  (package
+    (name "miopen")
+    (version %rocm-version)
+    (source
+     (rocm-library-source
+      "miopen"
+      #:patches
+      (search-patches
+       "miopen-zstd.patch")))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f ; requires GPU
+      #:build-type "Release"
+      #:configure-flags
+      #~(list
+         "-DCMAKE_CXX_COMPILER=hipcc"
+         "-DBoost_USE_STATIC_LIBS=OFF"
+         #$(string-append "-DAMDGPU_TARGETS=" 
(current-amd-gpu-targets-string)))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'disable-tidy+tests
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("add_subdirectory.*test.*") "")
+                (("set\\(MIOPEN_TIDY_ERRORS ALL\\)") ""))))
+          (add-after 'unpack 'adjust-ck-checks
+            (lambda _
+              (substitute* (find-files "src" ".*mha.*\\.cpp$")
+                (("MIOPEN_USE_COMPOSABLEKERNEL") "MIOPEN_USE_CK_MHA_OPS"))
+              (substitute*
+                  (cons*
+                   "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"
+                   (find-files "src" ".*xdl.*\\.cpp$"))
+                (("MIOPEN_USE_COMPOSABLEKERNEL") "MIOPEN_USE_CK_XDL_OPS")))))))
+    (inputs
+     (list
+      boost
+      composable-kernel
+      hipblas
+      hipblas-common
+      hipblaslt
+      rocblas
+      rocm-hip-runtime
+      rocmlir
+      rocrand
+      roctracer
+      sqlite
+      `(,zstd "lib")))
+    (native-inputs
+     (list
+      eigen
+      frugally-deep
+      functionalplus
+      googletest
+      half-rocm
+      nlohmann-json
+      pkg-config
+      rocm-cmake
+      rocm-toolchain))
+    (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
+    (home-page %rocm-libraries-url)
+    (synopsis "GPU library for machine learning primitives")
+    (description "@code{MIOpen} is a library which exposes a C API to GPU
+machine learning primitives.  This package contains the HIP version based on
+ROCm.")
+    (license license:expat)))

Reply via email to