Skip to content

Commit 8290f21

Browse files
authored
Release v22.12 (#2)
Signed-off-by: Josh Minor <[email protected]>
1 parent 2b534a5 commit 8290f21

18 files changed

+858
-564
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ build
22
install
33
.vscode
44
.gitignore
5-
Dockerfile
5+
Dockerfile
6+
/qa

.github/workflows/build.yml

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
tags: ["v*.*"]
7+
pull_request:
8+
types: [opened, reopened, synchronize, ready_for_review]
9+
paths:
10+
- "src/**"
11+
- "qa/**"
12+
- "patches/**"
13+
- "cmake/**"
14+
- "CMakeLists.txt"
15+
workflow_dispatch:
16+
inputs:
17+
build_type:
18+
description: "Cmake build type"
19+
required: true
20+
default: Release
21+
type: choice
22+
options:
23+
- Release
24+
- Debug
25+
- RelWithDebInfo
26+
- MinSizeRel
27+
triton_branch:
28+
description: "Triton container version to use in build and test"
29+
required: true
30+
default: main
31+
type: string
32+
enable_mali:
33+
description: "Enable Mali GPU in build"
34+
required: true
35+
default: OFF
36+
type: choice
37+
options:
38+
- OFF
39+
- ON
40+
enable_ruy:
41+
description: "Enable RUY in build"
42+
required: true
43+
default: ON
44+
type: choice
45+
options:
46+
- OFF
47+
- ON
48+
enable_bazel:
49+
description: "Enable Mali GPU in build"
50+
required: true
51+
default: OFF
52+
type: choice
53+
options:
54+
- OFF
55+
- ON
56+
enable_flex_ops:
57+
description: "Enable Flex Ops in build"
58+
required: true
59+
default: OFF
60+
type: choice
61+
options:
62+
- OFF
63+
- ON
64+
tflite_tag:
65+
description: "TFLite tag to build against"
66+
required: true
67+
default: v2.4.1
68+
type: string
69+
armnn_tag:
70+
description: "ArmNN tag to build against"
71+
required: true
72+
default: v22.08
73+
type: string
74+
enable_armnn_delegate:
75+
description: "Enable ArmNN Delegate in build"
76+
required: true
77+
default: OFF
78+
type: choice
79+
options:
80+
- OFF
81+
- ON
82+
83+
env:
84+
BUILD_TYPE: ${{ inputs.build_type || 'Release' }}
85+
DEBIAN_FRONTEND: noninteractive
86+
CMAKE_VERSION: 3.21.1
87+
TRITON_REPO_TAG: ${{ inputs.triton_branch || 'main' }}
88+
TRITON_ENABLE_MALI_GPU: ${{ inputs.enable_mali || 'OFF' }}
89+
TFLITE_ENABLE_RUY: ${{ inputs.enable_ruy || 'ON' }}
90+
TFLITE_BAZEL_BUILD: ${{ inputs.enable_bazel || 'OFF' }}
91+
TFLITE_ENABLE_FLEX_OPS: ${{ inputs.enable_flex_ops || 'OFF' }}
92+
TFLITE_TAG: ${{ inputs.tflite_tag || 'v2.4.1' }}
93+
ARMNN_TAG: ${{ inputs.armnn_tag || 'v22.08' }}
94+
ARMNN_DELEGATE_ENABLE: ${{ inputs.enable_armnn_delegate || 'ON' }}
95+
96+
jobs:
97+
build:
98+
strategy:
99+
fail-fast: false
100+
matrix:
101+
include:
102+
- platform: [self-hosted, x86_64]
103+
arch: amd64
104+
- platform: [self-hosted, ARM64]
105+
arch: arm64
106+
runs-on: ${{ matrix.platform }}
107+
outputs:
108+
triton_image: ${{ steps.set_image.outputs.triton_image }}
109+
container: ubuntu:20.04
110+
111+
steps:
112+
- uses: actions/checkout@v3
113+
with:
114+
fetch-depth: 0
115+
116+
# Set the image to be used during the test job
117+
- id: set_image
118+
run: echo "triton_image=ghcr.io/smarter-project/armnn_tflite_backend/triton:${{env.TRITON_REPO_TAG}}" >> $GITHUB_OUTPUT
119+
120+
- name: Install build tools
121+
run: |
122+
apt update
123+
apt install -yqq --no-install-recommends \
124+
build-essential \
125+
git \
126+
wget \
127+
scons \
128+
ca-certificates \
129+
curl \
130+
autoconf \
131+
libtool \
132+
python3-dev \
133+
python3-pip \
134+
python3-numpy \
135+
libssl-dev \
136+
zlib1g-dev \
137+
zip \
138+
unzip \
139+
xxd \
140+
rapidjson-dev \
141+
ccache \
142+
software-properties-common \
143+
cppcheck
144+
145+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
146+
gpg --dearmor - | \
147+
tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
148+
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
149+
apt-get update
150+
apt-get install -y --no-install-recommends \
151+
cmake-data=${CMAKE_VERSION}-0kitware1ubuntu20.04.1 cmake=${CMAKE_VERSION}-0kitware1ubuntu20.04.1
152+
pip3 install -U pip wheel
153+
154+
- name: Install Bazel
155+
if: ${{ env.TFLITE_BAZEL_BUILD == 'ON' }}
156+
run: |
157+
wget -O bazel-3.1.0-dist.zip https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel-3.1.0-dist.zip
158+
unzip -d bazel bazel-3.1.0-dist.zip
159+
cd bazel
160+
ln -s /usr/bin/python3 /usr/bin/python
161+
env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh
162+
cp output/bazel /usr/bin/bazel
163+
164+
- name: ccache
165+
uses: hendrikmuhs/[email protected]
166+
167+
- name: Configure CMake
168+
run: |
169+
cmake -B build \
170+
-DCMAKE_INSTALL_PREFIX=$(pwd)/install \
171+
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
172+
-DTRITON_ENABLE_GPU=OFF \
173+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
174+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
175+
-DTRITON_BACKEND_REPO_TAG=${{env.TRITON_REPO_TAG}} \
176+
-DTRITON_CORE_REPO_TAG=${{env.TRITON_REPO_TAG}} \
177+
-DTRITON_COMMON_REPO_TAG=${{env.TRITON_REPO_TAG}} \
178+
-DTRITON_ENABLE_GPU=OFF \
179+
-DTRITON_ENABLE_MALI_GPU=${{env.TRITON_ENABLE_MALI_GPU}} \
180+
-DTFLITE_ENABLE_RUY=${{env.TFLITE_ENABLE_RUY}} \
181+
-DTFLITE_BAZEL_BUILD=${{env.TFLITE_BAZEL_BUILD}} \
182+
-DTFLITE_ENABLE_FLEX_OPS=${{env.TFLITE_ENABLE_FLEX_OPS}} \
183+
-DTFLITE_TAG=${{env.TFLITE_TAG}} \
184+
-DARMNN_TAG=${{env.ARMNN_TAG}} \
185+
-DARMNN_DELEGATE_ENABLE=${{env.ARMNN_DELEGATE_ENABLE}} \
186+
-DACL_TAG=${{env.ARMNN_TAG}} \
187+
-DJOBS=$(nproc)
188+
189+
- name: Cmake build
190+
run: cmake --build build -j $(nproc) -t install
191+
192+
- name: ccache statistics
193+
run: |
194+
ccache -s
195+
196+
- name: Upload Backend Artifact
197+
uses: actions/upload-artifact@v3
198+
with:
199+
path: install/backends/armnn_tflite
200+
name: armnn_tflite_backend_${{ matrix.arch }}
201+
if-no-files-found: error
202+
203+
test:
204+
strategy:
205+
matrix:
206+
include:
207+
- platform: [self-hosted, x86_64]
208+
arch: amd64
209+
- platform: [self-hosted, ARM64]
210+
arch: arm64
211+
runs-on: ${{ matrix.platform }}
212+
213+
# Make sure we have run the build step first
214+
needs: [build]
215+
216+
# We will install testing tools and run tests from within the context of the tritonserver image
217+
container:
218+
image: ${{ needs.build.outputs.triton_image }}_${{ matrix.arch }}
219+
credentials:
220+
username: ${{ github.actor }}
221+
password: ${{ secrets.GITHUB_TOKEN }}
222+
223+
steps:
224+
- uses: actions/checkout@v3
225+
226+
# Fetch the built backend from the artifact
227+
- name: Download armnn_tflite_backend
228+
uses: actions/download-artifact@v3
229+
with:
230+
name: armnn_tflite_backend_${{ matrix.arch }}
231+
path: armnn_tflite
232+
233+
- name: Display structure of downloaded files
234+
run: ls -R armnn_tflite
235+
236+
- name: Make armnn triton backend available
237+
run: cp -r armnn_tflite /opt/tritonserver/backends/armnn_tflite
238+
239+
- name: Install test dependencies
240+
run: |
241+
apt update
242+
apt install -yqq --no-install-recommends libssl-dev zlib1g-dev rapidjson-dev python3-dev python3-pip wget build-essential git
243+
python3 -m pip install --upgrade pip setuptools wheel
244+
python3 -m pip install --upgrade grpcio-tools
245+
python3 -m pip install --upgrade numpy pillow attrdict future grpcio requests gsutil awscli six grpcio-channelz
246+
python3 -m pip install --upgrade tritonclient[all]
247+
python3 -m pip install --upgrade pytest pytest-xdist pytest-xprocess jinja2
248+
249+
- name: Run Tests
250+
run: |
251+
cd qa
252+
wget -q https://images.getsmarter.io/ml-models/armnn_tflite_backend_triton_model_repo.tar.gz
253+
tar -xzf armnn_tflite_backend_triton_model_repo.tar.gz
254+
python3 -m pytest -v tests/ --model-repo-path $(pwd)/triton_qa_models/accuracy_test_model_repo --triton-path /opt/tritonserver/bin/tritonserver --backend-directory /opt/tritonserver/backends

.github/workflows/triton_build.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Triton Build and Push
2+
3+
on:
4+
schedule:
5+
- cron: "19 16 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
# This job only outputs triton branches for r22.X and beyond
10+
get_triton_branches:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Login to GitHub Container Registry
14+
uses: docker/login-action@v2
15+
with:
16+
registry: ghcr.io
17+
username: ${{ github.actor }}
18+
password: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Set Triton branches to build
21+
id: set-branches
22+
shell: bash
23+
run: |
24+
git clone https://github.com/triton-inference-server/server
25+
cd server
26+
readarray -d '' -t branches < <( git branch -r --list | grep -E 'r2[2-9]+\.[0-9]+$' | tr '\n' ' ')
27+
branches+=("origin/main")
28+
echo "All branches: ${branches[@]}"
29+
declare -a branches_to_build
30+
for branch in ${branches[@]}; do
31+
echo "Checking out branch $branch"
32+
git checkout $branch
33+
stripped_branch_name=$(echo $branch | sed 's/origin\///')
34+
commit_sha=$(git rev-parse HEAD | cut -c 1-8)
35+
image_base=ghcr.io/smarter-project/armnn_tflite_backend/triton:${commit_sha}
36+
echo "Checking image name: $image_base"
37+
38+
if docker manifest inspect ${image_base}_arm64 &> /dev/null && docker manifest inspect ${image_base}_amd64 &> /dev/null; then
39+
echo "Image already found for $image_base"
40+
else
41+
branches_to_build+=($stripped_branch_name)
42+
fi
43+
44+
done
45+
echo triton_branches=$(echo "[$(printf "\"%s\", " "${branches_to_build[@]}")]") >> $GITHUB_OUTPUT
46+
47+
- name: Show triton branches
48+
run: |
49+
echo ${{ steps.set-branches.outputs.triton_branches }}
50+
outputs:
51+
triton_branches: ${{ steps.set-branches.outputs.triton_branches }}
52+
53+
build:
54+
needs: get_triton_branches
55+
strategy:
56+
matrix:
57+
branch: ${{ fromJson(needs.get_triton_branches.outputs.triton_branches) }}
58+
build_arch:
59+
[
60+
{ platform: [self-hosted, x86_64], arch: amd64 },
61+
{ platform: [self-hosted, ARM64], arch: arm64 },
62+
]
63+
runs-on: ${{ matrix.build_arch.platform }}
64+
permissions:
65+
packages: write
66+
container:
67+
image: ubuntu:22.04
68+
volumes:
69+
- /var/run/docker.sock:/var/run/docker.sock
70+
71+
steps:
72+
- name: Install deps
73+
run: |
74+
apt update
75+
apt install -yqq --no-install-recommends \
76+
ca-certificates \
77+
curl \
78+
gnupg \
79+
lsb-release \
80+
python3-dev \
81+
python3-pip \
82+
git
83+
pip3 install docker
84+
85+
- name: Install docker cli
86+
run: |
87+
mkdir -p /etc/apt/keyrings
88+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
89+
echo \
90+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
91+
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
92+
apt update
93+
apt install -yqq --no-install-recommends docker-ce-cli
94+
95+
- name: Login to GitHub Container Registry
96+
uses: docker/login-action@v2
97+
with:
98+
registry: ghcr.io
99+
username: ${{ github.actor }}
100+
password: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Build and Push Triton
103+
shell: bash
104+
run: |
105+
rm -rf server || true
106+
git clone -b ${{ matrix.branch }} https://github.com/triton-inference-server/server
107+
cd server
108+
commit_sha=$(git rev-parse HEAD | cut -c 1-8)
109+
image_name=ghcr.io/smarter-project/armnn_tflite_backend/triton:${commit_sha}_${{ matrix.build_arch.arch }}
110+
script -e -c "./build.py --build-dir=/tmp/citritonbuild --enable-logging --enable-stats --enable-tracing --enable-metrics --endpoint=http --endpoint=grpc --backend=identity" || \
111+
script -e -c "./build.py --enable-logging --enable-stats --enable-tracing --enable-metrics --endpoint=http --endpoint=grpc --backend=identity"
112+
docker tag tritonserver:latest $image_name
113+
branch_tag_name=$(echo ${{ matrix.branch }} | sed 's/origin\///')_${{ matrix.build_arch.arch }}
114+
docker tag tritonserver:latest ghcr.io/smarter-project/armnn_tflite_backend/triton:$branch_tag_name
115+
docker push $image_name
116+
docker push ghcr.io/smarter-project/armnn_tflite_backend/triton:$branch_tag_name

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@
44
*.so
55
**/__pycache__
66
**/*.pyc
7+
/deps
8+
/.devcontainer
9+
/**/triton_qa_models
10+
/**/armnn_tflite_backend_triton_model_repo.tar.gz
11+

0 commit comments

Comments
 (0)