-
Notifications
You must be signed in to change notification settings - Fork 1
/
.ci.yml
253 lines (227 loc) · 5.95 KB
/
.ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
image: $CI_IMAGE
.ace: &ace
tags: ['ace-x86_64']
.common_only: &common_only
only:
- main
- dev
- merge_requests
.build:
<<: *ace
<<: *common_only
stage: build
variables:
APP: app
ELF_PREFIX: kenning-zephyr-runtime
BOARDS: >
b_u585i_iot02a
stm32f746g_disco
hifive_unleashed
before_script:
- mkdir -p $HOME/.local/opt
- tar xzf env.tar.gz
- cp -r env/.venv .
- cp -r env/zephyr-sdk $HOME/.local/opt/
- cp -r env/zephyr-workspace/* ..
- cp -r env/zephyr-workspace/.west ..
- mkdir -p artifacts
script:
- |
source .venv/bin/activate
if [ "$RUNTIME" != "stub" ]
then
if [ "$LLEXT" = "y" ]
then
RUNTIME_CONF="llext_${RUNTIME}.conf;llext.conf"
RUNTIME="llext_${RUNTIME}"
else
RUNTIME_CONF="${RUNTIME}.conf"
fi
fi
for BOARD in ${BOARDS}
do
BOARD_NAME="${BOARD//\//_}"
python -m west build -p always -b ${BOARD} ${APP} -- -DEXTRA_CONF_FILE=${RUNTIME_CONF} ${EXTRA_ARGS}
cp build/zephyr/zephyr.elf artifacts/${ELF_PREFIX}-${RUNTIME}-${BOARD_NAME}.elf
done
dependencies:
- prepare-env
artifacts:
paths:
- artifacts/*.elf
when: always
.build-demo:
extends: .build
variables:
APP: demo_app
ELF_PREFIX: kenning-zephyr-runtime-demo
.build-llext:
extends: .build
variables:
LLEXT: y
BOARDS: >
b_u585i_iot02a
stm32f746g_disco
variables:
GIT_STRATEGY: clone
stages:
- lint
- prepare-env
- build
- tests
pre-commit:
<<: *ace
<<: *common_only
stage: lint
script:
- pre-commit run --all-files
prepare-env:
<<: *ace
<<: *common_only
stage: prepare-env
script:
- scripts/prepare_zephyr_env.sh
- scripts/prepare_modules.sh
- mkdir env
- mkdir env/zephyr-workspace
- cp -r .venv env
- cp -r $HOME/.local/opt/zephyr-sdk env
- cp -r ../.west env/zephyr-workspace
- cp -r ../dlpack env/zephyr-workspace
- cp -r ../iree env/zephyr-workspace
- cp -r ../modules env/zephyr-workspace
- cp -r ../tflite-micro env/zephyr-workspace
- cp -r ../tvm env/zephyr-workspace
- cp -r ../zephyr env/zephyr-workspace
- tar czf env.tar.gz env
artifacts:
paths:
- env.tar.gz
expire_in: 1 day
build-stub:
extends: .build
variables:
RUNTIME: stub
build-tvm:
extends: .build
variables:
RUNTIME: tvm
build-tflite:
extends: .build
variables:
RUNTIME: tflite
build-iree-vmvx:
extends: .build
variables:
RUNTIME: iree_vmvx
build-iree-embedded-elf:
extends: .build
variables:
RUNTIME: iree_embedded_elf
build-demo-tvm:
extends: .build-demo
variables:
RUNTIME: tvm
build-demo-tvm-int8:
extends: .build-demo
variables:
RUNTIME: tvm_int8
build-demo-tflite:
extends: .build-demo
variables:
RUNTIME: tflite
build-demo-tflite-int8:
extends: .build-demo
variables:
RUNTIME: tflite_int8
build-demo-iree-vmvx:
extends: .build-demo
variables:
RUNTIME: iree_vmvx
BOARDS: >
b_u585i_iot02a
hifive_unleashed
build-demo-iree-embedded-elf:
extends: .build-demo
variables:
RUNTIME: iree_embedded_elf
BOARDS: >
b_u585i_iot02a
build-demo-tvm-gen-model:
extends: .build-demo
variables:
RUNTIME: tvm_gen
ELF_PREFIX: kenning-zephyr-runtime-demo-gen-model
EXTRA_ARGS: -DCONFIG_KENNING_MODEL_PATH="https://dl.antmicro.com/kenning/models/classification/magic_wand.h5"
BOARDS: >
stm32f746g_disco
build-repl:
extends: .build
script:
- |
source .venv/bin/activate
for BOARD in ${BOARDS}
do
BOARD_NAME="${BOARD//\//_}"
python -m west build -p always -b ${BOARD} demo_app || true
python -m west build -t board-repl
cp build/*.repl artifacts/${BOARD_NAME}.repl
done
artifacts:
paths:
- artifacts/*.repl
when: always
build-llext-tvm:
extends: .build-llext
variables:
RUNTIME: tvm
test-demo:
<<: *ace
<<: *common_only
stage: tests
script:
- python -m pytest -ra -vvv --color=yes --report-log=log.json ./tests/demo/test_demo.py
dependencies:
- build-demo-tvm
- build-demo-tvm-int8
- build-demo-tflite
- build-demo-tflite-int8
- build-demo-iree-vmvx
- build-demo-iree-embedded-elf
- build-demo-tvm-gen-model
- build-repl
artifacts:
paths:
- log.json
when: always
unit-tests:
<<: *ace
<<: *common_only
stage: tests
before_script:
- mkdir -p $HOME/.local/opt
- tar xzf env.tar.gz
- cp -r env/.venv .
- cp -r env/zephyr-sdk $HOME/.local/opt/
- cp -r env/zephyr-workspace/* ..
- cp -r env/zephyr-workspace/.west ..
script:
- source .venv/bin/activate
- python -m west twister -T tests -p unit_testing
dependencies:
- prepare-env
artifacts:
paths:
- twister-out/unit_testing/lib/kenning_inference_lib/**/*.log
when: always
tuttest:
<<: *ace
<<: *common_only
image: debian:bookworm
stage: tests
script:
- DEBIAN_FRONTEND=noninteractive apt update -qqy && apt-get install -y sudo python3 python3-pip git colorized-logs
- rm /usr/lib/python3.11/EXTERNALLY-MANAGED
- python3 -m pip install setuptools pip
- python3 -m pip install git+https://github.com/antmicro/tuttest.git
- ./scripts/test_readme.sh