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

Segmentation Fault using GpuAcc Delegate #692

Closed matheusfalcaopinto closed 1 year ago

matheusfalcaopinto commented 2 years ago

Hi! I manage to build armnn with the build-tools scripts (without docker):

./install-packages.sh ./setup-armnn.sh --target-arch=aarch64 --all ./build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend --armnn-cmake-args='-DFLATC=/root/armnn/build-tool/scripts/build/flatbuffers/flatc

An then follow the DelagateQuickStartGuide steps:

sudo apt-get install python3-pip sudo pip3 install virtualenv cd your/tutorial/dir virtualenv -p python3 myenv source myenv/bin/activate pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime==2.5.0.post1

But when I run the python example in the Delegate Guide using GpuAcc I get:

Info: ArmNN v30.0.0 arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.Info: Initialization time: 3.12 ms. INFO: TfLiteArmnnDelegate: Created TfLite ArmNN delegate. <A LOT OF> Warning: The backend makes use of a deprecated interface to read constant tensors. If you are a backend developer please find more information in our doxygen documentation on github https://github.com/ARM-software/armnn under the keyword 'ConstTensorsAsInputs'. Info: ArmnnSubgraph creation Info: Parse nodes to ArmNN time: 3.86 ms <MORE> Warning: The backend makes use of a deprecated interface to read constant tensors. If you are a backend developer please find more information in our doxygen documentation on github https://github.com/ARM-software/armnn under the keyword 'ConstTensorsAsInputs'. Info: Optimize ArmnnSubgraph time: 13.54 ms Segmentation fault

When I run the same code but with CpuAcc I get the same warnings but without the segmentation fault part (actually I get the output_tensor data normally).

Any ideas of what is happening here? Thanks!

PS: The machine is an aarch64 Debian Bullseye (RK3399 with Mali-T860 GPU).

EDIT1: Running the code with the fp32_model.tflite on GpuAcc works!

ArmRyan commented 2 years ago

Hi @matheusfalcaopinto ,

What model are you running on GpuAcc that segfaults?

matheusfalcaopinto commented 2 years ago

@ArmRyan I tired the mock_model.tflite, conv2d.tflite, fp32_model.tflite, tried some mobilenet and efficientdet from TF Hub and the mobilenet model from the pyarmm video file example. I think the number of warnings that I get is relatated to the size of the model somehow.

ArmRyan commented 2 years ago

Hi, The warnings get called on any layer that uses the deprecated functions, so the more layers that use the function, the more warnings. I will try to run this locally and see if I come across a similar issue.

xiaotongnii commented 2 years ago

Hi,@matheusfalcaopinto, warning show CL Backend use a deprecated interface, but maybe not lead to Segmentation fault. Can check which opencl version on your devices? Mali-T860 GPU has deponded on opencl . Hi @ArmRyan, can your known which releationship between Mali GPU version and OPENCL version?

matheusfalcaopinto commented 2 years ago

@Shelton-N Hi! I'm using the last package provided by Debian Bullseye, sorry but I can't verify right now, I think was something like libopencl.

keidav01 commented 2 years ago

Hi @matheusfalcaopinto. I just want to check in on the status of this issue. Is this still a problem for you? I notice that in your original post, you have edited to say that the FP32 model does not produce a segmentation fault and works. Can this ticket be closed because of this or would you like further assistance with another model?

matheusfalcaopinto commented 2 years ago

@keidav01 hi! I'm facing the same issue still, but for now I can't work on it for a couple days unfortunately . If needed you can close the post.

keidav01 commented 2 years ago

@matheusfalcaopinto no problem at all. I will keep it open for now. Please feedback when you can and we will try to assist

FrancisMurtagh-arm commented 1 year ago

Closing due to inactivity, please reopen if necessary.