summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJean-Baptiste Note <jean-baptiste.note@m4x.org>2025-09-25 16:15:47 +0200
committerRutherther <rutherther@ditigal.xyz>2026-01-25 21:23:27 +0100
commita6306eb0bcb7fa19a830830691573aeb15483641 (patch)
treeceff5f78169634e584f27027a5e9e66d7b1dbb17 /gnu
parenta43d32577de300113f25577f27a9c002b69757b5 (diff)
gnu: Bump rocm to version 7.1.0
* gnu/packages/llvm.scm (%rocm-llvm-version): New variable. (make-llvm-rocm): New procedure. (llvm-rocm): New variable. (make-clang-runtime-rocm): New procedure. (clang-runtime-rocm): New variable. (make-clang-rocm): New procedure. (clang-rocm): New variable. (rocm-device-libs): New variable. (rocm-comgr): New variable. (rocm-hipcc): New variable. (make-lld-rocm): New procedure. (lld-rocm): New variable. * gnu/packages/rocm.scm: Add perl to imports. (%rocm-version): Update to 7.1.0. (%rocm-systems-url, %rocm-systems-origin): New variables. (rocr-runtime): Use %rocm-systems-origin and update build. (rocm-opencl-runtime): Use %rocm-systems-origin and update build. (rocm-hip-runtime): New variable. (rocminfo): Use %rocm-systems-origin and update build. (%default-amdgpu-targets, %default-amdgpu-targets-property): New variables. (%amdgpu-targets): New syntax. (rocm-bandwidth-test): Update and add comprehensive build support. * gnu/local.mk: Add rocm-bandwidth-test patches. * gnu/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch, gnu/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch, gnu/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch: New files. * gnu/packages/patches/rocclr-5.6.0-enable-gfx800.patch, gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch: Update patch paths. Change-Id: I43f162b9f8ab898e25d8ecbe4ea30be84a29eb0d Signed-off-by: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk3
-rw-r--r--gnu/packages/llvm.scm306
-rw-r--r--gnu/packages/patches/rocclr-5.6.0-enable-gfx800.patch4
-rw-r--r--gnu/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch58
-rw-r--r--gnu/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch16
-rw-r--r--gnu/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch29
-rw-r--r--gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch8
-rw-r--r--gnu/packages/rocm.scm489
8 files changed, 702 insertions, 211 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 672ce470a69..e4a747000bb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2288,6 +2288,9 @@ dist_patch_DATA = \
2288 %D%/packages/patches/rng-tools-revert-build-randstat.patch \ 2288 %D%/packages/patches/rng-tools-revert-build-randstat.patch \
2289 %D%/packages/patches/rocclr-5.6.0-enable-gfx800.patch \ 2289 %D%/packages/patches/rocclr-5.6.0-enable-gfx800.patch \
2290 %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \ 2290 %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \
2291 %D%/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch \
2292 %D%/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch \
2293 %D%/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch \
2291 %D%/packages/patches/rottlog-direntry.patch \ 2294 %D%/packages/patches/rottlog-direntry.patch \
2292 %D%/packages/patches/ruby-actionpack-remove-browser-tests.patch \ 2295 %D%/packages/patches/ruby-actionpack-remove-browser-tests.patch \
2293 %D%/packages/patches/ruby-activesupport-fix-deprecation-warning.patch \ 2296 %D%/packages/patches/ruby-activesupport-fix-deprecation-warning.patch \
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 44d5478346d..5ae9f19f0b4 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -67,6 +67,7 @@
67 #:use-module (gnu packages autotools) 67 #:use-module (gnu packages autotools)
68 #:use-module (gnu packages base) 68 #:use-module (gnu packages base)
69 #:use-module (gnu packages cmake) 69 #:use-module (gnu packages cmake)
70 #:use-module (gnu packages bash)
70 #:use-module (gnu packages crypto) 71 #:use-module (gnu packages crypto)
71 #:use-module (gnu packages gcc) 72 #:use-module (gnu packages gcc)
72 #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker 73 #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker
@@ -86,6 +87,7 @@
86 #:use-module (gnu packages pkg-config) 87 #:use-module (gnu packages pkg-config)
87 #:use-module (gnu packages python) 88 #:use-module (gnu packages python)
88 #:use-module (gnu packages python-build) 89 #:use-module (gnu packages python-build)
90 #:use-module (gnu packages rocm)
89 #:use-module (gnu packages swig) 91 #:use-module (gnu packages swig)
90 #:use-module (gnu packages vulkan) 92 #:use-module (gnu packages vulkan)
91 #:use-module (gnu packages xml) 93 #:use-module (gnu packages xml)
@@ -1283,40 +1285,282 @@ Library.")
1283(define-public clang clang-13) 1285(define-public clang clang-13)
1284(define-public clang-toolchain clang-toolchain-13) 1286(define-public clang-toolchain clang-toolchain-13)
1285 1287
1286(define-public llvm-for-rocm 1288
1289
1290;; ROCm compiler infrastructure elements are compiled from a monorepo at
1291;; https://github.com/ROCm/llvm-project. Due to some of these parts
1292;; referencing both a common origin and llvm helpers (in particular related to
1293;; patches and base packages). Other ROCm elements are part of rocm.scm
1294
1295;; This must match '%rocm-version' in rocm.scm. They cannot be shared because
1296;; toplevel variables cannot be called from one file to another.
1297(define %rocm-llvm-version "7.1.0")
1298
1299(define (make-llvm-rocm llvm-base)
1287 (package 1300 (package
1288 ;; Currently based on LLVM 19. 1301 (inherit llvm-base)
1289 (inherit llvm-19) 1302 ;; XXX A lot of llvm package phases are dependent on llvm version. Are
1290 (name "llvm-for-rocm") 1303 ;; these resolved early, so that we can override the package version easily?
1291 (version "6.4.2") ;this must match '%rocm-version' 1304 (version %rocm-llvm-version)
1305 (name "llvm-rocm")
1292 (source (origin 1306 (source (origin
1293 (method git-fetch) 1307 (method git-fetch)
1294 (uri (git-reference 1308 (uri (git-reference
1295 (url "https://github.com/ROCm/llvm-project.git") 1309 (url "https://github.com/ROCm/llvm-project")
1296 (commit (string-append "rocm-" version)))) 1310 (commit (string-append "rocm-" %rocm-llvm-version))))
1297 (file-name (git-file-name name version)) 1311 (file-name (git-file-name "rocm-llvm" %rocm-llvm-version))
1298 (sha256 1312 (sha256
1299 (base32 1313 (base32
1300 "1j2cr362k7snsh5c1z38ikyihmjvy0088rj0f0dhng6cjwgysryp")))) 1314 "1nwbj2cz99psgq9s9l4wbsxj41l2d2dga5l9rw9jndk05jsn4n7s"))
1315 ;; Some of these patches require a further dynamic substitution during
1316 ;; package build. Therefore, it is important to derive from the base
1317 ;; packages or to duplicate such substitutions. Additionally, some of
1318 ;; those substitutions are only applied on specific subcomponents
1319 ;; (llvm-clang), so duplicating the base-llvm structure with subcomponents
1320 ;; is necessary.
1321 (patches
1322 (map search-patch
1323 (assoc-ref %llvm-patches (package-version llvm-base))))))
1301 (arguments 1324 (arguments
1302 (substitute-keyword-arguments (package-arguments llvm-19) 1325 (substitute-keyword-arguments (package-arguments llvm-base)
1303 ((#:configure-flags flags) 1326 ((#:configure-flags flags)
1304 #~(list "-DLLVM_ENABLE_PROJECTS=llvm;clang;lld" 1327 #~(append #$flags
1305 "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86" 1328 (list "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
1306 "-DCMAKE_SKIP_BUILD_RPATH=FALSE" 1329 "-DLLVM_VERSION_SUFFIX=")))))
1307 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
1308 "-DBUILD_SHARED_LIBS:BOOL=TRUE"
1309 "-DLLVM_VERSION_SUFFIX="))))
1310 (properties `((hidden? . #t) 1330 (properties `((hidden? . #t)
1311 ,@(package-properties llvm-19))) 1331 ,@(package-properties llvm-base)))
1312 (home-page "https://github.com/ROCm/llvm-project") 1332 (home-page "https://github.com/ROCm/llvm-project")
1313 (synopsis 1333 (synopsis
1314 (string-append (package-synopsis llvm-19) " (AMD fork)")) 1334 (string-append (package-synopsis llvm-base) " (AMD fork)"))
1315 (description 1335 (description
1316 (string-append (package-description llvm-19) " 1336 (string-append (package-description llvm-base) "
1317 1337
1318This AMD fork includes AMD-specific additions.")))) 1338This AMD fork includes AMD-specific additions."))))
1319 1339
1340(define-public llvm-rocm (make-llvm-rocm llvm-20))
1341
1342(define (make-clang-runtime-rocm clang-runtime-base)
1343 (package
1344 (inherit clang-runtime-base)
1345 (name "clang-runtime-rocm")
1346 (version (package-version llvm-rocm))
1347 (source (package-source llvm-rocm))
1348 (inputs (modify-inputs (package-inputs clang-runtime-base)
1349 (replace "llvm" llvm-rocm)))))
1350
1351(define-public clang-runtime-rocm (make-clang-runtime-rocm clang-runtime-20))
1352
1353(define (make-clang-rocm clang-base)
1354 ;; note: tools-extra is embedded in the checkout
1355 (package
1356 (inherit clang-base)
1357 (name "clang-rocm")
1358 (version (package-version llvm-rocm))
1359 (source (package-source llvm-rocm))
1360 (inputs (modify-inputs (package-inputs clang-base)
1361 (delete "clang-tools-extra")))
1362 (propagated-inputs
1363 (modify-inputs (package-propagated-inputs clang-base)
1364 (replace "llvm" llvm-rocm)
1365 (replace "clang-runtime" clang-runtime-rocm)
1366 (append python-lit)))
1367 (arguments
1368 (substitute-keyword-arguments (package-arguments clang-base)
1369 ;; The tests can be run, as allowed by check phase rewrite and
1370 ;; LLVM_EXTERNAL_LIT setting. However, 84/46171 are failing. Most
1371 ;; should probably be disabled.
1372 ;;
1373 ;; - CUDA tests are failing.
1374 ;;
1375 ;; - Checking for some -L[[SYSROOT]] is failing, which I guess is
1376 ;; expected, given the patches we apply, which are mangling directory
1377 ;; searching for libraries.
1378 ;;
1379 ;; Getting the test suite to pass doesn't seem out of reach. We
1380 ;; probably should start with the standard llvm-clang-20x package.
1381 ((#:tests? _ #t) #f)
1382 ((#:configure-flags flags)
1383 #~(append #$flags
1384 (list
1385 "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
1386 ;; WARNING: we could patch
1387 ;; #$llvm-rocm/lib/cmake/llvm/AddLLVM.cmake to simplify, by
1388 ;; substituting set(LIT_COMMAND
1389 ;; "${Python3_EXECUTABLE};${lit_base_dir}/${lit_file_name}")
1390 ;; pending this, having a correct python script here is a
1391 ;; must-have.
1392 ;; TODO: test this on llvm-rocm.
1393 (string-append
1394 "-DLLVM_EXTERNAL_LIT="
1395 (search-input-file %build-inputs "bin/.lit-real"))
1396 ;; Disable clang wrapper which depends on lld as well.
1397 "-DCLANG_ENABLE_AMDCLANG=OFF")))
1398 ((#:phases phases '%standard-phases)
1399 #~(modify-phases #$phases
1400 (replace 'check
1401 (lambda* (#:rest args)
1402 (setenv "HOME" "/tmp")
1403 (apply (assoc-ref
1404 (@ (guix build gnu-build-system) %standard-phases)
1405 'check)
1406 #:test-target "check-clang" args)))
1407 (replace 'add-tools-extra
1408 (lambda _
1409 (copy-recursively "../clang-tools-extra" "tools/extra")))))))))
1410
1411(define-public clang-rocm (make-clang-rocm clang-20))
1412
1413(define-public rocm-device-libs
1414 (package
1415 (name "rocm-device-libs")
1416 (version (package-version llvm-rocm))
1417 (source (package-source llvm-rocm))
1418 (build-system cmake-build-system)
1419 (arguments
1420 (list
1421 #:tests? #f ; Not sure how to run them.
1422 #:build-type "Release"
1423 #:phases
1424 #~(modify-phases %standard-phases
1425 (add-after 'unpack 'chdir
1426 (lambda _
1427 (chdir "amd/device-libs")))
1428 (add-after 'install 'copy-include-directories
1429 (lambda _
1430 ;; at this point we're within amd/build; i guess the build
1431 ;; directory should be at the same level as source, but due to
1432 ;; the chdir above...
1433 (with-directory-excursion "../device-libs"
1434 (for-each
1435 (lambda (directory)
1436 (let ((include-directory (string-append directory "/inc")))
1437 (copy-recursively
1438 include-directory
1439 (string-append #$output "/" include-directory))))
1440 (list "irif" "oclc" "ockl" "ocml"))))))))
1441 (inputs (list clang-rocm))
1442 (home-page "https://github.com/ROCm/llvm-project/")
1443 (synopsis "ROCm Device libraries")
1444 (description "ROCm device libraries provide AMD-specific device-side language runtime
1445libraries, namely oclc, ocml, ockl, opencl, hip and hc.")
1446 (license license:ncsa)))
1447
1448;; Usage note from amd/comgr/src/comgr-env.cpp: at runtime, comgr either needs
1449;; the awful ROCM_PATH set, or the more palatable LLVM_PATH and HIP_PATH, set.
1450(define-public rocm-comgr
1451 (package
1452 (name "rocm-comgr")
1453 (version (package-version llvm-rocm))
1454 (source (package-source llvm-rocm))
1455 (build-system cmake-build-system)
1456 (arguments
1457 (list
1458 #:build-type "Release"
1459 #:phases
1460 #~(modify-phases %standard-phases
1461 (add-after 'unpack 'prepare-to-build
1462 (lambda _
1463 (chdir "amd/comgr")
1464 (setenv "ROCM_PATH"
1465 #$(this-package-input "rocm-device-libs")))))))
1466 (inputs (list libffi rocm-device-libs))
1467 (native-inputs (list
1468 clang-rocm
1469 lld-rocm
1470 python))
1471 (home-page "https://github.com/ROCm/ROCm-CompilerSupport")
1472 (synopsis "ROCm Code Object Manager")
1473 (description "The Comgr library provides APIs for compiling and inspecting
1474AMDGPU code objects.")
1475 (license license:ncsa)))
1476
1477(define-public rocm-hipcc
1478 (package
1479 (name "rocm-hipcc")
1480 (version (package-version llvm-rocm))
1481 (source (package-source llvm-rocm))
1482 (build-system cmake-build-system)
1483 (arguments
1484 (list
1485 #:tests? #f ; Not sure how to run them.
1486 #:build-type "Release"
1487 #:phases
1488 #~(modify-phases %standard-phases
1489 (add-after 'unpack 'chdir
1490 (lambda _
1491 (chdir "amd/hipcc")))
1492 (add-after 'chdir 'patch-rocm-path
1493 (lambda* (#:key inputs #:allow-other-keys)
1494 (substitute* (find-files "src" "\\.h$")
1495 (("roccmPath \\+ \"/bin/rocm_agent_enumerator\"")
1496 (format #f "~s" (search-input-file
1497 inputs
1498 "/bin/rocm_agent_enumerator"))))))
1499 ;; This version file very important, as it is parsed under
1500 ;; $#{llvm-rocm}/clang/lib/Driver/ToolChains/AMDGPU.cpp and its
1501 ;; contents decides on some includes for hipcc.
1502 (add-after 'install 'info-version
1503 (lambda _
1504 (let ((hip-version-dir (string-append #$output "/share/hip")))
1505 (mkdir hip-version-dir)
1506 (with-directory-excursion hip-version-dir
1507 (with-output-to-file "version"
1508 (lambda _
1509 (apply format #t
1510 "HIP_VERSION_MAJOR=~a~%~
1511 HIP_VERSION_MINOR=~a~%~
1512 HIP_VERSION_PATCH=~a~%~
1513 HIP_VERSION_GITHASH=0~%"
1514 (string-split
1515 #$(version-major+minor+point version) #\.))))))))
1516 (add-after 'install 'wrap-programs
1517 (lambda* (#:key inputs outputs #:allow-other-keys)
1518 (let ((output-bindir (string-append (assoc-ref outputs "out") "/bin")))
1519 (for-each
1520 (lambda (file)
1521 (wrap-program (string-append output-bindir "/" file)
1522 ;; The following definitions and their meaning can be
1523 ;; found in hibBin_base.h. We've defined neither
1524 ;; HIP_RUNTIME nor HIP_ROCCLR_HOME.
1525
1526 ;; HIP_ROCCLR_HOME unfortunately cannot be set here
1527 ;; (circular dependency problem) -- it should be set to
1528 ;; #$rocm-hip-runtime.
1529
1530 ;;(list "HIP_ROCCLR_HOME" '= (list #$rocm-hip-runtime))
1531 (list "HIP_PATH" '= (list #$output))
1532 (list "HIP_CLANG_PATH"
1533 '=
1534 (list (string-append
1535 #$(this-package-input "clang-rocm")
1536 "/bin")))
1537 (list "DEVICE_LIB_PATH"
1538 '=
1539 (list (string-append
1540 #$(this-package-input "rocm-device-libs")
1541 "/amdgcn/bitcode")))
1542
1543 ;; This is done in order to please check_config, which
1544 ;; checks that HSA_PATH is in LD_LIBRARY_PATH
1545 (list "LD_LIBRARY_PATH"
1546 'suffix
1547 (list #$(this-package-input "rocr-runtime")))
1548 ;; checks hipconfig is in PATH
1549 (list "PATH" 'suffix (list output-bindir))))
1550 '( "hipcc" "hipconfig" ))))))))
1551 (inputs (list clang-rocm
1552 rocm-device-libs
1553 rocr-runtime
1554 rocminfo
1555 perl
1556 bash-minimal))
1557 (home-page "https://github.com/ROCm/llvm-project/")
1558 (synopsis "ROCm HIP compiler driver (@command{hipcc})")
1559 (description "The HIP compiler driver (@command{hipcc}) is a compiler utility that will
1560call @command{clang} and pass the appropriate include and library options for
1561the target compiler and HIP infrastructure.")
1562 (license license:expat)))
1563
1320 1564
1321 1565
1322(define-public libunwind-headers 1566(define-public libunwind-headers
@@ -1727,6 +1971,26 @@ existing compilers together.")
1727(define-public python-clang-13 1971(define-public python-clang-13
1728 (clang-python-bindings clang-13)) 1972 (clang-python-bindings clang-13))
1729 1973
1974;; XXX
1975;; I would move all of rocm packages here and define a ROCm section.
1976
1977(define (make-lld-rocm lld-base)
1978 (package
1979 (inherit lld-base)
1980 (name "lld-rocm")
1981 (version (package-version llvm-rocm))
1982 (source (package-source llvm-rocm))
1983 (inputs (list llvm-rocm))
1984 (arguments
1985 (substitute-keyword-arguments (package-arguments lld-base)
1986 ((#:configure-flags flags)
1987 #~(append #$flags
1988 '("-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86")))))))
1989
1990(define-public lld-rocm (make-lld-rocm lld-20))
1991
1992
1993
1730(define-public include-what-you-use 1994(define-public include-what-you-use
1731 (package 1995 (package
1732 (name "include-what-you-use") 1996 (name "include-what-you-use")
@@ -1737,8 +2001,8 @@ existing compilers together.")
1737 (origin 2001 (origin
1738 (method git-fetch) 2002 (method git-fetch)
1739 (uri (git-reference 2003 (uri (git-reference
1740 (url "https://github.com/include-what-you-use/include-what-you-use") 2004 (url "https://github.com/include-what-you-use/include-what-you-use")
1741 (commit version))) 2005 (commit version)))
1742 (file-name (git-file-name name version)) 2006 (file-name (git-file-name name version))
1743 (sha256 2007 (sha256
1744 (base32 "0dkk65y6abf7bzv10q1ch3dyzj4d5y89qhh43jn189l861d6pzs0")))) 2008 (base32 "0dkk65y6abf7bzv10q1ch3dyzj4d5y89qhh43jn189l861d6pzs0"))))
diff --git a/gnu/packages/patches/rocclr-5.6.0-enable-gfx800.patch b/gnu/packages/patches/rocclr-5.6.0-enable-gfx800.patch
index 21fd88b82e9..1233fac2c61 100644
--- a/gnu/packages/patches/rocclr-5.6.0-enable-gfx800.patch
+++ b/gnu/packages/patches/rocclr-5.6.0-enable-gfx800.patch
@@ -17,8 +17,8 @@ Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
17 17
18diff --git a/rocclr/device/device.hpp b/rocclr/device/device.hpp 18diff --git a/rocclr/device/device.hpp b/rocclr/device/device.hpp
19index ef82630325..6409cebc90 100644 19index ef82630325..6409cebc90 100644
20--- a/rocclr/device/device.hpp 20--- a/projects/clr/rocclr/device/device.hpp
21+++ b/rocclr/device/device.hpp 21+++ b/projects/clr/rocclr/device/device.hpp
22@@ -1431,8 +1431,5 @@ class Isa { 22@@ -1431,8 +1431,5 @@ class Isa {
23 23
24 /// @returns If the ROCm runtime supports the ISA. 24 /// @returns If the ROCm runtime supports the ISA.
diff --git a/gnu/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch b/gnu/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch
new file mode 100644
index 00000000000..74091f11b5a
--- /dev/null
+++ b/gnu/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch
@@ -0,0 +1,58 @@
1diff --git a/cmake/build_utils.cmake b/cmake/build_utils.cmake
2index 83db1be..6f62931 100644
3--- a/cmake/build_utils.cmake
4+++ b/cmake/build_utils.cmake
5@@ -1010,7 +1010,7 @@ macro(add_bundled_libraries)
6 add_subdirectory(${FMT_SOURCE_DIR} EXCLUDE_FROM_ALL)
7 set(FMT_LIBRARIES fmt::fmt-header-only)
8 else()
9- find_package(${FMT_PACKAGE_NAME} REQUIRED ${FMT_PKG_MINIMUM_REQUIRED_VERSION})
10+ find_package(${FMT_PACKAGE_NAME} ${FMT_PKG_MINIMUM_REQUIRED_VERSION} REQUIRED)
11 set(FMT_LIBRARIES fmt::fmt)
12 endif()
13 list(APPEND 3RD_PARTY_TARGET_LIST ${FMT_LIBRARIES})
14@@ -1020,8 +1020,8 @@ macro(add_bundled_libraries)
15 # Note: C++23+ we can use std::stacktrace for the traces.
16 # Some older compilers/systems will not allow that. We will force/use boost::stacktrace for now.
17 # Check for 'Boost'
18- set(BOOST_PACKAGE_NAME "boost")
19- set(BOOST_LIBRARY_NAME "boost")
20+ set(BOOST_PACKAGE_NAME "Boost")
21+ set(BOOST_LIBRARY_NAME "Boost")
22 set(BOOST_REPO_URL "https://github.com/boostorg/boost.git")
23 set(BOOST_PKG_MINIMUM_REQUIRED_VERSION "1.74.0")
24 set(BOOST_REPO_VERSION "boost-1.88.0")
25@@ -1128,7 +1128,7 @@ macro(add_bundled_libraries)
26 add_subdirectory(${SPDLOG_SOURCE_DIR} EXCLUDE_FROM_ALL)
27 set(SPDLOG_LIBRARIES spdlog::spdlog_header_only)
28 else()
29- find_package(${SPDLOG_PACKAGE_NAME} REQUIRED ${SPDLOG_PKG_MINIMUM_REQUIRED_VERSION})
30+ find_package(${SPDLOG_PACKAGE_NAME} ${SPDLOG_PKG_MINIMUM_REQUIRED_VERSION} REQUIRED)
31 set(SPDLOG_LIBRARIES spdlog::spdlog)
32 endif()
33 list(APPEND 3RD_PARTY_TARGET_LIST ${SPDLOG_LIBRARIES})
34@@ -1162,7 +1162,7 @@ macro(add_bundled_libraries)
35 # find_package(Boost 1.74 REQUIRED COMPONENTS stacktrace_basic)
36 # set(BOOST_LIBRARIES boost::boost)
37 #endif()
38- set(CATCH2_PACKAGE_NAME "catch2")
39+ set(CATCH2_PACKAGE_NAME "Catch2")
40 set(CATCH2_LIBRARY_NAME "Catch2")
41 set(CATCH2_REPO_URL "https://github.com/catchorg/Catch2.git")
42 set(CATCH2_PKG_MINIMUM_REQUIRED_VERSION "3.5.1")
43diff --git a/main/cmdline/CMakeLists.txt b/main/cmdline/CMakeLists.txt
44index ad8219e..f507a2b 100644
45--- a/main/cmdline/CMakeLists.txt
46+++ b/main/cmdline/CMakeLists.txt
47@@ -54,7 +54,7 @@ if(NOT USE_LOCAL_CLI11)
48 set(CLI11_LIBRARIES CLI11::CLI11)
49 set(CLI11_INCLUDE_DIRS)
50 else()
51- find_package(CLI11 CONFIG QUIT)
52+ find_package(CLI11 CONFIG QUIET)
53 endif()
54
55
56--
572.51.0
58
diff --git a/gnu/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch b/gnu/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch
new file mode 100644
index 00000000000..9b0501e65c8
--- /dev/null
+++ b/gnu/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch
@@ -0,0 +1,16 @@
1diff --git a/plugins/tb/transferbench/CMakeLists.txt b/plugins/tb/transferbench/CMakeLists.txt
2index 98e4bc4..8e4588e 100644
3--- a/plugins/tb/transferbench/CMakeLists.txt
4+++ b/plugins/tb/transferbench/CMakeLists.txt
5@@ -153,7 +153,7 @@ endif()
6
7 ## Check for hsa support
8 find_library(HSA_LIBRARY hsa-runtime64 PATHS ${ROCM_PATH} ${ROCM_PATH}/lib)
9-find_path(HSA_INCLUDE_DIR hsa.h PATHS ${ROCM_PATH}/include ${ROCM_PATH}/include/hsa)
10+find_path(HSA_INCLUDE_DIR has/hsa.h PATHS ${ROCM_PATH}/include ${ROCM_PATH}/include/hsa)
11 if(HSA_LIBRARY AND HSA_INCLUDE_DIR)
12 add_library(hsa-runtime64 SHARED IMPORTED)
13 set_target_properties(hsa-runtime64 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${HSA_INCLUDE_DIR}" IMPORTED_LOCATION "${HSA_LIBRARY}" INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HSA_INCLUDE_DIR}")
14--
152.51.0
16
diff --git a/gnu/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch b/gnu/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch
new file mode 100644
index 00000000000..7fc1bb96af5
--- /dev/null
+++ b/gnu/packages/patches/rocm-bandwidth-test-take-default-gpus-from-environment.patch
@@ -0,0 +1,29 @@
1diff --git a/plugins/tb/transferbench/CMakeLists.txt b/plugins/tb/transferbench/CMakeLists.txt
2index 8e4588e..1d0e12f 100644
3--- a/plugins/tb/transferbench/CMakeLists.txt
4+++ b/plugins/tb/transferbench/CMakeLists.txt
5@@ -61,20 +61,7 @@ option(ENABLE_NIC_EXEC "Enable RDMA NIC Executor in TransferBench"
6
7 # Default GPU architectures to build
8 #==================================================================================================
9-set(DEFAULT_GPUS
10- gfx906
11- gfx908
12- gfx90a
13- gfx942
14- gfx950
15- gfx1030
16- gfx1100
17- gfx1101
18- gfx1102
19- gfx1150
20- gfx1151
21- gfx1200
22- gfx1201)
23+set(DEFAULT_GPUS ENV{AMDGPU_TARGETS})
24
25 # Build only for local GPU architecture
26 if (BUILD_LOCAL_GPU_TARGET_ONLY)
27--
282.51.0
29
diff --git a/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch b/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch
index da96b3ade86..3c80b024b11 100644
--- a/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch
+++ b/gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch
@@ -2,8 +2,8 @@ Do not build and install clinfo.
2 2
3diff --git a/opencl/CMakeLists.txt b/opencl/CMakeLists.txt 3diff --git a/opencl/CMakeLists.txt b/opencl/CMakeLists.txt
4index 7b97cfdef..23eec15b2 100644 4index 7b97cfdef..23eec15b2 100644
5--- a/opencl/CMakeLists.txt 5--- a/projects/clr/opencl/CMakeLists.txt
6+++ b/opencl/CMakeLists.txt 6+++ b/projects/clr/opencl/CMakeLists.txt
7@@ -33,7 +33,7 @@ if(BUILD_ICD) 7@@ -33,7 +33,7 @@ if(BUILD_ICD)
8 add_subdirectory(khronos/icd) 8 add_subdirectory(khronos/icd)
9 endif() 9 endif()
@@ -15,8 +15,8 @@ index 7b97cfdef..23eec15b2 100644
15 add_subdirectory(tests/ocltst) 15 add_subdirectory(tests/ocltst)
16diff --git a/opencl/packaging/CMakeLists.txt b/opencl/packaging/CMakeLists.txt 16diff --git a/opencl/packaging/CMakeLists.txt b/opencl/packaging/CMakeLists.txt
17index 7d9e6366f..f8d08e0fc 100644 17index 7d9e6366f..f8d08e0fc 100644
18--- a/opencl/packaging/CMakeLists.txt 18--- a/projects/clr/opencl/packaging/CMakeLists.txt
19+++ b/opencl/packaging/CMakeLists.txt 19+++ b/projects/clr/opencl/packaging/CMakeLists.txt
20@@ -16,7 +16,7 @@ endif() 20@@ -16,7 +16,7 @@ endif()
21 set(CPACK_DEB_COMPONENT_INSTALL ON) 21 set(CPACK_DEB_COMPONENT_INSTALL ON)
22 set(CPACK_RPM_COMPONENT_INSTALL ON) 22 set(CPACK_RPM_COMPONENT_INSTALL ON)
diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm
index 3adb1e381d1..6d168ce04d9 100644
--- a/gnu/packages/rocm.scm
+++ b/gnu/packages/rocm.scm
@@ -1,6 +1,7 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net> 2;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
3;;; Copyright © 2022, 2023, 2025 John Kehayias <john.kehayias@protonmail.com> 3;;; Copyright © 2022, 2023, 2025 John Kehayias <john.kehayias@protonmail.com>
4;;; Copyright © 2026 Jean-Baptiste Note <jean-baptiste.note@m4x.org>
4;;; 5;;;
5;;; This program is free software; you can redistribute it and/or modify it 6;;; This program is free software; you can redistribute it and/or modify it
6;;; under the terms of the GNU General Public License as published by 7;;; under the terms of the GNU General Public License as published by
@@ -24,178 +25,65 @@
24 #:use-module (guix git-download) 25 #:use-module (guix git-download)
25 #:use-module (guix build-system cmake) 26 #:use-module (guix build-system cmake)
26 #:use-module (gnu packages) 27 #:use-module (gnu packages)
28 #:use-module (gnu packages boost)
29 #:use-module (gnu packages check)
30 #:use-module (gnu packages cpp)
31 #:use-module (gnu packages curl)
27 #:use-module (gnu packages elf) 32 #:use-module (gnu packages elf)
28 #:use-module (gnu packages gcc) 33 #:use-module (gnu packages gcc)
29 #:use-module (gnu packages gl) 34 #:use-module (gnu packages gl)
30 #:use-module (gnu packages linux) 35 #:use-module (gnu packages linux)
31 #:use-module (gnu packages llvm) 36 #:use-module (gnu packages llvm)
37 #:use-module (gnu packages logging)
32 #:use-module (gnu packages opencl) 38 #:use-module (gnu packages opencl)
33 #:use-module (gnu packages pkg-config) 39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages pretty-print)
34 #:use-module (gnu packages python) 41 #:use-module (gnu packages python)
35 #:use-module (gnu packages version-control) 42 #:use-module (gnu packages version-control)
36 #:use-module (gnu packages vim) 43 #:use-module (gnu packages vim)
37 #:use-module (gnu packages xdisorg)) 44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages xdisorg)
46 #:use-module (gnu packages libffi)
47 #:use-module (ice-9 match))
38 48
39;; The components are tightly integrated and can only be upgraded as a unit. If 49;; The components are tightly integrated and can only be upgraded as a unit. If
40;; you want to upgrade ROCm, bump this version number and update hashes below. 50;; you want to upgrade ROCm, bump this version number and update hashes below.
41(define %rocm-version "6.4.2")
42 51
43;; As of version 6.1.0 several of the ROCm projects are contained within their 52(define %rocm-version "7.1.0")
44;; forked LLVM repository. This is the same as the source for llvm-for-rocm. 53
45(define %rocm-llvm-origin 54;; ROCm-systems derived packages belong here.
55
56(define %rocm-systems-url "https://github.com/ROCm/rocm-systems")
57(define %rocm-systems-origin
46 (origin 58 (origin
47 (method git-fetch) 59 (method git-fetch)
48 (uri (git-reference 60 (uri (git-reference
49 (url "https://github.com/ROCm/llvm-project/") 61 (url (string-append %rocm-systems-url))
50 (commit (string-append "rocm-" %rocm-version)))) 62 (commit (string-append "rocm-" %rocm-version))))
51 (file-name (git-file-name "llvm-for-rocm" %rocm-version)) 63 (file-name (git-file-name "rocm-systems" %rocm-version))
52 (sha256 64 (sha256
53 (base32 65 (base32
54 "1j2cr362k7snsh5c1z38ikyihmjvy0088rj0f0dhng6cjwgysryp")))) 66 "16h88j5440csz69s7gpcbmiwn72bz4zjlkdm2c7wcyp73m2knnm2"))
55 67 (patches
56(define-public rocm-cmake 68 (search-patches
57 (package 69 "rocclr-5.6.0-enable-gfx800.patch"
58 (name "rocm-cmake") 70 "rocm-opencl-runtime-4.3-noclinfo.patch"))))
59 (version %rocm-version)
60 (source (origin
61 (method git-fetch)
62 (uri (git-reference
63 (url "https://github.com/ROCm/rocm-cmake/")
64 (commit (string-append "rocm-" version))))
65 (file-name (git-file-name name version))
66 (sha256
67 (base32
68 "1af9z59bm8pj577x43q614v3ff039wijvcdpgw6sdsq1c0ssj260"))))
69 (build-system cmake-build-system)
70 (arguments `(#:tests? #f)) ; Tests try to use git commit
71 (native-inputs (list git))
72 (home-page "https://rocm.docs.amd.com/projects/ROCmCMakeBuildTools/")
73 (synopsis "ROCm cmake modules")
74 (description "ROCm cmake modules provides cmake modules for common build
75tasks needed for the ROCM software stack.")
76 (license license:ncsa)))
77
78(define-public rocm-device-libs
79 (package
80 (name "rocm-device-libs")
81 (version %rocm-version)
82 (source %rocm-llvm-origin)
83 (build-system cmake-build-system)
84 (arguments
85 (list
86 #:tests? #f ; Not sure how to run them.
87 #:build-type "Release"
88 #:configure-flags
89 #~(list "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
90 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE")
91 #:phases
92 #~(modify-phases %standard-phases
93 (add-after 'unpack 'chdir
94 (lambda _
95 (chdir "amd/device-libs"))))))
96 (inputs (list llvm-for-rocm))
97 (home-page "https://github.com/ROCm/llvm-project/")
98 (synopsis "ROCm Device libraries")
99 (description "AMD-specific device-side language runtime libraries, namely
100oclc, ocml, ockl, opencl, hip and hc.")
101 (license license:ncsa)))
102
103(define-public rocm-hip-cpu
104 ;; There are no releases or tags.
105 (let ((commit "e112c935057434897bb12d9ab3910380a8bd5f58")
106 (release "0"))
107 (package
108 (name "rocm-hip-cpu")
109 (version "0.1.4142") ;from CMakeLists.txt
110 (source
111 (origin
112 (method git-fetch)
113 (uri (git-reference
114 (url "https://github.com/ROCm/HIP-CPU/")
115 (commit commit)))
116 (file-name (git-file-name name version))
117 (sha256
118 (base32
119 "1rbih56kfry7scvww54dwx8ph11ddzc5bf4ww1vs1vmhi3r05gpa"))))
120 (build-system cmake-build-system)
121 (arguments
122 (list
123 #:configure-flags #~(list "-DBUILD_EXAMPLES=ON")))
124 (home-page "https://github.com/ROCm/HIP-CPU/")
125 (synopsis "An implementation of HIP that works on CPUs")
126 (description "The HIP CPU Runtime is a header-only library that allows
127CPUs to execute unmodified HIP code. It is generic and does not assume a
128particular CPU vendor or architecture.")
129 (license license:expat))))
130
131(define-public rocm-comgr
132 (package
133 (name "rocm-comgr")
134 (version %rocm-version)
135 (source %rocm-llvm-origin)
136 (build-system cmake-build-system)
137 (arguments
138 (list
139 #:build-type "Release"
140 #:phases
141 #~(modify-phases %standard-phases
142 (add-after 'unpack 'prepare-to-build
143 (lambda _
144 (chdir "amd/comgr")
145 (setenv "ROCM_PATH"
146 #$(this-package-input "rocm-device-libs")))))))
147 (inputs (list rocm-device-libs))
148 (native-inputs (list llvm-for-rocm python))
149 (home-page "https://github.com/ROCm/ROCm-CompilerSupport")
150 (synopsis "ROCm Code Object Manager")
151 (description "The Comgr library provides APIs for compiling and inspecting
152AMDGPU code objects.")
153 (license license:ncsa)))
154
155;; This package is deprecated; this is the last version released.
156(define-public roct-thunk-interface
157 (package
158 (name "roct-thunk-interface")
159 (version "6.2.4")
160 (source (origin
161 (method git-fetch)
162 (uri (git-reference
163 (url "https://github.com/ROCm/ROCT-Thunk-Interface.git")
164 (commit (string-append "rocm-" version))))
165 (file-name (git-file-name name version))
166 (sha256
167 (base32
168 "1y3mn4860z7ca71cv4hhag7racpc208acy8rws8ldw5k8yjc68m0"))))
169 (build-system cmake-build-system)
170 (arguments `(#:tests? #f)) ; Not sure how to run tests.
171 (inputs (list libdrm numactl))
172 (native-inputs (list `(,gcc "lib") pkg-config))
173 (home-page "https://github.com/ROCm/ROCT-Thunk-Interface")
174 (synopsis "Radeon Open Compute Thunk Interface")
175 (description "User-mode API interfaces used to interact with the ROCk
176driver.")
177 (license (list license:expat license:ncsa))))
178 71
179(define-public rocr-runtime 72(define-public rocr-runtime
180 (package 73 (package
181 (name "rocr-runtime") 74 (name "rocr-runtime")
182 (version %rocm-version) 75 (version %rocm-version)
183 (source (origin 76 (source %rocm-systems-origin)
184 (method git-fetch)
185 (uri (git-reference
186 (url "https://github.com/ROCm/ROCR-Runtime.git")
187 (commit (string-append "rocm-" version))))
188 (file-name (git-file-name name version))
189 (sha256
190 (base32
191 "01gqbzqm5m28dw9b2calrbp9a23w2cc2gwi3pay8yl8qvk4jgkff"))))
192 (build-system cmake-build-system) 77 (build-system cmake-build-system)
193 (arguments 78 (arguments
194 (list 79 (list
195 #:tests? #f ; No tests. 80 #:tests? #f ; No tests.
196 #:build-type "Release" 81 #:build-type "Release"
197 #:phases 82 #:phases
198 #~(modify-phases %standard-phases 83 #~(modify-phases %standard-phases
84 (add-after 'unpack 'chdir
85 (lambda _
86 (chdir "projects/rocr-runtime")))
199 (add-after 'unpack 'add-rocm-device-lib-path 87 (add-after 'unpack 'add-rocm-device-lib-path
200 (lambda _ 88 (lambda _
201 (setenv "ROCM_PATH" 89 (setenv "ROCM_PATH"
@@ -203,12 +91,12 @@ driver.")
203 (inputs 91 (inputs
204 (list libdrm 92 (list libdrm
205 libelf-shared 93 libelf-shared
206 llvm-for-rocm 94 clang-rocm
95 lld-rocm
207 numactl 96 numactl
208 rocm-device-libs ; For bitcode. 97 rocm-device-libs)) ; For bitcode.
209 roct-thunk-interface))
210 (native-inputs (list pkg-config xxd)) 98 (native-inputs (list pkg-config xxd))
211 (home-page "https://github.com/ROCm/ROCR-Runtime") 99 (home-page %rocm-systems-url)
212 (synopsis "ROCm Platform Runtime") 100 (synopsis "ROCm Platform Runtime")
213 (description "User-mode API interfaces and libraries necessary for host 101 (description "User-mode API interfaces and libraries necessary for host
214applications to launch compute kernels to available HSA ROCm kernel agents.") 102applications to launch compute kernels to available HSA ROCm kernel agents.")
@@ -218,25 +106,12 @@ applications to launch compute kernels to available HSA ROCm kernel agents.")
218 (package 106 (package
219 (name "rocm-opencl-runtime") 107 (name "rocm-opencl-runtime")
220 (version %rocm-version) 108 (version %rocm-version)
221 (home-page "https://github.com/ROCm/clr") 109 (home-page %rocm-systems-url)
222 (source (origin 110 (source %rocm-systems-origin)
223 (method git-fetch)
224 (uri (git-reference
225 (url home-page)
226 (commit (string-append "rocm-" version))))
227 (file-name (git-file-name name version))
228 (sha256
229 (base32
230 "00zr1fw84nifn2b2zd4wxf00f1171hjmz1lypzzmydsk5yw01q0c"))
231 (patches
232 (search-patches
233 "rocclr-5.6.0-enable-gfx800.patch"
234 ;; Guix includes a program clinfo already.
235 "rocm-opencl-runtime-4.3-noclinfo.patch"))))
236 (build-system cmake-build-system) 111 (build-system cmake-build-system)
237 (arguments 112 (arguments
238 (list 113 (list
239 #:tests? #f ; Not sure how to run them. 114 #:tests? #f ; Not sure how to run them.
240 #:build-type "Release" 115 #:build-type "Release"
241 #:configure-flags 116 #:configure-flags
242 #~(list 117 #~(list
@@ -250,11 +125,13 @@ applications to launch compute kernels to available HSA ROCm kernel agents.")
250 "-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF") 125 "-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF")
251 #:phases 126 #:phases
252 #~(modify-phases %standard-phases 127 #~(modify-phases %standard-phases
253 (add-after 'unpack 'no-os-release 128 (add-after 'unpack 'chdir
129 (lambda _
130 (chdir "projects/clr")))
131 (add-after 'chdir 'no-os-release
254 (lambda _ 132 (lambda _
255 (substitute* "opencl/packaging/CMakeLists.txt" 133 (substitute* "opencl/packaging/CMakeLists.txt"
256 (("\"/etc/os-release\"") 134 (("/etc/os-release") "/dev/null"))))
257 "\"/dev/null\""))))
258 (add-after 'install 'create-icd 135 (add-after 'install 'create-icd
259 ;; Manually install ICD, which simply consists of dumping 136 ;; Manually install ICD, which simply consists of dumping
260 ;; the path of the .so into the correct file. 137 ;; the path of the .so into the correct file.
@@ -270,6 +147,7 @@ applications to launch compute kernels to available HSA ROCm kernel agents.")
270 numactl 147 numactl
271 opencl-headers 148 opencl-headers
272 opencl-icd-loader 149 opencl-icd-loader
150 libffi
273 rocm-comgr 151 rocm-comgr
274 rocr-runtime)) 152 rocr-runtime))
275 (synopsis "ROCm OpenCL Runtime") 153 (synopsis "ROCm OpenCL Runtime")
@@ -277,39 +155,178 @@ applications to launch compute kernels to available HSA ROCm kernel agents.")
277and in-process/in-memory compilation.") 155and in-process/in-memory compilation.")
278 (license license:expat))) 156 (license license:expat)))
279 157
158;; this runtime includes the hipcc and hip-config present in rocm-hipcc
159;; wrapping them in rocm-hipcc allows the copies that are made here to be
160;; wrapped also.
161(define-public rocm-hip-runtime
162 (package
163 (name "rocm-hip-runtime")
164 (version %rocm-version)
165 (home-page %rocm-systems-url)
166 (source %rocm-systems-origin)
167 (build-system cmake-build-system)
168 (arguments
169 (list
170 #:tests? #f ; Not sure how to run them.
171 #:build-type "Release"
172 #:configure-flags
173 #~(list
174 (string-append "-DAMD_OPENCL_PATH=" #$(package-source this-package))
175 "-DCLR_BUILD_HIP=ON"
176 "-DCLR_BUILD_OCL=OFF"
177 (string-append "-DROCM_PATH=" #$output)
178 "-DHIP_PLATFORM=amd"
179 (string-append
180 "-DHIPCC_BIN_DIR=" #$(this-package-native-input "rocm-hipcc") "/bin")
181 (string-append
182 "-DHIP_COMMON_DIR=" #$(package-source this-package) "/projects/hip")
183 ;; for now
184 "-DUSE_PROF_API=OFF"
185 "-DHIP_ENABLE_ROCPROFILER_REGISTER=OFF")
186 #:phases
187 #~(modify-phases %standard-phases
188 (add-after 'unpack 'chdir
189 (lambda _
190 (chdir "projects/clr")))
191 (add-after 'chdir 'no-os-release
192 (lambda _
193 (substitute* '("hipamd/packaging/CMakeLists.txt"
194 "hipamd/CMakeLists.txt")
195 (("/etc/os-release") "/dev/null"))))
196 (add-after 'chdir 'less-cmake-warnings
197 (lambda _
198 (substitute* "rocclr/cmake/ROCclrLC.cmake"
199 (("2\\.9") "3.0"))))
200 (add-after 'chdir 'fix-clang-location-for-embed-pch
201 (lambda _
202 (substitute* "hipamd/src/CMakeLists.txt"
203 ;; differentiate between CLANG and LLVM packages
204 (("\\$\\{HIP_LLVM_ROOT\\}")
205 (string-append "${HIP_LLVM_ROOT} "
206 #$(this-package-input "clang-rocm"))))
207 (substitute* "hipamd/src/hip_embed_pch.sh"
208 (("\\$5") "$6")
209 (("LLVM_DIR=\"\\$4\"")
210 "LLVM_DIR=\"$4\"; CLANG_DIR=\"$5\";")
211 (("\\$LLVM_DIR/bin/clang")
212 (string-append "$CLANG_DIR/bin/clang"))))))))
213 (inputs
214 (list glew
215 mesa
216 numactl
217 perl
218 opencl-headers
219 rocm-comgr
220 rocr-runtime
221 rocm-device-libs
222 libffi
223 clang-rocm))
224 (native-inputs
225 (list rocm-hipcc))
226 (synopsis "ROCm HIP Runtime")
227 (description "HIP language runtime, allowing execution of HIP kernels
228on AMD harware, with library support for in-process/in-memory
229compilation (hipclr) of HIP kernel code, and its execution on AMD hardware.")
230 (license license:expat)))
231
280(define-public rocminfo 232(define-public rocminfo
281 (package 233 (package
282 (name "rocminfo") 234 (name "rocminfo")
283 (version %rocm-version) 235 (version %rocm-version)
284 (source (origin 236 (source %rocm-systems-origin)
285 (method git-fetch)
286 (uri (git-reference
287 (url "https://github.com/ROCm/rocminfo.git")
288 (commit (string-append "rocm-" version))))
289 (file-name (git-file-name name version))
290 (sha256
291 (base32
292 "15mzmxz011sg42jg0dbxz57f4fagmxzdjc6zhd0yab3cq7k1kiv2"))))
293 (build-system cmake-build-system) 237 (build-system cmake-build-system)
294 (arguments 238 (arguments
295 (list 239 (list
296 #:tests? #f ; No tests. 240 #:tests? #f ; No tests.
297 #:phases 241 #:phases
298 #~(modify-phases %standard-phases 242 #~(modify-phases %standard-phases
299 (add-after 'unpack 'patch-binary-paths 243 (add-after 'unpack 'chdir
244 (lambda _
245 (chdir "projects/rocminfo")))
246 (add-after 'chdir 'patch-binary-paths
300 (lambda* (#:key inputs #:allow-other-keys) 247 (lambda* (#:key inputs #:allow-other-keys)
301 (substitute* "rocminfo.cc" 248 (substitute* "rocminfo.cc"
302 (("lsmod") 249 (("lsmod")
303 (search-input-file inputs "bin/lsmod")) 250 (search-input-file inputs "bin/lsmod"))
304 (("grep") (search-input-file inputs "bin/grep")))))))) 251 (("grep")
252 (search-input-file inputs "bin/grep"))))))))
305 (inputs 253 (inputs
306 (list rocr-runtime kmod)) 254 (list rocr-runtime kmod python))
307 (home-page "https://github.com/ROCm/rocminfo") 255 (home-page %rocm-systems-url)
308 (synopsis "ROCm Application for Reporting System Info") 256 (synopsis "ROCm Application for Reporting System Info")
309 (description "List @acronym{HSA,Heterogeneous System Architecture} Agents 257 (description "List @acronym{HSA,Heterogeneous System Architecture} Agents
310available to ROCm and show their properties.") 258available to ROCm and show their properties.")
311 (license license:ncsa))) 259 (license license:ncsa)))
312 260
261
262
263;; ROCm base helpers.
264
265(define-public rocm-cmake
266 (package
267 (name "rocm-cmake")
268 (version %rocm-version)
269 (source (origin
270 (method git-fetch)
271 (uri (git-reference
272 (url "https://github.com/ROCm/rocm-cmake/")
273 (commit (string-append "rocm-" version))))
274 (file-name (git-file-name name version))
275 (sha256
276 (base32
277 "19jyymisxiikphzmq6h8vy5cg0r5dz3lxr5wvdf44frb8wxr8vla"))))
278 (build-system cmake-build-system)
279 (arguments `(#:tests? #f)) ; Tests try to use git commit
280 (native-inputs (list git))
281 (home-page "https://rocm.docs.amd.com/projects/ROCmCMakeBuildTools/")
282 (synopsis "ROCm cmake modules")
283 (description "ROCm cmake modules provides cmake modules for common build
284tasks needed for the ROCM software stack.")
285 (license license:ncsa)))
286
287(define-public rocm-hip-cpu
288 ;; There are no releases or tags.
289 (let ((commit "e112c935057434897bb12d9ab3910380a8bd5f58")
290 (release "0"))
291 (package
292 (name "rocm-hip-cpu")
293 (version "0.1.4142") ;from CMakeLists.txt
294 (source
295 (origin
296 (method git-fetch)
297 (uri (git-reference
298 (url "https://github.com/ROCm/HIP-CPU/")
299 (commit commit)))
300 (file-name (git-file-name name version))
301 (sha256
302 (base32
303 "1rbih56kfry7scvww54dwx8ph11ddzc5bf4ww1vs1vmhi3r05gpa"))))
304 (build-system cmake-build-system)
305 (arguments
306 (list
307 #:configure-flags #~(list "-DBUILD_EXAMPLES=ON")))
308 (home-page "https://github.com/ROCm/HIP-CPU/")
309 (synopsis "Implementation of HIP that works on CPUs")
310 (description "The HIP CPU Runtime is a header-only library that allows
311CPUs to execute unmodified HIP code. It is generic and does not assume a
312particular CPU vendor or architecture.")
313 (license license:expat))))
314
315(define %default-amdgpu-targets
316 '("gfx908" "gfx90a" "gfx942" "gfx1030" "gfx1100" "gfx1101" "gfx1200" "gfx1201"))
317
318;; I guess the intent would be to have this overridable with a package
319;; transform akin to --with-property=amdgpu-target="gfx1100;gfx1101"
320(define %default-amdgpu-targets-property
321 `(amdgpu-targets
322 .
323 ,(string-join %default-amdgpu-targets ";")))
324
325(define-syntax-rule (%amdgpu-targets)
326 (string-split
327 (assoc-ref (package-properties this-package) 'amdgpu-targets)
328 #\;))
329
313(define-public rocm-bandwidth-test 330(define-public rocm-bandwidth-test
314 (package 331 (package
315 (name "rocm-bandwidth-test") 332 (name "rocm-bandwidth-test")
@@ -317,15 +334,120 @@ available to ROCm and show their properties.")
317 (source (origin 334 (source (origin
318 (method git-fetch) 335 (method git-fetch)
319 (uri (git-reference 336 (uri (git-reference
320 (url "https://github.com/ROCm/rocm_bandwidth_test.git") 337 (url "https://github.com/ROCm/rocm_bandwidth_test")
321 (commit (string-append "rocm-" version)))) 338 (commit (string-append "rocm-" version))))
322 (file-name (git-file-name name version)) 339 (file-name (git-file-name name version))
323 (sha256 340 (sha256
324 (base32 341 (base32
325 "1afmyx0dkif7djdcm5rfhnsibbrkj4py6dvh0gw4x3v750ms69wv")))) 342 "09ssn8lkjaypq8qy3v28z25qvxsyha4cv4dk6xmfxmgfy8252yqy"))
343 (patches
344 (search-patches
345 "rocm-bandwidth-test-take-default-gpus-from-environment.patch"
346 "rocm-bandwidth-test-fix-hsa-include-file-lookup.patch"
347 "rocm-bandwidth-test-fix-external-packages-search.patch"))))
326 (build-system cmake-build-system) 348 (build-system cmake-build-system)
327 (arguments `(#:tests? #f)) ; No tests. 349 (arguments
328 (inputs (list rocr-runtime)) 350 (list
351 #:tests? #f
352 #:build-type "Release"
353 #:configure-flags
354 #~(list
355 "-DAMD_APP_TREAT_WARNINGS_AS_ERRORS=FALSE"
356 "-DAMD_APP_ROCM_BUILD_PACKAGE=ON"
357 ;; The rocm build system is very opiniated about the rpath and
358 ;; mangles it beyond recognition, stripping all inputs from it.
359 ;; Avoid the breakage.
360 "-DAMD_APP_ROCM_BUILD_TRY_RPATH=OFF"
361 ;; Allows the plugin files to be correctly rpathed to $#output/lib
362 ;; where shared libraries reside.
363 "-DAMD_WORK_BENCH_PLUGIN_ADD_INSTALL_PREFIX_TO_RPATH=TRUE"
364 ;; Unfortunately this also needs to be patched everywhere, as the
365 ;; value is individually set to OFF for a lot of targets, and not
366 ;; propagated from the top. So set it here, and use substitutions
367 ;; below.
368 "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
369 (string-append "-DROCM_PATH=" #$output)
370 "-DUSE_LOCAL_FMT_LIB=ON"
371 "-DUSE_LOCAL_NLOHMANN_JSON=ON"
372 "-DUSE_LOCAL_SPDLOG=ON"
373 "-DUSE_LOCAL_BOOST=ON"
374 "-DUSE_LOCAL_CLI11=ON"
375 "-DUSE_LOCAL_CATCH2=ON")
376 #:phases
377 #~(modify-phases %standard-phases
378 (add-after 'unpack 'patch-out-bogus-git-requirement
379 (lambda _
380 (substitute* "CMakeLists.txt"
381 (("find_package\\(Git QUIET\\)")
382 "set(GIT_FOUND ON)"))))
383 ;; This converts the amdgpu-targets property to its proper entry
384 ;; point in this package; this relies on the patch
385 ;; rocm-bandwidth-test-take-default-gpus-from-environment.patch
386 ;; above, as I can't seem to find a way to do multiline matches.
387 ;; Note that compiling for all GPUs architectures is sequential, and
388 ;; will run for a very long time.
389 (add-after 'unpack 'inject-amdgpu-targets
390 (lambda _
391 (substitute* "plugins/tb/transferbench/CMakeLists.txt"
392 (("set\\(DEFAULT_GPUS[^)]*\\)")
393 (string-append
394 "set(DEFAULT_GPUS " #$(string-join (%amdgpu-targets)) ")" )))))
395 ;; See configure-flags above.
396 (add-after 'unpack 'fix-use-link-path
397 (lambda _
398 (substitute* (find-files "." "CMakeLists\\.txt$|\\.cmake$")
399 ;; NB: this will also catch instances of
400 ;; CMAKE_INSTALL_RPATH_USE_LINK_PATH
401 (("INSTALL_RPATH_USE_LINK_PATH FALSE")
402 "INSTALL_RPATH_USE_LINK_PATH TRUE"))))
403 ;; For the same reason, just in case patchelf ends up in the inputs
404 ;; (the build system may require it), we remove a hardcoded rpath in
405 ;; a bash build script which triggers if patchelf is detected.
406 (add-after 'unpack 'remove-hardcoded-patchelf
407 (lambda _
408 (substitute* "plugins/tb/transferbench/build_libamd_tb.sh"
409 (("command -v patchelf") "false"))))
410 ;; XXX The build system uses -fuse-ld=lld flag for c++ linking if it
411 ;; finds ld.lld in any way. Unfortunately, for some reason, ld.lld
412 ;; does not correctly setup the rpath when compiling the
413 ;; rocm_bandwidth_test binary (the only executable which shows the
414 ;; problem). We do need ld.lld from lld-rocm in the path for
415 ;; ROCm-specific linking however. Therefore, just disable ld.lld
416 ;; lookup for standard binaries.
417 ;; I guess there's a standard Guix way to have lld behave for rpath
418 ;; -- which should be applied to lld-rocm, probably.
419 (add-after 'unpack 'dont-use-lld-for-executables
420 (lambda _
421 (substitute* "cmake/build_utils.cmake"
422 (("find_program\\(LD_LLD_PATH ld\\.lld\\)")
423 "#find_program(LD_LLD_PATH ld.lld)"))))
424 ;; This is just cosmetic and removes superfluous rpath entries
425 ;; involving a nonexistant relative llvm/lib path.
426 ;; XXX: RUNPATH checks are okay with $ORIGIN, but it looks like
427 ;; other packages are removing it altogether -- what to do?
428 (add-after 'unpack 'remove-dubious-rpath
429 (lambda _
430 (substitute* (find-files "." "CMakeLists\\.txt$|\\.cmake$")
431 ((":\\\\\\$ORIGIN(/\\.\\./lib)?/llvm/lib") "")))))))
432 (inputs (list rocr-runtime
433 rocm-hip-runtime
434 rocm-cmake
435 rocm-device-libs
436 rocm-comgr
437 numactl
438 curl
439 fmt-11
440 nlohmann-json
441 spdlog-1.15
442 boost
443 cli11
444 catch2-3.8))
445 (properties
446 (list %default-amdgpu-targets-property))
447 (native-inputs (list
448 rocm-hipcc
449 clang-rocm
450 lld-rocm))
329 (home-page "https://github.com/ROCm/rocm_bandwidth_test") 451 (home-page "https://github.com/ROCm/rocm_bandwidth_test")
330 (synopsis "Bandwidth test for ROCm") 452 (synopsis "Bandwidth test for ROCm")
331 (description "RocBandwidthTest is designed to capture the performance 453 (description "RocBandwidthTest is designed to capture the performance
@@ -335,7 +457,6 @@ cop/read/writer operations. In addition one can also query the topology of
335the system in terms of memory pools and their agents.") 457the system in terms of memory pools and their agents.")
336 (license license:expat))) 458 (license license:expat)))
337 459
338
339;; e-smi looks hard to unbundle correctly from amd-smi 460;; e-smi looks hard to unbundle correctly from amd-smi
340;; the required esmi version is hardcoded in CMakeLists.txt 461;; the required esmi version is hardcoded in CMakeLists.txt
341(define (make-esmi-source version hash) 462(define (make-esmi-source version hash)