Commit cee37ffea for llama.cpp
commit cee37ffea0a5749bce1704f0621b9ddd185b4858
Author: Aaron Teo <aaron.teo1@ibm.com>
Date: Wed Sep 30 01:45:14 2026 +0800
ci: add zdnn backend build but not test (#29541)
* ci: add zdnn backend build but not test
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* ci: attempt to run a ubuntu 26.04 container
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* ci: set shell to bash
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* ci: clean up comments
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* ggml-zdnn: fix compiler errors
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
* vendor: attempt to ignore warnings from vendored files
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
---------
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
diff --git a/.github/workflows/build-ibm.yml b/.github/workflows/build-ibm.yml
index 355487e97..f94fe9abb 100644
--- a/.github/workflows/build-ibm.yml
+++ b/.github/workflows/build-ibm.yml
@@ -100,6 +100,46 @@ jobs:
wget https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K-be.gguf
./bin/llama-completion -m stories260K-be.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
+ ubuntu-26-zdnn-s390x:
+ name: ubuntu-26-zdnn-s390x
+ runs-on: ubuntu-24.04-s390x
+ container: ubuntu:26.04 # required to get GCC 15.1 and binutils 2.44
+ defaults:
+ run:
+ shell: bash
+
+ steps:
+ - name: Build Dependencies
+ id: build_depends
+ run: |
+ apt-get update
+ apt-get install -y --no-install-recommends \
+ build-essential cmake git ca-certificates \
+ libssl-dev libzdnn-dev
+
+ - name: Clone
+ id: checkout
+ uses: actions/checkout@v6
+
+ - name: Toolchain workaround (GCC 15)
+ run: |
+ apt-get install -y gcc-15 g++-15
+ echo "CC=gcc-15" >> "$GITHUB_ENV"
+ echo "CXX=g++-15" >> "$GITHUB_ENV"
+
+ - name: Build with zDNN Backend
+ id: cmake_build
+ run: |
+ cmake -B build \
+ -DLLAMA_FATAL_WARNINGS=ON \
+ -DGGML_NATIVE=OFF \
+ -DGGML_VXE=ON \
+ -DGGML_ZDNN=ON \
+ -DGGML_RPC=ON \
+ -DCMAKE_C_FLAGS="-march=arch15" \
+ -DCMAKE_CXX_FLAGS="-march=arch15"
+ time cmake --build build --config Release -j $(nproc)
+
ubuntu-24-ppc64le:
runs-on: ubuntu-24.04-ppc64le
diff --git a/ggml/include/ggml-zdnn.h b/ggml/include/ggml-zdnn.h
index fbf45b6e1..e6970ad2f 100644
--- a/ggml/include/ggml-zdnn.h
+++ b/ggml/include/ggml-zdnn.h
@@ -10,6 +10,8 @@ extern "C" {
// device buffer
GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_zdnn_buffer_type(void);
+GGML_BACKEND_API bool ggml_backend_is_zdnn(ggml_backend_t backend);
+
GGML_BACKEND_API ggml_backend_reg_t ggml_backend_zdnn_reg(void);
#ifdef __cplusplus
diff --git a/ggml/src/ggml-zdnn/ggml-zdnn.cpp b/ggml/src/ggml-zdnn/ggml-zdnn.cpp
index 3b45370a8..5ae83bbd1 100644
--- a/ggml/src/ggml-zdnn/ggml-zdnn.cpp
+++ b/ggml/src/ggml-zdnn/ggml-zdnn.cpp
@@ -443,15 +443,13 @@ static ggml_backend_i ggml_backend_zdnn_i = {
};
static ggml_guid_t ggml_backend_zdnn_guid(void) {
- static const char * guid_str = "IBM-ZDNN-ACCELER";
- return reinterpret_cast<ggml_guid_t>((void *)guid_str);
+ static char guid_str[] = "IBM-ZDNN-ACCELER";
+ return reinterpret_cast<ggml_guid_t>(guid_str);
}
bool ggml_backend_is_zdnn(ggml_backend_t backend) {
return backend != NULL &&
ggml_guid_matches(backend->guid, ggml_backend_zdnn_guid());
-
- GGML_UNUSED(backend);
}
//
@@ -488,7 +486,7 @@ static void ggml_backend_zdnn_device_get_props(ggml_backend_dev_t dev, ggml_back
props->description = ggml_backend_zdnn_device_get_description(dev);
props->type = ggml_backend_zdnn_device_get_type(dev);
ggml_backend_zdnn_device_get_memory(dev, &props->memory_free, &props->memory_total);
- props->caps = (ggml_backend_dev_caps) {
+ props->caps = {
/* .async = */ false,
/* .host_buffer = */ false,
/* .buffer_from_host_ptr = */ false,
@@ -505,7 +503,7 @@ static ggml_backend_t ggml_backend_zdnn_device_init(ggml_backend_dev_t dev, cons
}
ggml_backend_t backend = (ggml_backend *)malloc(sizeof(ggml_backend));
- *backend = (ggml_backend) {
+ *backend = {
/* .guid = */ ggml_backend_zdnn_guid(),
/* .iface = */ ggml_backend_zdnn_i,
/* .device = */ dev,
@@ -624,13 +622,13 @@ ggml_backend_reg_t ggml_backend_zdnn_reg(void) {
atexit(ggml_zdnn_cleanup);
{
- g_ggml_backend_zdnn_reg = (ggml_backend_reg) {
+ g_ggml_backend_zdnn_reg = {
/* .api_version = */ GGML_ZDNN_VERSION,
/* .iface = */ ggml_backend_zdnn_reg_i,
/* .context = */ NULL
};
- g_ggml_backend_zdnn_device = (ggml_backend_device) {
+ g_ggml_backend_zdnn_device = {
/* .iface = */ ggml_backend_zdnn_device_i,
/* .reg = */ &g_ggml_backend_zdnn_reg,
/* .context = */ &g_ggml_ctx_dev_main
diff --git a/vendor/stb/CMakeLists.txt b/vendor/stb/CMakeLists.txt
index 14ea2f9e0..7eeb972d2 100644
--- a/vendor/stb/CMakeLists.txt
+++ b/vendor/stb/CMakeLists.txt
@@ -4,3 +4,7 @@ add_library(stb INTERFACE)
add_library(vendor::stb ALIAS stb)
target_include_directories(stb INTERFACE ..)
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ target_compile_options(stb INTERFACE -Wno-maybe-uninitialized)
+endif()