guix-epistemia

Personal Guix channel
Log | Files | Refs

commit 1f0f3e224a6c0901ec70be685c1e79f11ff99156
parent c5dc7e166558e423af51273e99bded5ea5ab5329
Author: Vineet Kumar <git@vineetk.net>
Date:   Sat, 14 Nov 2026 22:24:44 +0100

packages/machine-learning: move ggml-rocm to top of file

Diffstat:
Mepistemia/packages/machine-learning.scm | 120++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/epistemia/packages/machine-learning.scm b/epistemia/packages/machine-learning.scm @@ -21,6 +21,66 @@ #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz)) +(define-public ggml-rocm + (package + (inherit ggml) + (name "ggml-rocm") + (version "1.0.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ggml-org/ggml") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "08g9vy934dawskkjw3cbgznz191lwy49hzpphyy9yg39adbm48ai")))) + (arguments + (substitute-keyword-arguments (package-arguments (@@ (gnu packages machine-learning) ggml)) + ((#:configure-flags flags #~'()) + #~(append #$flags (list (string-append "-DCMAKE_HIP_COMPILER_ROCM_ROOT=" #$rocm-hip-runtime) + (string-append "-DCMAKE_HIP_FLAGS=--rocm-path=" #$rocm-hip-runtime + " --rocm-device-lib-path=" #$rocm-device-libs "/amdgcn/bitcode") + #$(string-append "-DGPU_TARGETS=" (current-amd-gpu-targets-string)) + "-DGGML_CPU=ON" + "-DGGML_OPENCL=OFF" + "-DGGML_VULKAN=ON" + "-DGGML_HIP=ON" + "-DGGML_HIP_ROCWMMA_FATTN=ON" + "-DGGML_HIP_GRAPHS=ON" + "-DGGML_HIP_RCCL=ON" + "-DGGML_CUDA_FA_ALL_QUANTS=ON" + ;; for stable-diffusion.cpp + "-DGGML_CPU_ALL_VARIANTS=ON"))) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + ;; for stable-diffusion.cpp + (add-before 'configure 'set-ggml-max-name + (lambda _ + (setenv "CFLAGS" "-DGGML_MAX_NAME=160") + (setenv "CXXFLAGS" "-DGGML_MAX_NAME=160"))) + ;; for stable-diffusion.cpp's upstream-ggml compatibility layer, which needs this private function + (add-before 'configure 'export-ggml-graph-view + (lambda _ + (substitute* "src/ggml-impl.h" + (("^struct ggml_cgraph ggml_graph_view" all) + (string-append "GGML_API " all))))))))) + (inputs + (modify-inputs (package-inputs ggml) + (append clang-rocm + lld-rocm + rocm-cmake + rocm-device-libs + rocm-hipcc + rocm-hip-runtime + rocr-runtime + hipblas + hipblas-common + hipblaslt + rocblas + rccl))) + (properties `((amd-gpu-targets . ,%default-amd-gpu-targets))))) + (define-public llama-cpp-rocm (let ((tag "b12373")) (package @@ -95,66 +155,6 @@ hipblas hipblaslt))))) -(define-public ggml-rocm - (package - (inherit ggml) - (name "ggml-rocm") - (version "1.0.0") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/ggml-org/ggml") - (commit (string-append "v" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 "08g9vy934dawskkjw3cbgznz191lwy49hzpphyy9yg39adbm48ai")))) - (arguments - (substitute-keyword-arguments (package-arguments (@@ (gnu packages machine-learning) ggml)) - ((#:configure-flags flags #~'()) - #~(append #$flags (list (string-append "-DCMAKE_HIP_COMPILER_ROCM_ROOT=" #$rocm-hip-runtime) - (string-append "-DCMAKE_HIP_FLAGS=--rocm-path=" #$rocm-hip-runtime - " --rocm-device-lib-path=" #$rocm-device-libs "/amdgcn/bitcode") - #$(string-append "-DGPU_TARGETS=" (current-amd-gpu-targets-string)) - "-DGGML_CPU=ON" - "-DGGML_OPENCL=OFF" - "-DGGML_VULKAN=ON" - "-DGGML_HIP=ON" - "-DGGML_HIP_ROCWMMA_FATTN=ON" - "-DGGML_HIP_GRAPHS=ON" - "-DGGML_HIP_RCCL=ON" - "-DGGML_CUDA_FA_ALL_QUANTS=ON" - ;; for stable-diffusion.cpp - "-DGGML_CPU_ALL_VARIANTS=ON"))) - ((#:phases phases #~%standard-phases) - #~(modify-phases #$phases - ;; for stable-diffusion.cpp - (add-before 'configure 'set-ggml-max-name - (lambda _ - (setenv "CFLAGS" "-DGGML_MAX_NAME=160") - (setenv "CXXFLAGS" "-DGGML_MAX_NAME=160"))) - ;; for stable-diffusion.cpp's upstream-ggml compatibility layer, which needs this private function - (add-before 'configure 'export-ggml-graph-view - (lambda _ - (substitute* "src/ggml-impl.h" - (("^struct ggml_cgraph ggml_graph_view" all) - (string-append "GGML_API " all))))))))) - (inputs - (modify-inputs (package-inputs ggml) - (append clang-rocm - lld-rocm - rocm-cmake - rocm-device-libs - rocm-hipcc - rocm-hip-runtime - rocr-runtime - hipblas - hipblas-common - hipblaslt - rocblas - rccl))) - (properties `((amd-gpu-targets . ,%default-amd-gpu-targets))))) - (define-public strata-rdna3 (let* ((commit "f557b544") ;; strata is pinned to an older llama.cpp's ggml;