armnn icon indicating copy to clipboard operation
armnn copied to clipboard

Arm NN 22.02 fails to build with flatbuffers 2.0.6

Open ggardet opened this issue 3 years ago • 9 comments

Arm NN 22.02 fails to build on openSUSE Tumbleweed with TensorFlow-Lite 2.7.1 and flatbuffers 2.0.6.

Logs:

[  116s] [ 53%] Building CXX object src/armnnSerializer/CMakeFiles/armnnSerializer.dir/Serializer.cpp.o
[  116s] cd /home/abuild/rpmbuild/BUILD/armnn-22.02/build/src/armnnSerializer && /usr/bin/c++ -DARMNNREF_ENABLED -DARMNN_SERIALIZER -DARMNN_SERIALIZER_SCHEMA_PATH=\"/home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema.fbs\" -DARMNN_TF_LITE_PARSER -DDYNAMIC_BACKEND_BUILD_DIR=\"/home/abuild/rpmbuild/BUILD/armnn-22.02/build\" -DarmnnSerializer_EXPORTS -I/home/abuild/rpmbuild/BUILD/armnn-22.02/include -I/home/abuild/rpmbuild/BUILD/armnn-22.02/profiling -I/home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/../armnn -I/home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/../armnnUtils -isystem /home/abuild/rpmbuild/BUILD/armnn-22.02/third-party -isystem /home/abuild/rpmbuild/BUILD/armnn-22.02/build/src/armnnSerializer -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g -pthread -std=c++14 -Wall -Wextra -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion  -Wno-psabi -O2 -g  -fPIC -MD -MT src/armnnSerializer/CMakeFiles/armnnSerializer.dir/Serializer.cpp.o -MF CMakeFiles/armnnSerializer.dir/Serializer.cpp.o.d -o CMakeFiles/armnnSerializer.dir/Serializer.cpp.o -c /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/Serializer.cpp
[  116s] In file included from /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/Serializer.hpp:17,
[  116s]                  from /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/Serializer.cpp:5:
[  116s] /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h: In member function 'bool armnnSerializer::TensorInfo::Verify(flatbuffers::Verifier&) const':
[  116s] /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h:1812:31: error: no matching function for call to 'armnnSerializer::TensorInfo::VerifyField<int8_t>(flatbuffers::Verifier&, armnnSerializer::TensorInfo::FlatBuffersVTableOffset) const'
[  116s]  1812 |            VerifyField<int8_t>(verifier, VT_DATATYPE) &&
[  116s]       |            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
[  116s] In file included from /usr/include/flatbuffers/flatbuffer_builder.h:31,
[  116s]                  from /usr/include/flatbuffers/flatbuffers.h:27,
[  116s]                  from /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h:11:
[  116s] /usr/include/flatbuffers/table.h:115:8: note: candidate: 'template<class T> bool flatbuffers::Table::VerifyField(const flatbuffers::Verifier&, flatbuffers::voffset_t, size_t) const'
[  116s]   115 |   bool VerifyField(const Verifier &verifier, voffset_t field,
[  116s]       |        ^~~~~~~~~~~
[  116s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  116s] /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h:1813:30: error: no matching function for call to 'armnnSerializer::TensorInfo::VerifyField<float>(flatbuffers::Verifier&, armnnSerializer::TensorInfo::FlatBuffersVTableOffset) const'
[  116s]  1813 |            VerifyField<float>(verifier, VT_QUANTIZATIONSCALE) &&
[  116s]       |            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  116s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  116s] /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h: In member function 'bool armnnSerializer::BindableLayerBase::Verify(flatbuffers::Verifier&) const':
[  116s] /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h:2448:32: error: no matching function for call to 'armnnSerializer::BindableLayerBase::VerifyField<int32_t>(flatbuffers::Verifier&, armnnSerializer::BindableLayerBase::FlatBuffersVTableOffset) const'
[  116s]  2448 |            VerifyField<int32_t>(verifier, VT_LAYERBINDINGID) &&
[  116s]       |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  116s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  116s] /home/abuild/rpmbuild/BUILD/armnn-22.02/src/armnnSerializer/ArmnnSchema_generated.h:3220:33: error: no matching function for call to 'armnnSerializer::Convolution2dDescriptor::VerifyField<uint32_t>(flatbuffers::Verifier&, armnnSerializer::Convolution2dDescriptor::FlatBuffersVTableOffset) const'
[  116s]  3220 |            VerifyField<uint32_t>(verifier, VT_STRIDEY) &&
[  116s]       |            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

And more errors of this kind.

ggardet avatar May 17 '22 09:05 ggardet

This seems similar to https://github.com/RPCS3/rpcs3/issues/11713 which was fixed with https://github.com/RPCS3/rpcs3/pull/11870 which adds a 3rd argument.

ggardet avatar May 17 '22 09:05 ggardet

Hi @ggardet

we currently have an version of ArmnnSchema_generated.h that was created by flatbuffers v1.12.0 checked into which is not overwritten when armnn is built. I'm getting a patch together to hopefully resolve this.

MikeJKelly avatar May 19 '22 14:05 MikeJKelly

Ah yes, this must be another symptom of the same root cause of #623

MatthewARM avatar May 19 '22 14:05 MatthewARM

With the patches above, I still get build issues:

[  188s] [ 51%] Building CXX object src/armnnTfLiteParser/CMakeFiles/armnnTfLiteParser.dir/TfLiteParser.cpp.o
[  188s] cd /home/abuild/rpmbuild/BUILD/armnn-22.05/build/src/armnnTfLiteParser && /usr/bin/c++ -DARMNNREF_ENABLED -DARMNN_SERIALIZER -DARMNN_SERIALIZER_SCHEMA_PATH=\"/home/abuild/rpmbuild/BUILD/armnn-22.05/src/armnnSerializer/ArmnnSchema.fbs\" -DARMNN_TF_LITE_PARSER -DDYNAMIC_BACKEND_BUILD_DIR=\"/home/abuild/rpmbuild/BUILD/armnn-22.05/build\" -DarmnnTfLiteParser_EXPORTS -I/home/abuild/rpmbuild/BUILD/armnn-22.05/include -I/home/abuild/rpmbuild/BUILD/armnn-22.05/profiling -I/home/abuild/rpmbuild/BUILD/armnn-22.05/src/armnnTfLiteParser/../armnn -I/home/abuild/rpmbuild/BUILD/armnn-22.05/src/armnnTfLiteParser/../armnnUtils -isystem /home/abuild/rpmbuild/BUILD/armnn-22.05/third-party -isystem /usr/include/tensorflow/lite/schema -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type  -g -pthread -std=c++14 -Wall -Wextra -Werror -Wold-style-cast -Wno-missing-braces -Wconversion -Wsign-conversion  -Wno-psabi -O2 -g  -fPIC -Wno-conversion -Wno-sign-conversion -Wno-unused-parameter -Wno-unused-function -MD -MT src/armnnTfLiteParser/CMakeFiles/armnnTfLiteParser.dir/TfLiteParser.cpp.o -MF CMakeFiles/armnnTfLiteParser.dir/TfLiteParser.cpp.o.d -o CMakeFiles/armnnTfLiteParser.dir/TfLiteParser.cpp.o -c /home/abuild/rpmbuild/BUILD/armnn-22.05/src/armnnTfLiteParser/TfLiteParser.cpp
[  188s] In file included from /home/abuild/rpmbuild/BUILD/armnn-22.05/src/armnnTfLiteParser/TfLiteParser.hpp:11,
[  188s]                  from /home/abuild/rpmbuild/BUILD/armnn-22.05/src/armnnTfLiteParser/TfLiteParser.cpp:6:
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h: In member function 'bool tflite::QuantizationParameters::Verify(flatbuffers::Verifier&) const':
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h:3406:32: error: no matching function for call to 'tflite::QuantizationParameters::VerifyField<uint8_t>(flatbuffers::Verifier&, tflite::QuantizationParameters::FlatBuffersVTableOffset) const'
[  188s]  3406 |            VerifyField<uint8_t>(verifier, VT_DETAILS_TYPE) &&
[  188s]       |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
[  188s] In file included from /usr/include/flatbuffers/flatbuffer_builder.h:31,
[  188s]                  from /usr/include/flatbuffers/flatbuffers.h:27,
[  188s]                  from /usr/include/tensorflow/lite/schema/schema_generated.h:21:
[  188s] /usr/include/flatbuffers/table.h:115:8: note: candidate: 'template<class T> bool flatbuffers::Table::VerifyField(const flatbuffers::Verifier&, flatbuffers::voffset_t, size_t) const'
[  188s]   115 |   bool VerifyField(const Verifier &verifier, voffset_t field,
[  188s]       |        ^~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h:3409:32: error: no matching function for call to 'tflite::QuantizationParameters::VerifyField<int32_t>(flatbuffers::Verifier&, tflite::QuantizationParameters::FlatBuffersVTableOffset) const'
[  188s]  3409 |            VerifyField<int32_t>(verifier, VT_QUANTIZED_DIMENSION) &&
[  188s]       |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note: candidate: 'template<class T> bool flatbuffers::Table::VerifyField(const flatbuffers::Verifier&, flatbuffers::voffset_t, size_t) const'
[  188s]   115 |   bool VerifyField(const Verifier &verifier, voffset_t field,
[  188s]       |        ^~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h: In member function 'bool tflite::DimensionMetadata::Verify(flatbuffers::Verifier&) const':
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h:3756:31: error: no matching function for call to 'tflite::DimensionMetadata::VerifyField<int8_t>(flatbuffers::Verifier&, tflite::DimensionMetadata::FlatBuffersVTableOffset) const'
[  188s]  3756 |            VerifyField<int8_t>(verifier, VT_FORMAT) &&
[  188s]       |            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note: candidate: 'template<class T> bool flatbuffers::Table::VerifyField(const flatbuffers::Verifier&, flatbuffers::voffset_t, size_t) const'
[  188s]   115 |   bool VerifyField(const Verifier &verifier, voffset_t field,
[  188s]       |        ^~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h:3757:32: error: no matching function for call to 'tflite::DimensionMetadata::VerifyField<int32_t>(flatbuffers::Verifier&, tflite::DimensionMetadata::FlatBuffersVTableOffset) const'
[  188s]  3757 |            VerifyField<int32_t>(verifier, VT_DENSE_SIZE) &&
[  188s]       |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note: candidate: 'template<class T> bool flatbuffers::Table::VerifyField(const flatbuffers::Verifier&, flatbuffers::voffset_t, size_t) const'
[  188s]   115 |   bool VerifyField(const Verifier &verifier, voffset_t field,
[  188s]       |        ^~~~~~~~~~~
[  188s] /usr/include/flatbuffers/table.h:115:8: note:   candidate expects 3 arguments, 2 provided
[  188s] /usr/include/tensorflow/lite/schema/schema_generated.h:3758:32: error: no matching function for call to 'tflite::DimensionMetadata::VerifyField<uint8_t>(flatbuffers::Verifier&, tflite::DimensionMetadata::FlatBuffersVTableOffset) const'
[  188s]  3758 |            VerifyField<uint8_t>(verifier, VT_ARRAY_SEGMENTS_TYPE) &&
[  188s]       |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And more.

It seems to use /usr/include/tensorflow/lite/schema/schema_generated.h now, which is not working either.

Any suggestion?

ggardet avatar May 31 '22 13:05 ggardet

Hi @ggardet

That's the TFLite schema which is used for reading TFLite models. It looks like an incompatability between the version of TFLite and Flatbuffers. I'll take a look.

MikeJKelly avatar Jun 08 '22 11:06 MikeJKelly

Hi @MikeJKelly Any update here?

ggardet avatar Jun 30 '22 08:06 ggardet

Hi @ggardet

That tensorflow lite schema is checked into the tensorflow repository and is not generated by us. However, 3 weeks ago the tensorflow project updated their version of flatbuffers to 2.0.6 with https://github.com/tensorflow/tensorflow/commit/bf0901b663e87f081c7a317fe1ac705ab1a2df8b which updated the schema_generated.h file shipped with tensorflow.

The function calls in the updated schema_generated.h have been changed from (for example): VerifyField<uint8_t>(verifier, VT_ARRAY_SEGMENTS_TYPE) && To: VerifyField<uint8_t>(verifier, VT_ARRAY_SEGMENTS_TYPE, 1) &&

The last tensorflow release was on May 23, 2022 so that has not included those changes but the next one hopefully should.

Best regards, Mike

MikeJKelly avatar Jul 07 '22 11:07 MikeJKelly

Ok, so IIUC, I need to backport https://github.com/tensorflow/tensorflow/commit/bf0901b663e87f081c7a317fe1ac705ab1a2df8b to my TensorFlow lite package and the problem should be gone?

ggardet avatar Jul 07 '22 12:07 ggardet

That may be enough looking at the changes made to schema_generated.h

However there was also this commit: https://github.com/tensorflow/tensorflow/commit/625a4045bc0728c0f3d1b63e05749201f8b401dd which was when they updated their version of flatbuffers to 2.0.5 so you may need to backport that too.

MikeJKelly avatar Jul 07 '22 21:07 MikeJKelly

Hi @ggardet,

Since 22.11 release we update to TensorFlow 2.10 and Flatbuffers 2.0.6.

As a result I believe this issue can be closed, if not please reopen.

Regards, Francis.

FrancisMurtagh-arm avatar Jan 06 '23 13:01 FrancisMurtagh-arm