ARM-software / armnn

Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
https://developer.arm.com/products/processors/machine-learning/arm-nn
MIT License
1.17k stars 309 forks source link

Delegate fails on RaspiOS Buster #647

Closed StuartIanNaylor closed 2 years ago

StuartIanNaylor commented 2 years ago

Using the binaries as in https://github.com/ARM-software/ComputeLibrary#pre-built-binaries On RaspiOS Bullseye the latest release and tutorial release load but end with a seg fault. Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT aarch64 GNU/Linux PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"

Info: ArmNN v27.0.0

Can't load libOpenCL.so: libOpenCL.so: cannot open shared object file: No such file or directory
Can't load libGLES_mali.so: libGLES_mali.so: cannot open shared object file: No such file or directory
Can't load libmali.so: libmali.so: cannot open shared object file: No such file or directory
Couldn't find any OpenCL library.
Info: Initialization time: 1.73 ms

INFO: TfLiteArmnnDelegate: Requested unknown backend  CpuRef
INFO: TfLiteArmnnDelegate: Created TfLite ArmNN delegate.
Segmentation fault

Just tried the build again and the same as the binaries

LD_LIBRARY_PATH=../armnn/build ./benchmark_model --graph=mobilenet_v2_1.0_224_quantized_1_default_1.tflite --external_delegate_path="../armnn/build/delegate/libarmnnDelegate.so" --external_delegate_options="backends:CpuAcc;logging-severity:info"
STARTING!
Log parameter values verbosely: [0]
Graph: [mobilenet_v2_1.0_224_quantized_1_default_1.tflite]
External delegate path: [../armnn/build/delegate/libarmnnDelegate.so]
External delegate options: [backends:CpuAcc;logging-severity:info]
Loaded model mobilenet_v2_1.0_224_quantized_1_default_1.tflite
Info: ArmNN v28.0.0
Info: Initialization time: 0.19 ms.
INFO: TfLiteArmnnDelegate: Created TfLite ArmNN delegate.
EXTERNAL delegate created.
Segmentation fault

again try the benchmark on Bullseye with supplied binaries

LD_LIBRARY_PATH=/home/pi/ArmNN-aarch64 ./benchmark_model --graph=mobilenet_v2_1.0_224_quantized_1_default_1.tflite --external_delegate_path="/home/pi/ArmNN-aarch64/libarmnnDelegate.so" --external_delegate_options="backends:CpuAcc;logging-severity:info"
STARTING!
Log parameter values verbosely: [0]
Graph: [mobilenet_v2_1.0_224_quantized_1_default_1.tflite]
External delegate path: [/home/pi/ArmNN-aarch64/libarmnnDelegate.so]
External delegate options: [backends:CpuAcc;logging-severity:info]
Loaded model mobilenet_v2_1.0_224_quantized_1_default_1.tflite
Info: ArmNN v27.0.0

Can't load libOpenCL.so: libOpenCL.so: cannot open shared object file: No such file or directory
Can't load libGLES_mali.so: libGLES_mali.so: cannot open shared object file: No such file or directory
Can't load libmali.so: libmali.so: cannot open shared object file: No such file or directory
Couldn't find any OpenCL library.
Info: Initialization time: 17.35 ms

INFO: TfLiteArmnnDelegate: Created TfLite ArmNN delegate.
EXTERNAL delegate created.
Segmentation fault

So far it only ran on Ubuntu 20.04 Aarch64/Pi4 & the https://github.com/ARM-software/armnn/blob/branches/armnn_22_02/delegate/DelegateQuickStartGuide.md seems to be the only example that doesn't finish in a segmentation fault.

Also a lot of your examples are models that will run on even modest cortex-m and come no where near to stressing many a cortex-a so maybe not a great example or tutorial for the prospective user. If the delegate should bypass unsupported ops then I should be able to run https://github.com/breizhn/DTLN and get some feedback in what a relatively heavy and complex model really fits with armNN delegate. But anything NS, AEC, BSS would be a great addition to the https://developer.arm.com/documentation/102470/0100/?lang=en wav2letter example

james-conroy-arm commented 2 years ago

Hi @StuartIanNaylor

Instead of using ACL's pre-built binaries, could you please only use the Arm NN ones to see if this makes any difference? These are the 22.02 Arm NN Release binaries, I believe you need to choose aarch64: https://github.com/ARM-software/armnn/tree/master#pre-built-binaries

Thanks for your feedback regarding models. If there are any others you are interested in running with Arm NN, please let us know so that it can inform our roadmap.

Please let us know how you get on with the Arm NN binaries.

Cheers, James

StuartIanNaylor commented 2 years ago

I was james but on 64bit aarch64 Debian & ubuntu and about the only thing that didn't give a seg fault was the delegate on Ubuntu64 20.04 with the very basic single tensor example that with so many I tried I have now forgotten the URL. I didn't try the 32bit version as 32bit on a 64bit Soc with Neon for ML seems a bad choice and wanted to see what performance improvements the 64bit has as don't have much interest for anything 32bit on CortexA

Also I did build from scratch and hacked the flatbuffer comile so it would run without failing on werror or was it protobuf as I quickly forget things. Same on 64bit and maybe that is where we are ships in the dark?