guix_mirror_bot pushed a commit to branch master
in repository guix.

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

    gnu: Add offload-rocm.
    
    * gnu/packages/llvm.scm (offload-rocm): New variable.
    
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/packages/llvm.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index e8fbbed4ed..b4b8e26f6f 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -2121,6 +2121,52 @@ existing compilers together.")
 (define-public clang-rocm-toolchain
   (make-clang-toolchain clang-rocm libomp-rocm))
 
+(define-public offload-rocm
+  (package
+    (name "offload-rocm")
+    (version (package-version llvm-rocm))
+    (source (package-source llvm-rocm))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld"
+         "-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "offload")))
+          (add-after 'chdir 'libffi-dynamic-link
+            (lambda _
+              (substitute* "plugins-nextgen/host/CMakeLists.txt"
+                (("if\\(FFI_STATIC.*") "if(FALSE)\n"))))
+          (add-after 'install 'install-license
+            (lambda _
+              (install-file "../LICENSE.TXT"
+                            (string-append #$output "/share/doc/"
+                                           #$name "-" #$version)))))
+      ;; XXX: Tests cannot be built with ROCm version 7.1.1:
+      ;; 
https://github.com/ROCm/llvm-project/blob/27682a16360e33e37c4f3cc6adf9a620733f8fe1/offload/CMakeLists.txt#L443
+      #:tests? #f))
+    (native-inputs
+     (list clang-rocm-toolchain
+           lld-wrapper-rocm
+           python))
+    (inputs
+     (list libffi
+           libomp-rocm
+           rocm-device-libs
+           rocr-runtime))
+    (home-page "https://github.com/ROCm/llvm-project/";)
+    (synopsis "LLVM offloading library")
+    (description "This LLVM component provides tooling, runtimes and APIs for
+executing code on accelerators which may have a different architecture than
+the host.")
+    ;; Apache license 2.0 with LLVM exception
+    (license license:asl2.0)))
+
 
 
 (define-public include-what-you-use

Reply via email to