1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 13:10:33 +02:00

Add (guix amd-gpu).

Moving these definitions to a separate module is necessary to avoid circular
references at the top-level among package modules.

* gnu/packages/rocm.scm (%default-amd-gpu-targets, current-amd-gpu-targets)
(current-amd-gpu-targets-string): Move to…
* guix/amd-gpu.scm: … here.  New file.
* Makefile.am (MODULES): Add it.

Merges guix/guix!7251

Change-Id: I60496fb4d81ea0445ec176add7afc388f6790bd3
Signed-off-by: Cayetano Santos <csantosb@inventati.org>
This commit is contained in:
Ludovic Courtès
2026-03-19 12:29:53 +01:00
committed by Cayetano Santos
parent 5591ac7772
commit 34ead56156
3 changed files with 50 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU # GNU Guix --- Functional package management for GNU
# Copyright © 2012-2025 Ludovic Courtès <ludo@gnu.org> # Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2013 Andreas Enge <andreas@enge.fr> # Copyright © 2013 Andreas Enge <andreas@enge.fr>
# Copyright © 2015, 2017 Alex Kost <alezost@gmail.com> # Copyright © 2015, 2017 Alex Kost <alezost@gmail.com>
# Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org> # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
@@ -87,6 +87,7 @@ MODULES = \
guix/base64.scm \ guix/base64.scm \
guix/ci.scm \ guix/ci.scm \
guix/cpio.scm \ guix/cpio.scm \
guix/amd-gpu.scm \
guix/cpu.scm \ guix/cpu.scm \
guix/deprecation.scm \ guix/deprecation.scm \
guix/docker.scm \ guix/docker.scm \

View File

@@ -26,6 +26,7 @@
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix build-system cmake) #:use-module (guix build-system cmake)
#:use-module (guix amd-gpu)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages boost) #:use-module (gnu packages boost)
@@ -53,9 +54,9 @@
#:use-module (gnu packages xorg) #:use-module (gnu packages xorg)
#:use-module (gnu packages libffi) #:use-module (gnu packages libffi)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:export (%default-amd-gpu-targets #:re-export (%default-amd-gpu-targets
current-amd-gpu-targets current-amd-gpu-targets
current-amd-gpu-targets-string)) current-amd-gpu-targets-string))
;; The components are tightly integrated and can only be upgraded as a unit. If ;; The components are tightly integrated and can only be upgraded as a unit. If
;; you want to upgrade ROCm, bump this version number and the version number in ;; you want to upgrade ROCm, bump this version number and the version number in
@@ -328,18 +329,6 @@ CPUs to execute unmodified HIP code. It is generic and does not assume a
particular CPU vendor or architecture.") particular CPU vendor or architecture.")
(license license:expat)))) (license license:expat))))
(define %default-amd-gpu-targets
'("gfx908" "gfx90a" "gfx942" "gfx1030" "gfx1100" "gfx1101" "gfx1200" "gfx1201"))
(define-syntax-rule (current-amd-gpu-targets)
"Return the list of AMD GPU targets for this package, as a list of strings."
(or (assoc-ref (package-properties this-package) 'amd-gpu-targets)
%default-amd-gpu-targets))
(define-syntax-rule (current-amd-gpu-targets-string)
"Return the list of AMD GPU targets for this package, as a string separated by \";\"."
(string-join (current-amd-gpu-targets) ";"))
(define-public rocm-bandwidth-test (define-public rocm-bandwidth-test
(package (package
(name "rocm-bandwidth-test") (name "rocm-bandwidth-test")

44
guix/amd-gpu.scm Normal file
View File

@@ -0,0 +1,44 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2026 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2026 David Elsing <david.elsing@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix amd-gpu)
#:autoload (guix packages) (this-package package-properties)
#:export (%default-amd-gpu-targets
current-amd-gpu-targets
current-amd-gpu-targets-string))
;;; Commentary:
;;;
;;; This module provides helpers for packages targeting AMD GPUs.
;;;
;;; Code:
(define %default-amd-gpu-targets
'("gfx908" "gfx90a" "gfx942" "gfx1030" "gfx1100" "gfx1101" "gfx1200" "gfx1201"))
(define-syntax-rule (current-amd-gpu-targets)
"Return the list of AMD GPU targets for this package, as a list of strings."
(or (assoc-ref (package-properties this-package) 'amd-gpu-targets)
%default-amd-gpu-targets))
(define-syntax-rule (current-amd-gpu-targets-string)
"Return the list of AMD GPU targets for this package, as a string separated
by \";\". This is useful for build options like 'AMDGPU_TARGETS' in many
CMake-based packages."
(string-join (current-amd-gpu-targets) ";"))