-
Notifications
You must be signed in to change notification settings - Fork 84
369 lines (338 loc) · 18.1 KB
/
cmake_x86_vsim.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
name: cmake_x86_vsim
on:
pull_request:
branches: [ main ]
workflow_dispatch:
branches: [ main ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
LD_LIBRARY_PATH: ${{github.workspace}}/tim-vx-install/prebuilt-sdk/x86_64_linux/lib:${{github.workspace}}/tim-vx-install/build/lib:${{github.workspace}}/tim-vx-install/tim-vx.install.dir/lib
VIVANTE_SDK_DIR: ${{github.workspace}}/tim-vx-install/prebuilt-sdk/x86_64_linux/
VSI_NN_LOG_LEVEL: 5
VSIMULATOR_CONFIG: VIP9000NANOS_PID0XC5
jobs:
tim-vx-build:
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTIM_VX_ENABLE_TEST=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/tim-vx.install.dir/ -DTIM_VX_BUILD_EXAMPLES=ON -DTIM_VX_ENABLE_PLATFORM=ON -DTIM_VX_ENABLE_CUSTOM_OP=ON
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: tvx-install
run: |
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: upload tim-vx-install
uses: actions/upload-artifact@v3
with:
name: tim-vx-install
path: |
${{github.workspace}}/prebuilt-sdk
${{github.workspace}}/build/lib
${{github.workspace}}/tim-vx.install.dir/
${{github.workspace}}/.github/
tim-vx-build-clang:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
env:
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@v2
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTIM_VX_ENABLE_TEST=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/tim-vx.install.dir/
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# default unit-test
tim-vx-unit-test:
needs: tim-vx-build
runs-on: ubuntu-latest
env:
LD_LIBRARY_PATH: ${{github.workspace}}/prebuilt-sdk/x86_64_linux/lib:${{github.workspace}}/build/lib:${{github.workspace}}/tim-vx.install.dir/lib
VIVANTE_SDK_DIR: ${{github.workspace}}/prebuilt-sdk/x86_64_linux/
steps:
- name: download tim-vx build output
uses: actions/download-artifact@v3
with:
name: tim-vx-install
- name: tim-vx.unit-test.x86.vsim
run: |
cd ${{github.workspace}}/tim-vx.install.dir/bin
chmod u+x ./unit_test
./unit_test --gtest_also_run_disabled_tests
- name: tim-vx.samples
run: |
cd ${{github.workspace}}/tim-vx.install.dir/bin
chmod u+x multi_thread_test
chmod u+x lenet_multi_device
./multi_thread_test
./lenet_multi_device
# cl-only test
tim-vx-unit-test-cl:
needs: tim-vx-build
runs-on: ubuntu-latest
env:
LD_LIBRARY_PATH: ${{github.workspace}}/prebuilt-sdk/x86_64_linux/lib:${{github.workspace}}/build/lib:${{github.workspace}}/tim-vx.install.dir/lib
VIVANTE_SDK_DIR: ${{github.workspace}}/prebuilt-sdk/x86_64_linux/
VIV_VX_DISABLE_TP_NN_EVIS: 1
steps:
- name: download tim-vx build output
uses: actions/download-artifact@v3
with:
name: tim-vx-install
- name: tim-vx.unit-test.x86.vsim
run: |
cd ${{github.workspace}}/tim-vx.install.dir/bin
chmod u+x ./unit_test
./unit_test
vx-delegate-build:
runs-on: ubuntu-latest
needs: tim-vx-build
steps:
- name: download tim-vx build output
uses: actions/download-artifact@v3
with:
name: tim-vx-install
- name: apply-patch-build
run: |
git config --global user.email "[email protected]"
git config --global user.name "xiang.zhang"
git clone https://github.com/tensorflow/tensorflow.git ${{github.workspace}}/3rd-party/tensorflow && cd ${{github.workspace}}/3rd-party/tensorflow/ && git checkout v2.10.0
git clone https://github.com/VeriSilicon/tflite-vx-delegate.git ${{github.workspace}}/vx-delegate
cmake -B ${{github.workspace}}/vx-delegate/build -S ${{github.workspace}}/vx-delegate -DFETCHCONTENT_SOURCE_DIR_TENSORFLOW=${{github.workspace}}/3rd-party/tensorflow -DTIM_VX_INSTALL=${{github.workspace}}/tim-vx.install.dir/ -DTFLITE_ENABLE_NNAPI=OFF -DTFLITE_ENABLE_XNNPACK=OFF
cmake --build ${{github.workspace}}/vx-delegate/build --config ${{env.BUILD_TYPE}}
cd ${{github.workspace}}/vx-delegate/build
make vx_delegate benchmark_model
- name: upload vx-delegate
uses: actions/upload-artifact@v3
with:
name: vx-delegate-bin
path: |
${{github.workspace}}/vx-delegate/build/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate/build/libvx_delegate.so
# AI-Benchmark 5.0.1 model zoo
mobilenet_v2_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download binary
uses: actions/download-artifact@v3
- name: download mobilenet_v2_quant.tflite
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/mobilenet_v2_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/mobilenet_v2_quant.tflite
mobilenet_v2_b8_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download binary
uses: actions/download-artifact@v3
- name: download mobilenet_v2_b8_quant.tflite
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/mobilenet_v2_b8_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/mobilenet_v2_b8_quant.tflite
resnet_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download resnet_quant.tflite
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/resnet_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/resnet_quant.tflite
inception_v3_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/inception_v3_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/inception_v3_quant.tflite
mobilenet_v3_b4_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/mobilenet_v3_b4_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/mobilenet_v3_b4_quant.tflite
mobilenet_v3_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/mobilenet_v3_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/mobilenet_v3_quant.tflite
mv3_depth_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/mv3_depth_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/mv3_depth_quant.tflite
yolo_v4_tiny_quant:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/yolo_v4_tiny_quant.tflite
- name: benchmark_model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/yolo_v4_tiny_quant.tflite
# Disable huge compilation cost
# deeplab_v3_plus_quant:
# runs-on: ubuntu-latest
# needs: [vx-delegate-build, tim-vx-unit-test]
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/deeplab_v3_plus_quant.tflite
# - name: benchmark_model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/deeplab_v3_plus_quant.tflite
# Tensorflow Hub
# tfhub-movenet-multipose:
# runs-on: ubuntu-latest
# needs: vx-delegate-build
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# wget https://storage.googleapis.com/tfhub-lite-models/google/lite-model/movenet/multipose/lightning/tflite/float16/1.tflite
# mv 1.tflite tfhub.movenet.multipose.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/tfhub.movenet.multipose.tflite
tfhub-efficientdet-lite0:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite0/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
tfhub-efficientdet-lite1:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite1/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
tfhub-efficientdet-lite2:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
tfhub-efficientdet-lite3:
runs-on: ubuntu-latest
needs: [vx-delegate-build, tim-vx-unit-test]
steps:
- name: download test binary
uses: actions/download-artifact@v3
- name: download model
run: |
wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1.tflite
- name: benchmark-model
run: |
chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite
# acuity-yolov3-608-quant:
# runs-on: ubuntu-latest
# needs: [vx-delegate-build, tim-vx-unit-test]
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# curl -LJO https://github.com/sunshinemyson/TIM-VX/releases/download/v1.1.30.2/yolov3_608relu_quant.acuity.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/yolov3_608relu_quant.acuity.tflite
# Graph compilation time is huge over 20mins
# tfhub-efficientdet-lite4:
# runs-on: ubuntu-latest
# needs: vx-delegate-build
# steps:
# - name: download test binary
# uses: actions/download-artifact@v3
# - name: download model
# run: |
# wget https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/efficientdet/lite4/detection/metadata/1.tflite
# - name: benchmark-model
# run: |
# chmod u+x ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model
# ${{github.workspace}}/vx-delegate-bin/_deps/tensorflow-build/tools/benchmark/benchmark_model --num_runs=1 --external_delegate_path=${{github.workspace}}/vx-delegate-bin/libvx_delegate.so --graph=${{github.workspace}}/1.tflite