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
1 change: 0 additions & 1 deletion .github/workflows/_runner-gap9-tiled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
source /app/install/gap9-sdk/.gap9-venv/bin/activate
source /app/install/gap9-sdk/configs/gap9_evk_audio.sh || true
export GVSOC_INSTALL_DIR=/app/install/gap9-sdk/install/workstation
export GAP_RISCV_GCC_TOOLCHAIN=/app/install/gcc/gap9
cd DeeployTest
mkdir -p /app/.ccache
export CCACHE_DIR=/app/.ccache
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/_runner-gap9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
source /app/install/gap9-sdk/.gap9-venv/bin/activate
source /app/install/gap9-sdk/configs/gap9_evk_audio.sh || true
export GVSOC_INSTALL_DIR=/app/install/gap9-sdk/install/workstation
export GAP_RISCV_GCC_TOOLCHAIN=/app/install/gcc/gap9
cd DeeployTest
mkdir -p /app/.ccache
export CCACHE_DIR=/app/.ccache
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-platform-gap9-tiled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ concurrency:

jobs:
select-env:
if: github.repository == 'pulp-platform/Deeploy'
uses: ./.github/workflows/_select-env.yml
with:
docker_image_deeploy: ${{ github.event.inputs.docker_image_deeploy || github.repository == 'pulp-platform/Deeploy' && 'ghcr.io/pulp-platform/deeploy-gap9:latest'}}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-platform-gap9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ concurrency:

jobs:
select-env:
if: github.repository == 'pulp-platform/Deeploy'
uses: ./.github/workflows/_select-env.yml
with:
docker_image_deeploy: ${{ github.event.inputs.docker_image_deeploy || (github.repository == 'pulp-platform/Deeploy' && 'ghcr.io/pulp-platform/deeploy-gap9:latest') }}
Expand Down
150 changes: 150 additions & 0 deletions .github/workflows/docker-build-deeploy-gap9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# SPDX-FileCopyrightText: 2025 ETH Zurich and University of Bologna
#
# SPDX-License-Identifier: Apache-2.0

---
name: Docker • Build Deeploy GAP9 Container

"on":
workflow_dispatch:
inputs:
docker_image_deeploy:
description: "Deeploy Image to use"
required: false
default: "ghcr.io/pulp-platform/deeploy:latest"

jobs:
prepare:
name: Fetch branch name or tag
runs-on: ubuntu-latest
outputs:
docker_tag: ${{ steps.generate_tag.outputs.docker_tag }}
steps:
- uses: actions/checkout@v4

- name: Set up environment variables
run: |
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "IS_TAG=${GITHUB_REF_TYPE}" >> $GITHUB_ENV

- name: Set Docker tag
id: generate_tag
run: |
if [[ "${{ env.IS_TAG }}" == "tag" ]]; then
echo "docker_tag=${{ env.TAG_NAME }}" >> $GITHUB_OUTPUT
else
echo "docker_tag=${{ env.BRANCH_NAME }}" >> $GITHUB_OUTPUT
fi

build-deeploy-gap9:
name: Build Deeploy GAP9 Image
needs: [prepare]
runs-on: ${{ matrix.runner }}
outputs:
digest-amd64: ${{ steps.digest.outputs.digest-amd64 }}
digest-arm64: ${{ steps.digest.outputs.digest-arm64 }}
strategy:
fail-fast: false
matrix:
platform: [amd64, arm64]
include:
- platform: amd64
runner: ubuntu-latest
- platform: arm64
runner: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4

- name: Free up disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true

- uses: docker/setup-buildx-action@v3

- name: GHCR Log-in
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Cache for Docker
id: cache
uses: actions/cache@v4
with:
path: var-ccache
key: ${{ runner.os }}-${{ matrix.platform }}-build-cache-deeploy-gap9

- name: Inject build-cache
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"var-ccache": "/ccache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Lower Case Repository Name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ github.repository_owner }}"

- name: Load SSH key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Build and push final Deeploy image
id: build
uses: docker/build-push-action@v6
with:
platforms: linux/${{ matrix.platform }}
context: .
cache-from: type=gha
cache-to: type=gha,mode=min
file: Container/Dockerfile.deeploy-gap9
push: true
build-args: |
DEEPLOY_IMAGE=${{ github.event.inputs.docker_image_deeploy }}
ssh: default
outputs: type=image,name=ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9,annotation-index=true,name-canonical=true,push=true

- name: Extract image digest
id: digest
run: echo "digest-${{ matrix.platform }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT

merge-deeploy-gap9-images:
name: Merge Deeploy GAP9 Images
runs-on: ubuntu-latest
needs: [prepare, build-deeploy-gap9]
steps:
- name: GHCR Log-in
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Lower Case Repository Name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ github.repository_owner }}"

- name: Merge Deeploy GAP9 Images
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9@${{ needs.build-deeploy-gap9.outputs.digest-amd64 }},
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9@${{ needs.build-deeploy-gap9.outputs.digest-arm64 }}
tags: |
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9:latest,
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9:${{ needs.prepare.outputs.docker_tag }}
push: true
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-deeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
env:
OWNER: "${{ github.repository_owner }}"

- name: Build and push final deploy image
- name: Build and push final Deeploy image
id: build
uses: docker/build-push-action@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/infra-generate-ccache-gap9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ name: Infrastructure • Generate CCache GAP9

jobs:
generate-ccache-gap9:
if: github.repository == 'pulp-platform/Deeploy'
runs-on: ubuntu-latest
container:
image: ${{ github.event.inputs.docker_image_deeploy || 'ghcr.io/pulp-platform/deeploy-gap9:latest' }}
Expand All @@ -39,7 +40,6 @@ jobs:
source /app/install/gap9-sdk/.gap9-venv/bin/activate
source /app/install/gap9-sdk/configs/gap9_evk_audio.sh || true
export GVSOC_INSTALL_DIR=/app/install/gap9-sdk/install/workstation
export GAP_RISCV_GCC_TOOLCHAIN=/app/install/gcc/gap9
cd DeeployTest
mkdir -p /app/.ccache
export CCACHE_DIR=/app/.ccache
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ install/
compile_commands.json
toolchain/**/*/


# Node
package.json
package-lock.json
Expand Down Expand Up @@ -52,3 +53,7 @@ DeeployTest/Tests/**/generateTest.py
DeeployTest/out.txt

CHANGELOG_GEN.md

# Container Artifacts
.pyusbip/
.cache/
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exclude: |
| .*TEST_.*
| .*TestFiles.*
| .*runtime.*
| .*\.patch
| .*prebuilt/.*
)

Expand Down Expand Up @@ -71,3 +72,7 @@ repos:
- id: yamllint
name: Lint YAML Files
stages: [pre-commit, pre-merge-commit, pre-push, manual]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.12.0-2
hooks:
- id: shfmt
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ This file contains the changelog for the Deeploy project. The changelog is divid


### List of Pull Requests
- Add GAP9 Container Support [#163](https://github.com/pulp-platform/Deeploy/pull/163)
- Extend Codeowners [#164](https://github.com/pulp-platform/Deeploy/pull/164)
- Support for MaxPool1D and RQSConv1D for PULPOpen [#146](https://github.com/pulp-platform/Deeploy/pull/146)
- Use Pre-Commit in CI [#159](https://github.com/pulp-platform/Deeploy/pull/159)
- Deeploy-GAP9 Platform [#143](https://github.com/pulp-platform/Deeploy/pull/143)
- Update CLI interface Across Project, Fix Tutorial, and Remove Legacy Test [#157](https://github.com/pulp-platform/Deeploy/pull/157)

### Added
- GAP9 Container Support with ARM64 architecture support
- `zsh` and `oh-my-zsh` plugin installation in containers
- Shell Format pre-commit hook
- Add integer MaxPool1D for Generic platform and RQSConv1D support for PULPOpen, with corresponding kernel tests.
- Added GAP9 Platform Support: Deployer, Bindings, Templates, Tiler, DMA (L3Dma/MchanDma), target library, CI workflows

### Changed
- Cleaned up Docker flow to use a temporary build folder
- Switch CI to use pre-commit for linting
- Update `pulp-nnx` and `pulp-nn-mixed` submodules to their latest versions
- PULP-NN moved to TargetLibraries third-party folder
Expand Down
26 changes: 26 additions & 0 deletions Container/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2025 ETH Zurich and University of Bologna
#
# SPDX-License-Identifier: Apache-2.0

export ZSH="$HOME/.oh-my-zsh"

# Prompt/theme selection.
ZSH_THEME="cypher"

# Keep plugin set minimal for faster shell startup.
plugins=(git)

# Load Oh My Zsh.
source $ZSH/oh-my-zsh.sh

# Quick edit shortcut for this file.
alias zshconfig="nano ~/.zshrc"

# Append and share history across sessions, without duplicates.
unsetopt HIST_SAVE_BY_COPY
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS

# Ensure GAP9 SDK 'gap' command is not shadowed by an alias.
unalias gap
35 changes: 26 additions & 9 deletions Container/Dockerfile.deeploy
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,26 @@ ARG TARGETPLATFORM

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PATH="/app/install/bender:${PATH}"
ENV DEEPLOY_INSTALL_DIR=/app/install
ENV LLVM_INSTALL_DIR=/app/install/llvm

WORKDIR /app
WORKDIR /app/build

# Make sure updates in the repo are reflected in the image
COPY toolchain/*.patch toolchain/
COPY Makefile ./
COPY requirements-dev.txt ./

# Compile emulators
# WIESEP: We need to already clean up some space, otherwise the GitHub runners run out of disk space
RUN --mount=type=cache,target=/ccache \
ccache -z && \
make pulp-sdk chimera-sdk qemu mempool banshee xtensor && \
make gvsoc && \
cp -r /app/toolchain/gvsoc/core/requirements.txt /app/core-requirements.txt && \
cp -r /app/toolchain/gvsoc/gapy/requirements.txt /app/gapy-requirements.txt && \
cp -r toolchain/gvsoc/core/requirements.txt /app/core-requirements.txt && \
cp -r toolchain/gvsoc/gapy/requirements.txt /app/gapy-requirements.txt && \
rm -rf toolchain/pulp-sdk toolchain/qemu toolchain/mempool toolchain/banshee toolchain/xtensor toolchain/xtl toolchain/xsimd toolchain/gvsoc && \
ccache -s

Expand All @@ -54,23 +56,28 @@ fi
# Compile Snitch Runtime
ENV CC="gcc"
ENV CXX="g++"
ENV PATH=/app/install/bender:${PATH}
RUN --mount=type=cache,target=/ccache \
ccache -z && \
make snitch_runtime && \
ccache -s

# Remove toolchain to make the container lighter
RUN rm -rf toolchain
WORKDIR /app
RUN rm -rf /app/build

########## Stage 2: Lightweight image with precompiled toolchain and emulators ##########
FROM ubuntu:22.04 AS deeploy

ARG TARGETPLATFORM
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

# Export symbols necessary for Deeploy's build flow
ENV CMAKE=/usr/bin/cmake
ENV DEEPLOY_INSTALL_DIR=/app/install
ENV PULP_SDK_HOME=/app/install/pulp-sdk
ENV SNITCH_HOME=/app/install/snitch_cluster
ENV CHIMERA_SDK_HOME=/app/install/chimera-sdk
Expand All @@ -83,7 +90,7 @@ ENV MEMPOOL_HOME=/app/install/mempool
ENV BENDER_INSTALL_DIR=/app/install/bender
ENV PATH=/app/install/qemu/bin:/app/install/banshee:/app/install/bender:$PATH

WORKDIR /app
WORKDIR /app/build

COPY pyproject.toml ./

Expand All @@ -99,7 +106,8 @@ RUN apt-get update && \
python-is-python3 \
python3.10-venv \
python3.10-distutils \
gcc && \
gcc \
zsh && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py && \
rm get-pip.py && \
Expand All @@ -118,10 +126,19 @@ elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
./cmake-3.24.0-linux-aarch64.sh --prefix=/usr --skip-license; \
fi

COPY Container/.zshrc ./
# # Install Oh My ZSH
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
cp .zshrc /root/.zshrc

COPY --from=toolchain /app/core-requirements.txt ./core-requirements.txt
COPY --from=toolchain /app/gapy-requirements.txt ./gapy-requirements.txt
COPY --from=toolchain /app/requirements-dev.txt ./
COPY requirements-dev.txt ./
RUN pip install -r requirements-dev.txt -r core-requirements.txt -r gapy-requirements.txt

# Copy pre-built toolchains and emulators
COPY --from=toolchain /app/install ./install
COPY --from=toolchain /app/install /app/install

# Remove unused files and clean up to reduce image size
WORKDIR /app
RUN rm -rf /app/build
Loading
Loading