@@ -16,12 +16,16 @@ script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
16
16
et_dir=$( realpath $script_dir /../..)
17
17
ARCH=" $( uname -m) "
18
18
OS=" $( uname -s) "
19
- root_dir=" ${script_dir} /ethos-u-scratch"
19
+ root_dir=" ${script_dir} /ethos-u-scratch" # TODO: rename
20
20
eula_acceptance=0
21
- skip_toolchain_setup=0
21
+ enable_baremetal_toolchain=1
22
22
target_toolchain=" "
23
- skip_fvp_setup=0
24
- skip_vela_setup=0
23
+ enable_fvps=1
24
+ enable_vela=1
25
+ enable_model_converter=0 # model-converter tool for VGF output
26
+ enable_vgf_lib=0 # vgf reader - runtime backend dependency
27
+ enable_emulation_layer=0 # Vulkan layer driver - emulates Vulkan ML extensions
28
+ mlsdk_manifest_url=" "
25
29
26
30
27
31
# Figure out if setup.sh was called or sourced and save it into "is_script_sourced"
54
58
echo " [main] Error: only x86-64 & aarch64/arm64 architecture is supported for now!" ; exit 1;
55
59
fi
56
60
57
- # vela
61
+ # Vela
58
62
vela_repo_url=" https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela"
59
63
vela_rev=" 8cac2b9a7204b57125a8718049519b091a98846c"
60
64
65
+ # MLSDK dependencies
66
+ mlsdk_manifest_dir=" ml-sdk-for-vulkan-manifest"
67
+
68
+ # List of supported options and their descriptions
69
+ OPTION_LIST=(
70
+ " --i-agree-to-the-contained-eula (required) Agree to the EULA"
71
+ " --root-dir Path to scratch directory"
72
+ " --enable-baremetal-toolchain Enable baremetal toolchain setup"
73
+ " --enable-fvps Enable FVP setup"
74
+ " --enable-vela Enable VELA setup"
75
+ " --enable-model-converter Enable MLSDK model converter setup"
76
+ " --enable-vgf-lib Enable MLSDK vgf library setup"
77
+ " --enable-emulation-layer Enable MLSDK Vulkan emulation layer"
78
+ " --disable-ethos-u-deps Do not setup what is needed for Ethos-U"
79
+ " --enable-mlsdk-deps Setup what is needed for MLSDK"
80
+ " --mlsdk-manifest-url URL to the MLSDK manifest for vulkan."
81
+ " --help Display help"
82
+ )
83
+
84
+
61
85
# #######
62
86
# ## Functions
63
87
# #######
64
88
65
89
function print_usage() {
66
- echo " Usage: $( basename $0 ) <--i-agree-to-the-contained-eula> [--root-dir path-to-a-scratch-dir] [--target-toolchain toolchain name] [--skip-fvp-setup] [--skip-toolchain-setup] [--skip-vela-setup]"
90
+ echo " Usage: $( basename " $0 " ) [OPTIONS]"
91
+ echo
92
+ echo " Available options:"
93
+ for entry in " ${OPTION_LIST[@]} " ; do
94
+ opt=" ${entry%% * } "
95
+ desc=" ${entry#* } "
96
+ printf " %-40s %s\n" " $opt " " $desc "
97
+ done
98
+ echo
67
99
echo " Supplied args: $* "
68
100
}
69
101
@@ -87,8 +119,8 @@ function check_options() {
87
119
exit 1
88
120
fi
89
121
;;
90
- --skip-toolchain-setup )
91
- skip_toolchain_setup =1
122
+ --enable-baremetal-toolchain )
123
+ enable_baremetal_toolchain =1
92
124
shift
93
125
;;
94
126
--target-toolchain)
@@ -104,14 +136,49 @@ function check_options() {
104
136
exit 1
105
137
fi
106
138
;;
107
- --skip-fvp-setup)
108
- skip_fvp_setup=1
139
+ --enable-fvps)
140
+ enable_fvps=1
141
+ shift
142
+ ;;
143
+ --enable-vela)
144
+ enable_vela=1
145
+ shift
146
+ ;;
147
+ --enable-model-converter)
148
+ enable_model_converter=1
149
+ shift
150
+ ;;
151
+ --enable-vgf-lib)
152
+ enable_vgf_lib=1
109
153
shift
110
154
;;
111
- --skip-vela-setup )
112
- skip_vela_setup =1
155
+ --enable-emulation-layer )
156
+ enable_emulation_layer =1
113
157
shift
114
158
;;
159
+ --disable-ethos-u-deps)
160
+ enable_baremetal_toolchain=0
161
+ enable_fvps=0
162
+ enable_vela=0
163
+ shift
164
+ ;;
165
+ --enable-mlsdk-deps)
166
+ enable_model_converter=1
167
+ enable_vgf_lib=1
168
+ enable_emulation_layer=1
169
+ shift
170
+ ;;
171
+ --mlsdk-manifest-url)
172
+ # Ensure that there is a url provided.
173
+ if [[ -n " $2 " && " ${2: 0: 1} " != " -" ]]; then
174
+ mlsdk_manifest_url=" $2 "
175
+ shift 2
176
+ else
177
+ echo " Error: --mlsdk-manifest-url requires a URL argument."
178
+ print_usage " $@ "
179
+ exit 1
180
+ fi
181
+ ;;
115
182
--help)
116
183
print_usage " $@ "
117
184
exit 0
@@ -267,7 +334,7 @@ function create_setup_path(){
267
334
268
335
echo " " > " ${setup_path_script} "
269
336
270
- if [[ " ${skip_fvp_setup } " -eq 0 ]]; then
337
+ if [[ " ${enable_fvps } " -eq 1 ]]; then
271
338
fvps=(" corstone300" " corstone320" )
272
339
for fvp in " ${fvps[@]} " ; do
273
340
model_dir_variable=${fvp} _model_dir
@@ -284,10 +351,29 @@ function create_setup_path(){
284
351
echo " hash FVP_Corstone_SSE-320" >> ${setup_path_script}
285
352
fi
286
353
287
- if [[ " ${skip_toolchain_setup } " -eq 0 ]]; then
354
+ if [[ " ${enable_baremetal_toolchain } " -eq 1 ]]; then
288
355
toolchain_bin_path=" $( cd ${toolchain_dir} /bin && pwd) "
289
356
echo " export PATH=\$ {PATH}:${toolchain_bin_path} " >> ${setup_path_script}
290
357
fi
358
+
359
+ if [[ " ${enable_model_converter} " -eq 1 ]]; then
360
+ cd " ${root_dir} "
361
+ model_converter_bin_path=" $( cd ${mlsdk_manifest_dir} /sw/model-converter/build && pwd) "
362
+ echo " export PATH=\$ {PATH}:${model_converter_bin_path} " >> ${setup_path_script}
363
+ fi
364
+
365
+ # Add Path for vgf-lib and emulation-layer
366
+ if [[ " ${enable_vgf_lib} " -eq 1 ]]; then
367
+ cd " ${root_dir} "
368
+ model_vgf_lib_bin_path=" $( cd ${mlsdk_manifest_dir} /sw/vgf-lib/build && pwd) "
369
+ echo " export PATH=\$ {PATH}:${model_vgf_lib_bin_path} " >> ${setup_path_script}
370
+ fi
371
+
372
+ if [[ " ${enable_emulation_layer} " -eq 1 ]]; then
373
+ cd " ${root_dir} "
374
+ model_emulation_layer_bin_path=" $( cd ${mlsdk_manifest_dir} /sw/vgf-lib/build && pwd) "
375
+ echo " export PATH=\$ {PATH}:${model_emulation_layer_bin_path} " >> ${setup_path_script}
376
+ fi
291
377
}
292
378
293
379
function check_platform_support() {
@@ -318,10 +404,14 @@ if [[ $is_script_sourced -eq 0 ]]; then
318
404
setup_root_dir
319
405
cd " ${root_dir} "
320
406
echo " [main] Using root dir ${root_dir} and options:"
321
- echo " skip-fvp-setup =${skip_fvp_setup } "
407
+ echo " enable-fvps =${enable_fvps } "
322
408
echo " target-toolchain=${target_toolchain} "
323
- echo " skip-toolchain-setup=${skip_toolchain_setup} "
324
- echo " skip-vela-setup=${skip_vela_setup} "
409
+ echo " enable-baremetal-toolchain=${enable_baremetal_toolchain} "
410
+ echo " enable-model-converter=${enable_model_converter} "
411
+ echo " enable-vgf-lib=${enable_vgf_lib} "
412
+ echo " enable-emulation-layer=${enable_emulation_layer} "
413
+ echo " enable-vela=${enable_vela} "
414
+ echo " mlsdk-manifest-url=${mlsdk_manifest_url} "
325
415
326
416
# Import utils
327
417
source $et_dir /backends/arm/scripts/utils.sh
@@ -330,25 +420,42 @@ if [[ $is_script_sourced -eq 0 ]]; then
330
420
select_toolchain
331
421
332
422
# Setup toolchain
333
- if [[ " ${skip_toolchain_setup } " -eq 0 ]]; then
423
+ if [[ " ${enable_baremetal_toolchain } " -eq 1 ]]; then
334
424
setup_toolchain
335
425
fi
336
426
337
427
# Setup FVP
338
- if [[ " ${skip_fvp_setup } " -eq 0 ]]; then
428
+ if [[ " ${enable_fvps } " -eq 1 ]]; then
339
429
setup_fvp
340
430
fi
341
431
432
+
433
+ if [[ -z " $mlsdk_manifest_url " && " ${enable_model_converter} " -eq 1 ]]; then
434
+ echo " Warning: mlsdk-manifest-url is not set, but model converter setup is not skipped."
435
+ echo " Please set the --mlsdk-manifest-url option to the correct URL."
436
+ echo " Skipping MLSDK model converter setup."
437
+ enable_model_converter=0 # Q: Can we assume if we enable mlsdk, we will always enable model converter
438
+ enable_vgf_lib=0
439
+ enable_emulation_layer=0
440
+ fi
441
+
442
+ if [[ " ${enable_model_converter} " -eq 1 ]]; then
443
+ source $et_dir /backends/arm/scripts/mlsdk_utils.sh -u " ${mlsdk_manifest_url} "
444
+ setup_model_converter ${root_dir} ${mlsdk_manifest_dir} ${enable_vgf_lib} ${enable_emulation_layer}
445
+ fi
446
+
342
447
# Create new setup_path script
343
- if [[ " ${skip_toolchain_setup} " -eq 0 || " ${skip_fvp_setup} " -eq 0 ]]; then
448
+ if [[ " ${enable_baremetal_toolchain} " -eq 1 || \
449
+ " ${enable_fvps} " -eq 1 || \
450
+ " ${enable_model_converter} " -eq 1 ]]; then
344
451
create_setup_path
345
452
fi
346
453
347
454
# Setup the tosa_reference_model
348
455
$et_dir /backends/arm/scripts/install_reference_model.sh ${root_dir}
349
456
350
457
# Setup vela and patch in codegen fixes
351
- if [[ " ${skip_vela_setup } " -eq 0 ]]; then
458
+ if [[ " ${enable_vela } " -eq 1 ]]; then
352
459
setup_vela
353
460
fi
354
461
0 commit comments