[packages/ggml] - fix for CPU HBM build; release 2

qboosh qboosh at pld-linux.org
Fri Nov 20 21:12:53 CET 2026


commit 352b1e81e0c9534cb3ee24d4b2b12f9c6dc22b76
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Nov 20 21:12:52 2026 +0100

    - fix for CPU HBM build; release 2

 ggml-hbm.patch | 40 ++++++++++++++++++++++++++++++++++++++++
 ggml.spec      |  4 +++-
 2 files changed, 43 insertions(+), 1 deletion(-)
---
diff --git a/ggml.spec b/ggml.spec
index 529d39c..0b9348c 100644
--- a/ggml.spec
+++ b/ggml.spec
@@ -24,13 +24,14 @@ Summary:	Tensor library for machine learning
 Summary(pl.UTF-8):	Biblioteka tensorów do uczenia maszynowego
 Name:		ggml
 Version:	1.0.0
-Release:	1
+Release:	2
 License:	MIT
 Group:		Libraries
 #Source0Download: https://github.com/ggml-org/ggml/releases
 Source0:	https://github.com/ggml-org/ggml/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	ab0e755d747581905a5bf14de0535beb
 Patch0:		%{name}-vulkan-32bit.patch
+Patch1:		%{name}-hbm.patch
 URL:		https://github.com/ggml-org/ggml
 %{?with_opencl:BuildRequires:	OpenCL-devel}
 %{?with_vulkan:BuildRequires:	Vulkan-Loader-devel}
@@ -92,6 +93,7 @@ Pliki nagłówkowe biblioteki GGML.
 %prep
 %setup -q
 %patch -P0 -p2
+%patch -P1 -p1
 
 %build
 %cmake -B build \
diff --git a/ggml-hbm.patch b/ggml-hbm.patch
new file mode 100644
index 0000000..7ef3759
--- /dev/null
+++ b/ggml-hbm.patch
@@ -0,0 +1,40 @@
+--- ggml-1.0.0/src/ggml-cpu/hbm.cpp.orig	2026-11-13 09:13:55.000000000 +0100
++++ ggml-1.0.0/src/ggml-cpu/hbm.cpp	2026-11-20 20:28:19.573322926 +0100
+@@ -21,10 +21,22 @@ static void ggml_backend_cpu_hbm_buffer_
+     hbw_free(buffer->context);
+ }
+ 
++static size_t ggml_backend_cpu_hbm_buffer_type_get_alignment(ggml_backend_buffer_type_t buft) {
++    return TENSOR_ALIGNMENT;
++
++    GGML_UNUSED(buft);
++}
++
++static bool ggml_backend_cpu_hbm_buffer_type_is_host(ggml_backend_buffer_type_t buft) {
++    return true;
++
++    GGML_UNUSED(buft);
++}
++
+ static ggml_backend_buffer_t ggml_backend_cpu_hbm_buffer_type_alloc_buffer(ggml_backend_buffer_type_t buft,
+                                                                            size_t                     size) {
+     void * ptr;
+-    int    result = hbw_posix_memalign(&ptr, ggml_backend_cpu_buffer_type_get_alignment(buft), size);
++    int    result = hbw_posix_memalign(&ptr, ggml_backend_cpu_hbm_buffer_type_get_alignment(buft), size);
+     if (result != 0) {
+         GGML_LOG_ERROR("failed to allocate HBM buffer of size %zu\n", size);
+         return NULL;
+@@ -43,11 +55,11 @@ ggml_backend_buffer_type_t ggml_backend_
+                            /* .get_name             = */ ggml_backend_cpu_hbm_buffer_type_get_name,
+                            /* .alloc_buffer         = */ ggml_backend_cpu_hbm_buffer_type_alloc_buffer,
+                            /* .alloc_buffer_n       = */ nullptr,
+-                           /* .get_alignment        = */ ggml_backend_cpu_buffer_type_get_alignment,
++                           /* .get_alignment        = */ ggml_backend_cpu_hbm_buffer_type_get_alignment,
+                            /* .get_max_size         = */ nullptr,  // defaults to SIZE_MAX
+                            /* .get_alloc_size       = */ nullptr,  // defaults to ggml_nbytes
+                            /* .get_alloc_size_n     = */ NULL,
+-                           /* .is_host              = */ ggml_backend_cpu_buffer_type_is_host,
++                           /* .is_host              = */ ggml_backend_cpu_hbm_buffer_type_is_host,
+                            },
+         /* .context  = */ nullptr,
+     };
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ggml.git/commitdiff/352b1e81e0c9534cb3ee24d4b2b12f9c6dc22b76



More information about the pld-cvs-commit mailing list