diff --git a/.github/workflows/build-ethos-u-vela.yml b/.github/workflows/build-ethos-u-vela.yml new file mode 100644 index 00000000000..1f7c36891ae --- /dev/null +++ b/.github/workflows/build-ethos-u-vela.yml @@ -0,0 +1,124 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on upstream's [tool.cibuildwheel] config: +# https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela/-/blob/5.2.0/pyproject.toml +name: Build ethos-u-vela wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/ethos-u-vela.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-ethos-u-vela.yml' + - 'docs/packages/ethos-u-vela.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-ethos-u-vela.yml' + - 'docs/packages/ethos-u-vela.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: ethos-u-vela + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build ethos-u-vela ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 240 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # No cp314t: neither mlw_codec nor regor declares free-threading support. + python: ["cp312", "cp313", "cp314"] + + env: + ETHOS_U_VELA_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout ethos-u-vela ${{ env.ETHOS_U_VELA_VERSION }} + run: | + set -euo pipefail + shopt -s dotglob + rm -rf ./* + git clone -q --depth 1 --branch "${ETHOS_U_VELA_VERSION}" https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela.git . + + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + sparse-checkout: patches/ethos-u-vela + persist-credentials: false + + - name: Patch ethos-u-vela source + run: | + git apply -v python-wheels/patches/ethos-u-vela/${{ env.ETHOS_U_VELA_VERSION }}/*.patch + rm -rf python-wheels + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # setup.py only passes -j to CMake for `build_ext --parallel`, which pip never sets. + CIBW_ENVIRONMENT: >- + SETUPTOOLS_SCM_PRETEND_VERSION=${{ env.ETHOS_U_VELA_VERSION }} + CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + + - name: Check wheel contents + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + assert len(sys.argv) == 2, sys.argv + names = zipfile.ZipFile(sys.argv[1]).namelist() + for ext in ("ethosu/mlw_codec.", "ethosu/regor."): + assert any(n.startswith(ext) and n.endswith(".so") for n in names), ext + licences = {n.split(".dist-info/licenses/", 1)[1] for n in names if ".dist-info/licenses/" in n and not n.endswith("/")} + assert licences == {"LICENSE.txt"} | {f"ethosu/regor/dependencies/thirdparty/{d}/LICENSE" for d in ("flatbuffers", "fmt", "gemmlowp", "pybind11")}, licences + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ethos-u-vela-${{ env.ETHOS_U_VELA_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish ethos-u-vela ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: ethos-u-vela-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/ethos-u-vela.yaml b/docs/packages/ethos-u-vela.yaml new file mode 100644 index 00000000000..a7889faabb3 --- /dev/null +++ b/docs/packages/ethos-u-vela.yaml @@ -0,0 +1,6 @@ +package-name: ethos-u-vela +source-code: https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela +license: Apache-2.0 +versions: +- version: 5.2.0 + patched: true diff --git a/patches/ethos-u-vela/5.2.0/0001-pyproject-ship-licence-files-of-vendored-C-libraries.patch b/patches/ethos-u-vela/5.2.0/0001-pyproject-ship-licence-files-of-vendored-C-libraries.patch new file mode 100644 index 00000000000..13d55568c5a --- /dev/null +++ b/patches/ethos-u-vela/5.2.0/0001-pyproject-ship-licence-files-of-vendored-C-libraries.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Wed, 30 Sep 2026 12:00:00 +0200 +Subject: [PATCH] pyproject: ship licence files of vendored C++ libraries + +The regor extension module compiles in the vendored FlatBuffers, fmt, +gemmlowp and pybind11 headers from ethosu/regor/dependencies/thirdparty +(see THIRDPARTY.md), but the wheel only carries Vela's own LICENSE.txt. +Their Apache-2.0, MIT and BSD-3-Clause terms require the notices to +travel with the binary, so list them in license-files. Catch2 is only +linked into the C++ unit tests and is left out. + +Upstream-Status: To upstream [opening a merge request on gitlab.arm.com needs an Arm GitLab account] +--- + pyproject.toml | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/pyproject.toml b/pyproject.toml +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -20,7 +20,13 @@ + requires-python = ">=3.10" + authors = [{name = "Arm Ltd", email = "mlg-vela@arm.com"}] + license = "Apache-2.0" +-license-files = ["LICENSE.txt"] ++license-files = [ ++ "LICENSE.txt", ++ "ethosu/regor/dependencies/thirdparty/flatbuffers/LICENSE", ++ "ethosu/regor/dependencies/thirdparty/fmt/LICENSE", ++ "ethosu/regor/dependencies/thirdparty/gemmlowp/LICENSE", ++ "ethosu/regor/dependencies/thirdparty/pybind11/LICENSE", ++] + classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", +-- +2.43.0 +