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
31 changes: 29 additions & 2 deletions .github/workflows/android_hexagon_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ on:
pull_request:
paths:
- '.github/workflows/android_hexagon_candidate.yml'
- '.github/workflows/native_release.yml'
- 'CMakeLists.txt'
- 'cmake/llama_cpp_patches.cmake'
- 'patches/llama.cpp/**'
- 'scripts/publish_prepared_release.py'
- 'third_party/llama.cpp'
- 'tests/test_android_hexagon.py'
- 'tools/android_hexagon.py'
- 'tools/build.py'
- 'tools/build_android_hexagon_candidate.sh'
- 'tools/llama_cpp_patches.py'
- 'tools/validate_android_artifacts.py'
workflow_call:
inputs:
native_commit:
Expand All @@ -35,7 +38,7 @@ jobs:
candidate:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
timeout-minutes: 40
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
with:
Expand Down Expand Up @@ -93,7 +96,7 @@ jobs:
path: ${{ runner.temp }}/android-ndk-install-diagnostics.json
if-no-files-found: error
retention-days: 7
- name: Build and verify the release-gated archive
- name: Build and verify the Hexagon candidate archive
env:
NATIVE_TAG: ${{ steps.source.outputs.tag }}
run: |
Expand All @@ -107,3 +110,27 @@ jobs:
path: artifacts/hexagon-candidate/
if-no-files-found: error
retention-days: 7
- name: Build Android arm64 Vulkan core for the PR pair
if: github.event_name == 'pull_request'
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y ninja-build glslc
ANDROID_VULKAN_GLSLC="$(command -v glslc)"
export ANDROID_VULKAN_GLSLC
export ANDROID_NDK_HOME="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/usr/local/lib/android/sdk}}/ndk/28.2.13676358"
python3 tools/build.py android --abi arm64-v8a --backend vulkan --jobs 4 2>&1 | tee configure-vulkan.log
grep -Fx -- '-- GL_EXT_integer_dot_product not supported by glslc' configure-vulkan.log
- name: Verify a real sidecar and Vulkan core pair for this PR
if: github.event_name == 'pull_request'
env:
NATIVE_TAG: ${{ steps.source.outputs.tag }}
run: |
set -euo pipefail
ndk="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/usr/local/lib/android/sdk}}/ndk/28.2.13676358"
readelf="$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf"
archive="llamadart-native-android-arm64-hexagon-$NATIVE_TAG.tar.gz"
python3 tools/validate_android_artifacts.py --readelf "$readelf" --core-dir bin/android/arm64 \
--package-hexagon-sidecar "hexagon-sidecar/$archive" "artifacts/hexagon-candidate/$archive"
python3 tools/validate_android_artifacts.py --readelf "$readelf" --core-dir bin/android/arm64 \
--hexagon-sidecar-archive "hexagon-sidecar/$archive"
98 changes: 85 additions & 13 deletions .github/workflows/native_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ on:
correlation_id:
description: 'Stable caller correlation identifier (1-128 safe characters)'
required: true
prepare_android_hexagon:
description: 'Build experimental Android arm64 Hexagon for qualification only (#260)'
default: false
type: boolean
publish_release:
description: 'Publish GitHub release'
description: 'Publish directly without Hexagon. Select false to prepare a release with Hexagon.'
required: true
default: true
type: boolean
Expand Down Expand Up @@ -80,15 +76,9 @@ jobs:
INPUT_SMOKE_POLICY: ${{ github.event.inputs.smoke_policy }}
INPUT_CORRELATION_ID: ${{ github.event.inputs.correlation_id }}
INPUT_PUBLISH_RELEASE: ${{ github.event.inputs.publish_release }}
INPUT_PREPARE_ANDROID_HEXAGON: ${{ inputs.prepare_android_hexagon }}
run: |
set -euo pipefail

if [ "$INPUT_PREPARE_ANDROID_HEXAGON" = "true" ] && [ "$INPUT_PUBLISH_RELEASE" != "false" ]; then
echo "Hexagon SDK agreement review is pending (#260). Use publish_release=false." >&2
exit 1
fi

TAG="$INPUT_LLAMA_CPP_TAG"
EXPECTED_COMMIT="$INPUT_LLAMA_CPP_COMMIT"
RELEASE_TAG="$INPUT_NATIVE_RELEASE_TAG"
Expand Down Expand Up @@ -180,7 +170,7 @@ jobs:

build-android-hexagon:
needs: resolve-tag
if: inputs.prepare_android_hexagon
if: inputs.publish_release == false
uses: ./.github/workflows/android_hexagon_candidate.yml
with:
native_commit: ${{ needs.resolve-tag.outputs.native_commit }}
Expand Down Expand Up @@ -1146,6 +1136,61 @@ jobs:
llama_cpp_commit: ${{ needs.resolve-tag.outputs.llama_cpp_commit }}
- uses: ./.github/actions/openvino-sidecar-pair

hexagon-sidecar-pair:
needs: [resolve-tag, build-android, build-android-hexagon]
if: inputs.publish_release == false
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
persist-credentials: false
- name: Checkout llama.cpp ref
uses: ./.github/actions/checkout-llama-ref
with:
tag: ${{ needs.resolve-tag.outputs.llama_cpp_ref }}
expected_commit: ${{ needs.resolve-tag.outputs.llama_cpp_commit }}
github_token: ${{ github.token }}
- name: Checkout exact release source
uses: ./.github/actions/checkout-native-source
with:
native_commit: ${{ needs.resolve-tag.outputs.native_commit }}
llama_cpp_commit: ${{ needs.resolve-tag.outputs.llama_cpp_commit }}
- uses: android-actions/setup-android@v4
with:
packages: platform-tools ndk;${{ env.ANDROID_NDK_VERSION }}
- name: Download Android arm64 Vulkan core
uses: actions/download-artifact@v8
with:
name: native_android_arm64-v8a_vulkan
path: android-core
- name: Download Android arm64 Hexagon candidate
uses: actions/download-artifact@v8
with:
name: android-arm64-hexagon-candidate
path: hexagon-candidate
- name: Package and validate the Hexagon sidecar against the release core
env:
RELEASE_TAG: ${{ needs.resolve-tag.outputs.release_tag }}
run: |
set -euo pipefail
ndk="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/usr/local/lib/android/sdk}}/ndk/$ANDROID_NDK_VERSION"
readelf="$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf"
archive="llamadart-native-android-arm64-hexagon-$RELEASE_TAG.tar.gz"
(cd hexagon-candidate && sha256sum -c SHA256SUMS)
python3 tools/validate_android_artifacts.py --readelf "$readelf" --core-dir android-core \
--package-hexagon-sidecar "hexagon-sidecar/$archive" "hexagon-candidate/$archive"
python3 tools/validate_android_artifacts.py --readelf "$readelf" --core-dir android-core \
--hexagon-sidecar-archive "hexagon-sidecar/$archive"
- name: Upload packaged Hexagon sidecar
uses: actions/upload-artifact@v7
with:
name: sidecar_android_arm64_hexagon
path: hexagon-sidecar/*.tar.gz
if-no-files-found: error

smoke-release-contract:
needs: [resolve-tag, build-linux]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1181,7 +1226,20 @@ jobs:
fi

package-and-release:
needs: [resolve-tag, build-android, build-apple, metal-os-floor, build-linux, build-linux-hip, build-windows, smoke-release-contract, openvino-sidecar-pair]
needs: [resolve-tag, build-android, build-apple, metal-os-floor, build-linux, build-linux-hip, build-windows, smoke-release-contract, openvino-sidecar-pair, hexagon-sidecar-pair]
if: >-
${{ !cancelled() &&
needs.resolve-tag.result == 'success' &&
needs.build-android.result == 'success' &&
needs.build-apple.result == 'success' &&
needs.metal-os-floor.result == 'success' &&
needs.build-linux.result == 'success' &&
needs.build-linux-hip.result == 'success' &&
needs.build-windows.result == 'success' &&
needs.smoke-release-contract.result == 'success' &&
needs.openvino-sidecar-pair.result == 'success' &&
((!inputs.publish_release && needs.hexagon-sidecar-pair.result == 'success') ||
(inputs.publish_release && needs.hexagon-sidecar-pair.result == 'skipped')) }}
runs-on: macos-latest
outputs:
native_commit: ${{ needs.resolve-tag.outputs.native_commit }}
Expand Down Expand Up @@ -1210,7 +1268,11 @@ jobs:
with:
path: artifacts
- name: Prepare release assets
env:
INPUT_PUBLISH_RELEASE: ${{ github.event.inputs.publish_release }}
RELEASE_TAG: ${{ needs.resolve-tag.outputs.release_tag }}
run: |
set -euo pipefail
mkdir -p release_assets
mkdir -p bundles

Expand Down Expand Up @@ -1269,6 +1331,16 @@ jobs:
openvino_archive="llamadart-native-linux-x64-openvino-${{ needs.resolve-tag.outputs.release_tag }}.tar.gz"
cp "artifacts/sidecar_linux_x64_openvino/$openvino_archive" "release_assets/$openvino_archive"

PYTHONPATH=tools python3 -c 'from pathlib import Path; from android_hexagon import validate_core_layout; validate_core_layout(Path("bundles/android-arm64"))'
if [ "$INPUT_PUBLISH_RELEASE" = "false" ]; then
# The paired Vulkan artifacts must survive the backend merge byte for byte.
for library in libllamadart.so libggml-base.so; do
cmp "artifacts/native_android_arm64-v8a_vulkan/$library" "bundles/android-arm64/$library"
done
hexagon_archive="llamadart-native-android-arm64-hexagon-$RELEASE_TAG.tar.gz"
cp "artifacts/sidecar_android_arm64_hexagon/$hexagon_archive" "release_assets/$hexagon_archive"
fi

for bundle_dir in bundles/windows-*; do
[ -d "$bundle_dir" ] || continue
python3 tools/package_windows_runtime.py install --arch "${bundle_dir##*/windows-}" "$bundle_dir" artifacts
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,10 @@ the following per-target bundles:
- Windows x64: Vulkan + CUDA + BLAS + CPU
- Windows arm64: Vulkan + BLAS + Kleidi + CPU

An experimental [Android arm64 Hexagon candidate](docs/android_hexagon.md)
provides a separate CPU + HTP bundle for qualification. The maintainer approved
hosted SDK use and redistribution of the generated DSP skeletons in
[#260](https://github.com/leehack/llamadart-native/issues/260#issuecomment-7326932721).
Publishing the candidate requires a separate maintainer decision.
The experimental [Android arm64 Hexagon sidecar](docs/android_hexagon.md)
adds HTP to the same release's Android arm64 core. It is available through the
prepared-release flow with a separate maintainer publication decision. The
standalone CPU + HTP candidate remains available for qualification.

Non-Apple targets use `GGML_BACKEND_DL=ON`, so backend libs are optional at package/runtime level.

Expand Down
35 changes: 26 additions & 9 deletions docs/android_hexagon.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Experimental Android arm64 Hexagon candidate
# Experimental Android arm64 Hexagon sidecar

The maintainer approved use of Qualcomm Hexagon SDK Community Edition 6.7.0.0
in hosted CI and redistribution of the generated DSP skeletons in
[#260](https://github.com/leehack/llamadart-native/issues/260#issuecomment-7326932721).
Publishing the candidate requires a separate maintainer decision.
On 2026-12-01, the maintainer approved use of Qualcomm Hexagon SDK Community
Edition 6.7.0.0 in hosted CI and redistribution of the generated DSP skeletons
in [#260](https://github.com/leehack/llamadart-native/issues/260#issuecomment-7326932721).
On 2026-12-02, the maintainer approved publication of the Hexagon sidecar in
v1.1.0-6. Qualcomm hosts the click-through terms in Software Center.
The [Qualcomm catalog](https://softwarecenter.qualcomm.com/catalog/item/Hexagon_SDK?version=6.7.0.0)
links the vendor distribution. The [public SDK repack](https://github.com/snapdragon-toolchain/hexagon-sdk/releases/tag/v6.7.0.0)
contains third-party notices that refer Qualcomm terms to a separate agreement.
Expand Down Expand Up @@ -38,10 +39,26 @@ values. The validator checks the archive and directory layout, shared-library
machines, supported Android API and NDK, 16 KiB host segment alignment, CPU ISA
and C++ runtime sharing, dynamic exports, and the host and DSP dependency sets.

GitHub Actions stores a tag-coupled candidate and its SHA-256 separately from
the native release assets. The release workflow accepts `prepare_android_hexagon=true`
for qualification with `publish_release=false`. The prepared-release importer
refuses a source run that built a Hexagon candidate.
## Prepared release

A native preparation with `publish_release=false` runs the standalone
candidate build and pairs it with the same run's Vulkan core. The pair checks
that source, patch, configuration, compiler and target identities match, that
the host's ggml imports resolve against the core's `libggml-base.so`, and that
the host and skeletons pass artifact validation.

The Contract-2 archive `llamadart-native-android-arm64-hexagon-<tag>.tar.gz`
contains eight files: the host module, five DSP skeletons, the notices and the
manifest. The manifest records the identity and SHA-256 of the core archive's
`libllamadart.so`. The core's Android arm64 archive contains no Hexagon
payload. Consumers opt in to the sidecar and stage the verified skeletons as
app assets. The standalone candidate remains a CPU + HTP bundle for local
qualification and carries its own primary library.

After inspecting the same-run archives and obtaining the separate publication
decision, use `publish_prepared.yml` with `publish_approved=true`. See the
[release version policy](release_version_policy.md#publishing-a-qualified-preparation-without-rebuilding).
Direct release runs publish the existing inventory without Hexagon.

## App qualification

Expand Down
6 changes: 6 additions & 0 deletions docs/release_version_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ read-only no-op after newer releases; its report records that new publication
would now be blocked. Unmarked/mismatched tags, release metadata and assets can
never use that exception, and it never invokes the publisher.

The [Android arm64 Hexagon sidecar](android_hexagon.md) is part of the prepared
inventory. The importer requires successful candidate and pair jobs. A direct
`publish_release=true` run retains the existing inventory and rejects Hexagon.
Publishing the prepared sidecar requires the separate maintainer decision
recorded in the Hexagon documentation.

The dedicated publication job reuses `release_publication.py`; it does not build
or alter an asset. Prerelease classification comes from the version policy,
including `true` for wrapper rebuilds. The original build run/head, artifact
Expand Down
2 changes: 2 additions & 0 deletions scripts/generate_assets_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ infer_meta() {
platform="ios"; arch="x86_64-sim"; backend="core" ;;
"llamadart-native-android-arm64-$tag.tar.gz")
platform="android"; arch="arm64"; backend="core" ;;
"llamadart-native-android-arm64-hexagon-$tag.tar.gz")
platform="android"; arch="arm64"; backend="hexagon"; module="backend-hexagon" ;;
"llamadart-native-android-x64-$tag.tar.gz")
platform="android"; arch="x64"; backend="core" ;;
esac
Expand Down
14 changes: 4 additions & 10 deletions scripts/publish_prepared_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
WORKFLOW_PATH = '.github/workflows/native_release.yml'
MAX_ARCHIVE_BYTES = 4 * 1024 ** 3
SUCCESS_JOBS = ('resolve-tag', 'build-linux-hip', 'build-linux-openvino',
'openvino-sidecar-pair', 'smoke-release-contract',
'openvino-sidecar-pair', 'build-android-hexagon / candidate', 'hexagon-sidecar-pair',
'smoke-release-contract',
'package-and-release', 'emit-release-result',
'metal-os-floor / macos (macos-15)',
'metal-os-floor / macos (macos-26)', 'metal-os-floor / ios-simulator')
Expand Down Expand Up @@ -149,13 +150,6 @@ def validate_run(expected: Expected, run: dict, jobs: list[dict]) -> None:
names = [job.get('name') for job in jobs]
require(len(names) == len(set(names)), 'ambiguous source job names')
for job in jobs:
name = job.get('name')
if (name in ('build-android-hexagon', 'build-android-hexagon / candidate')
and job.get('conclusion') == 'skipped'):
require(job.get('status') == 'completed', 'Hexagon job has not settled')
continue
require(not isinstance(name, str) or not name.startswith('build-android-hexagon'),
'Hexagon SDK agreement review is pending (#260)')
require(job.get('status') == 'completed' and
job.get('conclusion') == ('skipped' if job.get('name') in SKIPPED_JOBS else 'success'),
'source job is failed, incomplete or unexpectedly skipped')
Expand Down Expand Up @@ -190,7 +184,7 @@ def validate_artifact(expected: Expected, run: dict, jobs: list[dict], artifact:


def extract_publication(archive: Path, output: Path, expected: Expected) -> None:
allowed = {f'release_assets/{name}' for name in _expected_release_assets(expected.native_release_tag)}
allowed = {f'release_assets/{name}' for name in _expected_release_assets(expected.native_release_tag, prepared=True)}
allowed |= {'publication/native_commit', 'publication/release-provenance.bundle'}
seen: set[str] = set()
total = 0
Expand Down Expand Up @@ -288,7 +282,7 @@ def prepare(expected: Expected, api: GitHub, directory: Path, repository: Path,
prerelease=contract['github_prerelease'] == 'true', assets_dir=assets,
workflow_run_url=expected.run_url, artifact_digest='sha256:' + expected.artifact_sha256,
correlation_id=expected.correlation_id, smoke_policy='required', smoke_conclusion='passed',
workflow_head_sha=expected.workflow_head_sha)
workflow_head_sha=expected.workflow_head_sha, prepared=True)
report = {'source': result, 'source_result_artifact_id': result_artifact['id'],
'source_result_artifact_digest': result_artifact['digest'],
'transaction_id': desired.transaction_id, 'github_prerelease': desired.prerelease}
Expand Down
Loading
Loading