Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 40 additions & 32 deletions .github/local/Makefile.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,46 @@ SRC_DIR := src

debuild: build

.PHONY: pre_build_dep
pre_build_dep:
sudo apt-get update
sudo apt-get install -y --no-install-recommends docker.io

.PHONY: main_build
main_build: build-qcom
main_build: build-midstream

# ===== Radxa Q6A/Q8B (OpenCL GPU, mainline kernel) =====
PKG_MIDSTREAM := llama.cpp-qcom-midstream
BUILD_MIDSTREAM := $(SRC_DIR)/build-midstream-cross
INSTALL_MIDSTREAM := $(SRC_DIR)/install-midstream-cross
OPENCL_TARBALL := qcom-adreno_1.838.3_qcm6490.tar.gz
OPENCL_URL := https://softwarecenter.qualcomm.com/nexus/generic/software/chip/qualcomm_linux-spf-1-0/qualcomm-linux-spf-1-0_test_device_public/r1.0_00114.0/le-qclinux-1-0-r1/apps_proc/prebuilt_HY22/qcom-adreno/251215/$(OPENCL_TARBALL)
OPENCL_DIR := _opencl

# ===== Qualcomm Snapdragon (Hexagon DSP) =====
PKG_QCOM := llama.cpp-qcom
BUILD_QCOM := $(SRC_DIR)/build-qcom
INSTALL_QCOM := $(SRC_DIR)/install-qcom
DOCKER_QCOM := ghcr.io/snapdragon-toolchain/arm64-linux:v0.1
$(OPENCL_TARBALL):
wget -q --tries=5 --timeout=60 --retry-connrefused \
Comment thread
RadxaYuntian marked this conversation as resolved.
"$(OPENCL_URL)" -O $@.tmp
mv $@.tmp $@

.PHONY: build-qcom
build-qcom:
cp $(SRC_DIR)/docs/backend/snapdragon/CMakeUserPresets.json $(SRC_DIR)/
sed -i 's/"version": 5/"version": 4/' $(SRC_DIR)/CMakeUserPresets.json
# Create container and copy source (docker cp avoids Docker-in-Docker volume mount issue)
docker create --name qcom-build --platform linux/amd64 $(DOCKER_QCOM) \
/bin/bash -c ' \
set -euo pipefail; \
cd /workspace; \
cmake --preset arm64-linux-snapdragon-release -B build-qcom; \
cmake --build build-qcom -j $$(nproc); \
cmake --install build-qcom --prefix install-qcom \
'
docker cp $(SRC_DIR)/. qcom-build:/workspace/
docker start -a qcom-build
rm -rf $(INSTALL_QCOM)
docker cp qcom-build:/workspace/install-qcom/. $(INSTALL_QCOM)/
docker rm qcom-build
rm -rf $(PKG_QCOM)
mkdir -p $(PKG_QCOM)/usr
cp -a $(INSTALL_QCOM)/* $(PKG_QCOM)/usr/
.PHONY: build-midstream
build-midstream: $(OPENCL_TARBALL)
rm -rf $(OPENCL_DIR)
mkdir -p $(OPENCL_DIR)
tar xzf "$(OPENCL_TARBALL)" -C $(OPENCL_DIR)
ln -sf usr/lib/libOpenCL.so.1 $(OPENCL_DIR)/libOpenCL.so
cmake -S $(SRC_DIR) -B $(BUILD_MIDSTREAM) -G Ninja \
Comment thread
RadxaYuntian marked this conversation as resolved.
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
Comment thread
RadxaYuntian marked this conversation as resolved.
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
-DBUILD_SHARED_LIBS=OFF \
-DGGML_NATIVE=OFF \
-DGGML_OPENCL=ON \
-DGGML_OPENCL_USE_ADRENO_KERNELS=ON \
-DGGML_OPENCL_EMBED_KERNELS=ON \
-DGGML_HEXAGON=OFF \
-DGGML_OPENCL_TARGET_VERSION=200 \
-DOpenCL_LIBRARY=$(abspath $(OPENCL_DIR))/libOpenCL.so \
-DOpenCL_INCLUDE_DIR=/usr/include
cmake --build $(BUILD_MIDSTREAM) -j $$(nproc)
rm -rf $(INSTALL_MIDSTREAM)
cmake --install $(BUILD_MIDSTREAM) --prefix $(abspath $(INSTALL_MIDSTREAM))
rm -rf $(PKG_MIDSTREAM)
mkdir -p $(PKG_MIDSTREAM)/usr
cp -a $(INSTALL_MIDSTREAM)/* $(PKG_MIDSTREAM)/usr/
13 changes: 10 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@
/*.changes
/.pc

# Output folder
/out
/llama.cpp-qcom-midstream

# Build artifacts in src/
/src/build-midstream-cross/
/src/install-midstream-cross/

# Cached OpenCL tarball
/qcom-adreno_*.tar.gz
/qcom-adreno_*.tar.gz.tmp
/_opencl/

# Logs
/*.log

1 change: 1 addition & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/*.substvars
/tmp

/llama.cpp-qcom-midstream
8 changes: 8 additions & 0 deletions debian/changelog
Comment thread
RadxaYuntian marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
llama.cpp-qcom-midstream (0.0.7992-1) UNRELEASED; urgency=medium

* Initial packaging for Qualcomm mainline-kernel devices
* OpenCL GPU backend with Adreno optimized kernels
* Based on upstream tag b7992

-- "Radxa Computer Co., Ltd" <dev@radxa.com> Mon, 20 Jul 2026 08:00:00 +0800

llama.cpp (0.0.10034-1) unstable; urgency=medium

[ Chongbiao Chen ]
Expand Down
19 changes: 13 additions & 6 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: llama.cpp
Source: llama.cpp-qcom-midstream
Maintainer: "Radxa Computer Co., Ltd" <dev@radxa.com>
Section: admin
Priority: standard
Expand All @@ -9,13 +9,20 @@ Build-Depends: debhelper-compat (= 13),
lintian,
dh-exec,
pandoc,
ca-certificates,
cmake,
crossbuild-essential-arm64,
ninja-build,
opencl-headers,
python3,
wget,

Package: llama.cpp-qcom
Package: llama.cpp-qcom-midstream
Architecture: all
Section: admin
Priority: optional
Depends: ${misc:Depends},
fastrpc,
Description: llama.cpp for Qualcomm Snapdragon
llama.cpp with Hexagon DSP backend for Qualcomm Snapdragon devices.

qcom-adreno-opencl-midstream,
python3,
Description: llama.cpp for Qualcomm mainline (OpenCL GPU)
llama.cpp with OpenCL GPU backend for Qualcomm mainline-kernel devices.
1 change: 1 addition & 0 deletions debian/llama.cpp-qcom-midstream.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
llama.cpp-qcom-midstream/usr /
7 changes: 7 additions & 0 deletions debian/llama.cpp-qcom-midstream.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Prebuilt cross-compiled binaries in Architecture: all package
arch-independent-package-contains-binary-or-object
missing-dependency-on-libc
unstripped-binary-or-object
no-manual-page
pkg-config-unavailable-for-cross-compilation
script-with-language-extension
1 change: 0 additions & 1 deletion debian/llama.cpp-qcom.install

This file was deleted.

13 changes: 0 additions & 13 deletions debian/llama.cpp-qcom.lintian-overrides

This file was deleted.

15 changes: 12 additions & 3 deletions pkg.conf.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
{
"*": {
"Releases": [
"qcs9075-noble",
"qcs9075-noble-test"
"qcs6490-noble",
"qcs6490-noble-test",
"qcs6490-trixie",
"qcs6490-trixie-test",
"qcs6490-resolute",
"qcs6490-resolute-test",
"sc8280xp-noble",
"sc8280xp-noble-test",
"sc8280xp-trixie",
"sc8280xp-trixie-test",
"sc8280xp-resolute",
"sc8280xp-resolute-test"
]
}
}

2 changes: 1 addition & 1 deletion src
Comment thread
RadxaYuntian marked this conversation as resolved.
Submodule src updated 2640 files