mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
transformations: Add ‘--amd-gpu’ transformation option.
* guix/transformations.scm (split-on-commas): New procedure, moved from…
(transform-package-toolchain): … here.
(package-amd-gpu-specialization, transform-package-amd-gpu-targets): New
procedures.
(%transformations, %options): Add ‘amd-gpu’.
* tests/transformations.scm ("options->transformations, amd-gpu")
("options->transformations, amd-gpu, not applicable")
("options->transformations, amd-gpu, missing clang-rocm input")
("options->transformations, amd-gpu, wrong GPU"): New tests.
* doc/guix.texi (Package Transformation Options): Document it.
Change-Id: I56bf0dffbf12bc08cf6318fe56952473b395c303
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #5583
Signed-off-by: Rutherther <rutherther@ditigal.xyz>
This commit is contained in:
committed by
Rutherther
parent
062f036fec
commit
0c5d65d540
@@ -1,5 +1,5 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2016-2017, 2019-2024 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2016-2017, 2019-2024, 2026 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
@@ -638,6 +638,45 @@
|
||||
(package->bag (t p))
|
||||
#f)))
|
||||
|
||||
(test-equal "options->transformations, amd-gpu"
|
||||
'("gfx90a" "gfx942")
|
||||
(let ((p (dummy-package "amd-gpu-code"
|
||||
(native-inputs
|
||||
(list (@ (gnu packages llvm) clang-rocm)))
|
||||
(properties '((amd-gpu-targets . ("whatever"))))))
|
||||
(t (options->transformation '((amd-gpu . ("gfx90a" "gfx942"))))))
|
||||
(assoc-ref (package-properties (t p)) 'amd-gpu-targets)))
|
||||
|
||||
(test-equal "options->transformations, amd-gpu, not applicable"
|
||||
#f
|
||||
(let ((p (dummy-package "not-amd-gpu-code"))
|
||||
(t (options->transformation '((amd-gpu . ("gfx90a" "gfx942"))))))
|
||||
(assoc-ref (package-properties (t p)) 'amd-gpu-targets)))
|
||||
|
||||
(test-assert "options->transformations, amd-gpu, missing clang-rocm input"
|
||||
(let ((p (dummy-package "amd-gpu-code"
|
||||
(properties '((amd-gpu-targets . ("whatever"))))))
|
||||
(t (options->transformation '((amd-gpu . ("generic"))))))
|
||||
;; Since 'clang-rocm' is not among the inputs, an error should be raised.
|
||||
(guard (c ((formatted-message? c)
|
||||
(string-contains (formatted-message-string c)
|
||||
"no ROCm compiler")))
|
||||
(t p)
|
||||
#f)))
|
||||
|
||||
(test-assert "options->transformations, amd-gpu, wrong GPU"
|
||||
(let ((p (dummy-package "amd-gpu-code"
|
||||
(native-inputs
|
||||
(list (@ (gnu packages llvm) clang-rocm)))
|
||||
(properties '((amd-gpu-targets . ("whatever"))))))
|
||||
(t (options->transformation '((amd-gpu . ("does-not-exist"))))))
|
||||
;; Since this AMD GPU target is not known to 'clang-rocm', an error should
|
||||
;; be raised.
|
||||
(guard (c ((formatted-message? c)
|
||||
(member "does-not-exist" (formatted-message-arguments c))))
|
||||
(t p)
|
||||
#f)))
|
||||
|
||||
(test-equal "options->transformation + package->manifest-entry"
|
||||
'((transformations . ((without-tests . "foo"))))
|
||||
(let* ((p (dummy-package "foo"))
|
||||
|
||||
Reference in New Issue
Block a user