diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..c083f89 --- /dev/null +++ b/_constraints @@ -0,0 +1,10 @@ + + + + 5 + + + 2 + + + diff --git a/armnn-19.02.tar.gz b/armnn-19.02.tar.gz deleted file mode 100644 index c599d0c..0000000 --- a/armnn-19.02.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:50f1551ec6a40097a38694119db82b7c45f6e10277d26db5010460f19de8c8f2 -size 765857 diff --git a/armnn-19.05.tar.gz b/armnn-19.05.tar.gz new file mode 100644 index 0000000..8706304 --- /dev/null +++ b/armnn-19.05.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:765296c2496d45ab83e7cd768a8a184f6e33407e4373c8024d66152a2fcde0b6 +size 955719 diff --git a/armnn-fix_build_with_gcc9.patch b/armnn-fix_build_with_gcc9.patch new file mode 100644 index 0000000..ece0c44 --- /dev/null +++ b/armnn-fix_build_with_gcc9.patch @@ -0,0 +1,15 @@ +diff --git a/src/armnn/LayerSupport.cpp b/src/armnn/LayerSupport.cpp +--- a/src/armnn/LayerSupport.cpp ++++ b/src/armnn/LayerSupport.cpp +@@ -26,10 +26,7 @@ void CopyErrorMessage(char* truncatedString, const char* fullString, size_t maxL + { + if(truncatedString != nullptr) + { +- size_t copyLength = std::min(maxLength, strlen(fullString)); +- std::strncpy(truncatedString, fullString, copyLength); +- // Ensure null-terminated string. +- truncatedString[copyLength] = '\0'; ++ std::snprintf(truncatedString, maxLength, fullString); + } + } + diff --git a/armnn-fix_quantizer_link.patch b/armnn-fix_quantizer_link.patch new file mode 100644 index 0000000..b0621a2 --- /dev/null +++ b/armnn-fix_quantizer_link.patch @@ -0,0 +1,10 @@ +--- armnn-19.05.orig/CMakeLists.txt 2019-06-05 10:35:47.599978023 +0200 ++++ armnn-19.05/CMakeLists.txt 2019-06-05 10:36:47.252567567 +0200 +@@ -162,6 +162,7 @@ if(BUILD_ARMNN_QUANTIZER) + set_target_properties(armnnQuantizer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) + + target_link_libraries(armnnQuantizer ++ armnn + ${Boost_SYSTEM_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_FILESYSTEM_LIBRARY} diff --git a/armnn-fix_stb_include.patch b/armnn-fix_stb_include.patch deleted file mode 100644 index fead44c..0000000 --- a/armnn-fix_stb_include.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- armnn-19.02.orig/tests/InferenceTestImage.cpp 2019-03-26 16:40:06.771572115 +0100 -+++ armnn-19.02/tests/InferenceTestImage.cpp 2019-03-26 16:40:25.483761594 +0100 -@@ -12,13 +12,13 @@ - #include - - #define STB_IMAGE_IMPLEMENTATION --#include -+#include - - #define STB_IMAGE_RESIZE_IMPLEMENTATION --#include -+#include - - #define STB_IMAGE_WRITE_IMPLEMENTATION --#include -+#include - - namespace - { diff --git a/armnn-generate-versioned-library.patch b/armnn-generate-versioned-library.patch index d91310f..2fd061e 100644 --- a/armnn-generate-versioned-library.patch +++ b/armnn-generate-versioned-library.patch @@ -1,6 +1,7 @@ ---- armnn-19.02.orig/CMakeLists.txt 2019-04-11 10:31:03.241484945 +0200 -+++ armnn-19.02/CMakeLists.txt 2019-04-11 10:32:20.878025310 +0200 -@@ -82,6 +82,7 @@ if(BUILD_CAFFE_PARSER) +diff -purN armnn-19.05.orig/CMakeLists.txt armnn-19.05/CMakeLists.txt +--- armnn-19.05.orig/CMakeLists.txt 2019-05-28 10:59:44.000000000 +0200 ++++ armnn-19.05/CMakeLists.txt 2019-06-03 13:55:21.502978565 +0200 +@@ -88,6 +88,7 @@ if(BUILD_CAFFE_PARSER) target_link_libraries(armnnCaffeParser armnn) target_link_libraries(armnnCaffeParser ${PROTOBUF_LIBRARIES}) @@ -8,7 +9,7 @@ endif() -@@ -106,6 +107,7 @@ if(BUILD_ONNX_PARSER) +@@ -112,6 +113,7 @@ if(BUILD_ONNX_PARSER) # Protobuf target_link_libraries(armnnOnnxParser ${PROTOBUF_LIBRARIES}) @@ -16,31 +17,15 @@ endif() if(BUILD_TF_PARSER) -@@ -129,6 +131,7 @@ if(BUILD_TF_PARSER) +@@ -135,6 +137,7 @@ if(BUILD_TF_PARSER) # Protobuf (use the specific version tensorflow wants) target_link_libraries(armnnTfParser ${PROTOBUF_LIBRARIES}) + set_target_properties(armnnTfParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) endif() - if(BUILD_TF_LITE_PARSER) -@@ -147,6 +150,7 @@ if(BUILD_TF_LITE_PARSER) - - target_link_libraries(armnnTfLiteParser ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) - target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) -+ set_target_properties(armnnTfLiteParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) - endif() - - if(BUILD_ARMNN_SERIALIZER) -@@ -178,6 +182,7 @@ if(BUILD_ARMNN_SERIALIZER) - target_include_directories(armnnSerializer SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/armnnSerializer) - - target_link_libraries(armnnSerializer armnn ${FLATBUFFERS_LIBRARY}) -+ set_target_properties(armnnSerializer PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) - endif() - if(BUILD_ARMNN_QUANTIZER) -@@ -208,6 +213,8 @@ if(BUILD_ARMNN_QUANTIZER) +@@ -191,6 +194,8 @@ if(BUILD_ARMNN_QUANTIZER) if(Threads_FOUND AND (NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android))) target_link_libraries(ArmnnQuantizer pthread) endif() @@ -49,7 +34,7 @@ endif() -@@ -449,6 +456,7 @@ endif() +@@ -441,6 +446,7 @@ endif() if(PROFILING_BACKEND_STREAMLINE) target_link_libraries(armnn pthread) endif() @@ -57,3 +42,25 @@ if(BUILD_UNIT_TESTS) set(unittest_sources) +diff -purN armnn-19.05.orig/src/armnnSerializer/CMakeLists.txt armnn-19.05/src/armnnSerializer/CMakeLists.txt +--- armnn-19.05.orig/src/armnnSerializer/CMakeLists.txt 2019-05-28 10:59:44.000000000 +0200 ++++ armnn-19.05/src/armnnSerializer/CMakeLists.txt 2019-06-03 13:57:41.984333057 +0200 +@@ -34,4 +34,5 @@ if(BUILD_ARMNN_SERIALIZER) + target_include_directories(armnnSerializer SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + + target_link_libraries(armnnSerializer armnn ${FLATBUFFERS_LIBRARY}) +-endif() +\ Pas de fin de ligne à la fin du fichier ++ set_target_properties(armnnSerializer PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) ++endif() +diff -purN armnn-19.05.orig/src/armnnTfLiteParser/CMakeLists.txt armnn-19.05/src/armnnTfLiteParser/CMakeLists.txt +--- armnn-19.05.orig/src/armnnTfLiteParser/CMakeLists.txt 2019-05-28 10:59:44.000000000 +0200 ++++ armnn-19.05/src/armnnTfLiteParser/CMakeLists.txt 2019-06-03 13:58:00.216523255 +0200 +@@ -20,4 +20,5 @@ if(BUILD_TF_LITE_PARSER) + + target_link_libraries(armnnTfLiteParser ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) + target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) +-endif() +\ Pas de fin de ligne à la fin du fichier ++ set_target_properties(armnnTfLiteParser PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) ++endif() diff --git a/armnn-remove_broken_std_move.patch b/armnn-remove_broken_std_move.patch new file mode 100644 index 0000000..5668a70 --- /dev/null +++ b/armnn-remove_broken_std_move.patch @@ -0,0 +1,20 @@ +--- armnn-19.05.orig/src/armnn/test/CreateWorkload.hpp 2019-06-04 09:12:20.645179117 +0200 ++++ armnn-19.05/src/armnn/test/CreateWorkload.hpp 2019-05-28 10:59:44.000000000 +0200 +@@ -1092,7 +1092,7 @@ std::unique_ptr CreateMe + auto workloadMerger = MakeAndCheckWorkload(*merger, graph, factory); + BOOST_TEST_CHECKPOINT("created merger workload"); + +- return std::move(workloadMerger); ++ return workloadMerger; + } + + template +@@ -1250,7 +1250,7 @@ std::unique_ptr Create + auto workloadConstant = MakeAndCheckWorkload(*constant, graph, factory); + BOOST_TEST_CHECKPOINT("created Constant workload"); + +- return std::move(workloadConstant); ++ return workloadConstant; + } + + } diff --git a/armnn.changes b/armnn.changes index 0fdae8d..eb28bf6 100644 --- a/armnn.changes +++ b/armnn.changes @@ -1,3 +1,39 @@ +------------------------------------------------------------------- +Wed Jun 5 09:07:12 UTC 2019 - Guillaume GARDET + +- Build and package libarmnnTfLiteParser +- Fix libarmnnQuantizer build with: + * armnn-fix_quantizer_link.patch + +------------------------------------------------------------------- +Tue Jun 4 09:22:24 UTC 2019 - Guillaume GARDET + +- Add _constraints to avoid OOM errors + +------------------------------------------------------------------- +Mon Jun 3 11:40:47 UTC 2019 - Guillaume GARDET + +- Update to 19.05: +- Changelog: https://github.com/ARM-software/armnn/releases/tag/v19.05 +- Remove upstreamed patch: + * armnn-fix_stb_include.patch +- Rebase patch: + * armnn-generate-versioned-library.patch +- Update patch: + * armnn-remove_broken_std_move.patch + +------------------------------------------------------------------- +Mon Jun 3 09:15:25 UTC 2019 - Guillaume GARDET + +- Fix build on Tumbleweed with: + * armnn-fix_build_with_gcc9.patch + +------------------------------------------------------------------- +Wed May 29 15:19:15 UTC 2019 - Guillaume GARDET + +- Fix build on Tumbleweed with: + * armnn-remove_broken_std_move.patch + ------------------------------------------------------------------- Wed May 29 08:12:43 UTC 2019 - Guillaume GARDET diff --git a/armnn.spec b/armnn.spec index 7076d7f..315194a 100644 --- a/armnn.spec +++ b/armnn.spec @@ -25,23 +25,29 @@ # Disable OpenCL from Compute library, as check fails %bcond_with compute_cl -# stb-devel and flatbuffers-devel are available on Leap 15.1+ -%if 0%{?suse_version} > 1500 +# stb-devel is available on Leap 15.1+ +%if 0%{?suse_version} > 1500 || 0%{?sle_version} > 150000 && 0%{?is_opensuse} %bcond_without armnn_tests -%bcond_without armnn_flatbuffers %else %bcond_with armnn_tests +%endif + +# flatbuffers-devel is available on TW only +%if 0%{?suse_version} > 1500 +%bcond_without armnn_flatbuffers +%else %bcond_with armnn_flatbuffers %endif # Enable CAFFE %bcond_without armnn_caffe -# Disable TensorFlow for now (build broken) +# TMP: totest +# %%bcond_without armnn_tf %bcond_with armnn_tf %define version_major 19 -%define version_minor 02 +%define version_minor 05 Name: armnn Version: %{version_major}.%{version_minor} @@ -52,11 +58,16 @@ Group: Development/Libraries/Other Url: https://developer.arm.com/products/processors/machine-learning/arm-nn Source0: https://github.com/ARM-software/armnn/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Patch1: armnn-fix_boost.patch -Patch2: armnn-fix_stb_include.patch # PATCH: based on http://arago-project.org/git/?p=meta-arago.git;a=blob;f=meta-arago-extras/recipes-support/armnn/armnn/0004-generate-versioned-library.patch;hb=master Patch3: armnn-generate-versioned-library.patch # Patch: http://arago-project.org/git/?p=meta-arago.git;a=blob;f=meta-arago-extras/recipes-support/armnn/armnn/0007-enable-use-of-arm-compute-shared-library.patch;hb=master Patch4: 0007-enable-use-of-arm-compute-shared-library.patch +# https://github.com/ARM-software/armnn/issues/193 +Patch5: armnn-remove_broken_std_move.patch +# https://github.com/ARM-software/armnn/issues/195 +Patch6: armnn-fix_build_with_gcc9.patch +# PATCH-FIX-UPSTREAM https://review.mlplatform.org/c/ml/armnn/+/1286 +Patch7: armnn-fix_quantizer_link.patch %if 0%{?suse_version} < 1330 BuildRequires: boost-devel >= 1.59 %else @@ -75,6 +86,7 @@ BuildRequires: ComputeLibrary-devel BuildRequires: gcc-c++ %if %{with armnn_flatbuffers} BuildRequires: flatbuffers-devel +BuildRequires: tensorflow-lite-devel %endif %if %{with compute_cl} # Mesa-libOpenCl is required for tests @@ -147,6 +159,19 @@ such as TensorFlow and Caffe, allowing them to run efficiently – without modification – across Arm Cortex CPUs and Arm Mali GPUs. This package contains the libarmnnSerializer library from armnn. + +%package -n libarmnnTfLiteParser%{version_major} +Summary: libarmnnTfLiteParser from armnn +Group: Development/Libraries/C and C++ + +%description -n libarmnnTfLiteParser%{version_major} +Arm NN is an inference engine for CPUs, GPUs and NPUs. +It bridges the gap between existing NN frameworks and the underlying IP. +It enables efficient translation of existing neural network frameworks, +such as TensorFlow and Caffe, allowing them to run efficiently – without +modification – across Arm Cortex CPUs and Arm Mali GPUs. + +This package contains the libarmnnTfLiteParser library from armnn. %endif %if %{with armnn_caffe} @@ -167,9 +192,11 @@ This package contains the libarmnnCaffeParser library from armnn. %prep %setup -q %patch1 -p1 -%patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 # Boost fixes for dynamic linking sed -i 's/add_definitions("-DBOOST_ALL_NO_LIB")/add_definitions("-DBOOST_ALL_DYN_LINK")/' ./cmake/GlobalConfig.cmake sed -i 's/set(Boost_USE_STATIC_LIBS ON)/set(Boost_USE_STATIC_LIBS OFF)/' ./cmake/GlobalConfig.cmake @@ -199,9 +226,12 @@ sed -i 's/-Wsign-conversion//' ./cmake/GlobalConfig.cmake -DFLATC_DIR=%{_bindir} \ -DFLATBUFFERS_INCLUDE_PATH=%{_includedir} \ -DBUILD_ARMNN_QUANTIZER=ON \ + -DBUILD_TF_LITE_PARSER=ON \ + -DTF_LITE_SCHEMA_INCLUDE_PATH=%{_includedir}/tensorflow/lite/schema/ \ %else -DBUILD_ARMNN_SERIALIZER=OFF \ -DBUILD_ARMNN_QUANTIZER=OFF \ + -DBUILD_TF_LITE_PARSER=OFF \ %endif %if %{with armnn_tf} -DBUILD_TF_PARSER=ON \ @@ -263,11 +293,20 @@ CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership" \ find ./build/tests -maxdepth 1 -type f -executable -exec cp $CP_ARGS {} %{buildroot}%{_bindir} \; %endif %if %{with armnn_flatbuffers} +# Install libarmnnTfLiteParser.so* +cp $(pwd)/build/libarmnnTfLiteParser.so.%{version_major}.%{version_minor} %{buildroot}/usr/lib/ +pushd %{buildroot}/usr/lib/ +ln -s libarmnnTfLiteParser.so.%{version_major}.%{version_minor} libarmnnTfLiteParser.so.%{version_major} +ln -s libarmnnTfLiteParser.so.%{version_major}.%{version_minor} libarmnnTfLiteParser.so +popd +# Install libarmnnSerializer.so* +cp $(pwd)/build/libarmnnSerializer.so* %{buildroot}/usr/lib/ # Install Sample app cp $CP_ARGS ./build/samples/SimpleSample %{buildroot}%{_bindir} %endif -%if %{with armnn_tests} +# Tumbleweed checks fail, try it anyway +%if %{with armnn_tests} && 0%{?suse_version} <= 1500 %check # Run tests LD_LIBRARY_PATH="$(pwd)/build/" \ @@ -280,6 +319,9 @@ LD_LIBRARY_PATH="$(pwd)/build/" \ %if %{with armnn_flatbuffers} %post -n libarmnnSerializer%{version_major} -p /sbin/ldconfig %postun -n libarmnnSerializer%{version_major} -p /sbin/ldconfig + +%post -n libarmnnTfLiteParser%{version_major} -p /sbin/ldconfig +%postun -n libarmnnTfLiteParser%{version_major} -p /sbin/ldconfig %endif %if %{with armnn_caffe} @@ -287,10 +329,15 @@ LD_LIBRARY_PATH="$(pwd)/build/" \ %postun -n libarmnnCaffeParser%{version_major} -p /sbin/ldconfig %endif + %files %defattr(-,root,root) %doc README.md %license LICENSE +%if %{with armnn_flatbuffers} +%{_bindir}/TfLite*-Armnn +%{_bindir}/Image*Generator +%endif %if %{with armnn_tests} %{_bindir}/ExecuteNetwork %if %{with armnn_caffe} @@ -308,6 +355,9 @@ LD_LIBRARY_PATH="$(pwd)/build/" \ %if %{with armnn_flatbuffers} %files -n libarmnnSerializer%{version_major} /usr/lib/libarmnnSerializer.so.* + +%files -n libarmnnTfLiteParser%{version_major} +/usr/lib/libarmnnTfLiteParser.so.* %endif %if %{with armnn_caffe} @@ -329,11 +379,14 @@ LD_LIBRARY_PATH="$(pwd)/build/" \ %{_includedir}/armnnTfParser/ITfParser.hpp %dir %{_includedir}/armnnDeserializer/ %{_includedir}/armnnDeserializer/IDeserializer.hpp +%dir %{_includedir}/armnnQuantizer +%{_includedir}/armnnQuantizer/INetworkQuantizer.hpp %dir %{_includedir}/armnnSerializer/ %{_includedir}/armnnSerializer/ISerializer.hpp /usr/lib/libarmnn.so %if %{with armnn_flatbuffers} /usr/lib/libarmnnSerializer.so +/usr/lib/libarmnnTfLiteParser.so %endif %if %{with armnn_caffe} /usr/lib/libarmnnCaffeParser.so