guix_mirror_bot pushed a commit to branch master
in repository guix.

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

    gnu: Add rocprim.
    
    Adapted from the Guix-HPC channel 
(https://gitlab.inria.fr/guix-hpc/guix-hpc).
    
    * gnu/packages/rocm-libs.scm (rocprim): New variable.
    * gnu/packages/patches/rocprim-placement-new-delete.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Register it.
    
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/local.mk                                       |  1 +
 .../patches/rocprim-placement-new-delete.patch     | 17 ++++++++++++
 gnu/packages/rocm-libs.scm                         | 30 ++++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index bf36a90139..576cc1ee4b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2292,6 +2292,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch  
\
   %D%/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch   
\
   
%D%/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch
    \
+  %D%/packages/patches/rocprim-placement-new-delete.patch      \
   %D%/packages/patches/rottlog-direntry.patch                  \
   %D%/packages/patches/ruby-actionpack-remove-browser-tests.patch      \
   %D%/packages/patches/ruby-activesupport-fix-deprecation-warning.patch        
\
diff --git a/gnu/packages/patches/rocprim-placement-new-delete.patch 
b/gnu/packages/patches/rocprim-placement-new-delete.patch
new file mode 100644
index 0000000000..363e907923
--- /dev/null
+++ b/gnu/packages/patches/rocprim-placement-new-delete.patch
@@ -0,0 +1,17 @@
+diff --git a/rocprim/include/rocprim/config.hpp 
b/rocprim/include/rocprim/config.hpp
+index 2dd3e55..36acff1 100644
+--- a/rocprim/include/rocprim/config.hpp
++++ b/rocprim/include/rocprim/config.hpp
+@@ -27,6 +27,12 @@
+ #include <hip/hip_fp16.h>
+ #include <hip/hip_runtime.h>
+ 
++__device__ _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* 
__p) _GLIBCXX_USE_NOEXCEPT
++{
++      return __p;
++}
++__device__ inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT {}
++
+ // This file is generated by CMake. It's safe to ignore this when parsed by 
clangd.
+ #ifndef _CLANGD
+     #include "rocprim_version.hpp"
diff --git a/gnu/packages/rocm-libs.scm b/gnu/packages/rocm-libs.scm
index ac0b951285..00af86f039 100644
--- a/gnu/packages/rocm-libs.scm
+++ b/gnu/packages/rocm-libs.scm
@@ -469,3 +469,33 @@ functionalities beyond a traditional BLAS library.")
     (description "rocBLAS is the ROCm Basic Linear Algebra Subprograms
 (BLAS) library.  It is implemented in the HIP programming language.")
     (license (list license:expat license:bsd-3))))
+
+(define-public rocprim
+  (package
+    (name "rocprim")
+    (version %rocm-version)
+    (source
+     (rocm-library-source
+      "rocprim"
+      ;; XXX: With libstdc++, the placement new operator is not defined for
+      ;; device code.
+      #:patches (search-patches "rocprim-placement-new-delete.patch")))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:build-type "Release"
+      #:tests? #f ; requires GPU
+      #:configure-flags
+      #~(list "-DCMAKE_CXX_COMPILER=hipcc"
+              #$(string-append "-DAMDGPU_TARGETS="
+                               (current-amd-gpu-targets-string)))))
+    (inputs (list rocm-hip-runtime))
+    (native-inputs (list rocm-cmake rocm-toolchain))
+    (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
+    (home-page %rocm-libraries-url)
+    (synopsis
+     "Header-only library providing HIP parallel primitives")
+    (description
+     "The rocPRIM is a header-only library providing HIP parallel primitives
+for developing performant GPU-accelerated code on the AMD ROCm platform.")
+    (license license:expat)))

Reply via email to