diff --git a/recipes/tensorflow-lite/all/CMakeLists.txt b/recipes/tensorflow-lite/all/CMakeLists.txt deleted file mode 100644 index 57b8c78f33a5b3..00000000000000 --- a/recipes/tensorflow-lite/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/../conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("src/tensorflow/lite") diff --git a/recipes/tensorflow-lite/all/conandata.yml b/recipes/tensorflow-lite/all/conandata.yml index 1e50dbd6e75e1d..42304f36f76b1d 100644 --- a/recipes/tensorflow-lite/all/conandata.yml +++ b/recipes/tensorflow-lite/all/conandata.yml @@ -1,34 +1,14 @@ sources: - "2.6.0": - url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.6.0.tar.gz" - sha256: "41b32eeaddcbc02b0583660bcf508469550e4cd0f86b22d2abe72dfebeacde0f" - "2.6.2": - url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.6.2.tar.gz" - sha256: "e68c1d346fc3d529653530ca346b2c62f5b31bd4fcca7ffc9c65bb39ab2f6ed3" - "2.9.1": - url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.9.1.tar.gz" - sha256: "6eaf86ead73e23988fe192da1db68f4d3828bcdd0f3a9dc195935e339c95dbdc" + "2.10.0": + url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.10.0.tar.gz" + sha256: "b5a1bb04c84b6fe1538377e5a1f649bb5d5f0b2e3625a3c526ff3a8af88633e8" patches: - "2.9.1": - - patch_file: "patches/msvc_fixes.patch" - patch_description: "Fix Windows build: Apply fixes for compatibility with MSVC from master" - patch_source: "https://github.com/tensorflow/tensorflow/pull/56408" - patch_type: "backport" - base_path: "src" - - patch_file: "patches/dependencies_2_9.patch" - patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" - patch_type: "conan" - base_path: "src" + "2.10.0": - patch_file: "patches/remove_simple_memory_arena_debug_dump.patch" patch_description: "Shared build fails on Windows with error LNK2005. Resolve the conflict by removing the conflicting implementation for now." - base_path: "src" - "2.6.0": - - patch_file: "patches/dependencies_2_6.patch" - patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" + - patch_file: "patches/disable_fetch_content.patch" + patch_description: "Fail if the CMake build script tries to fetch external dependencies" patch_type: "conan" - base_path: "src" - "2.6.2": - - patch_file: "patches/dependencies_2_6.patch" + - patch_file: "patches/dependencies_2_10.patch" patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" patch_type: "conan" - base_path: "src" diff --git a/recipes/tensorflow-lite/all/conanfile.py b/recipes/tensorflow-lite/all/conanfile.py index efe5861ad778c7..f780e991d21b0d 100644 --- a/recipes/tensorflow-lite/all/conanfile.py +++ b/recipes/tensorflow-lite/all/conanfile.py @@ -1,13 +1,13 @@ from conan import ConanFile -from conan.tools import files from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, save, copy, export_conandata_patches, apply_conandata_patches from conan.errors import ConanInvalidConfiguration -from conans import CMake, tools -import functools -import os +from os.path import join import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class TensorflowLiteConan(ConanFile): @@ -37,31 +37,19 @@ class TensorflowLiteConan(ConanFile): "with_xnnpack": True } - short_paths = True - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "src" - - @property - def _build_subfolder(self): - return "build" @property def _compilers_minimum_version(self): return { - "gcc": "5", - "Visual Studio": "14", - "clang": "3.4", + "gcc": "8", + "Visual Studio": "15.8", + "clang": "5", "apple-clang": "5.1", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -76,60 +64,66 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("abseil/20211102.0") + self.requires("abseil/20220623.0") self.requires("eigen/3.4.0") self.requires("farmhash/cci.20190513") self.requires("fft/cci.20061228") - self.requires("flatbuffers/2.0.5") + self.requires("flatbuffers/2.0.6") self.requires("gemmlowp/cci.20210928") if self.settings.arch in ("x86", "x86_64"): self.requires("intel-neon2sse/cci.20210225") self.requires("ruy/cci.20220628") if self.options.with_xnnpack: - self.requires("xnnpack/cci.20220621") + self.requires("xnnpack/cci.20220801") if self.options.with_xnnpack or self.options.get_safe("with_nnapi", False): self.requires("fp16/cci.20210320") def build_requirements(self): self.tool_requires("cmake/3.24.0") - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17 if Version(self.version) >= "2.9.1" else 14) - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn(f"{self.name} requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration(f"{self.name} requires C++14, which your compiler does not support.") - - def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def build(self): - files.apply_conandata_patches(self) - cmake = self._configure_cmake() - cmake.build() + def layout(self): + cmake_layout(self, build_folder=f"build_folder/{self.settings.build_type}") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions.update({ + def generate(self): + tc = CMakeToolchain(self) + tc.variables.update({ "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS": True, "TFLITE_ENABLE_RUY": self.options.with_ruy, "TFLITE_ENABLE_NNAPI": self.options.get_safe("with_nnapi", False), "TFLITE_ENABLE_GPU": False, "TFLITE_ENABLE_XNNPACK": self.options.with_xnnpack, - "TFLITE_ENABLE_MMAP": self.options.get_safe("with_mmap", False) + "TFLITE_ENABLE_MMAP": self.options.get_safe("with_mmap", False), + "FETCHCONTENT_FULLY_DISCONNECTED": True, + "clog_POPULATED": True, }) if self.settings.arch == "armv8": # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 - cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = "arm64" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 17) + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if not minimum_version: + self.output.warn(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") + elif Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.name} requires C++17, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=join("tensorflow", "lite")) + cmake.build() @staticmethod - def _create_cmake_module_alias_target(module_file): + def _create_cmake_module_alias_target(conanfile, module_file): aliased = "tensorflowlite::tensorflowlite" alias = "tensorflow::tensorflowlite" content = textwrap.dedent(f"""\ @@ -138,21 +132,21 @@ def _create_cmake_module_alias_target(module_file): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """) - tools.save(module_file, content) + save(conanfile, module_file, content) @property def _module_file(self): - return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + return join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst=os.path.join("include", "tensorflow", "lite"), src=os.path.join(self._source_subfolder, "tensorflow", "lite")) - self.copy("*", dst="lib", src=os.path.join(self._build_subfolder, "lib")) - if self.options.shared: - self.copy("*", dst="bin", src=os.path.join(self._build_subfolder, "bin")) - if self.settings.build_type == "Debug": - tools.remove_files_by_mask(self.package_folder, "*.pdb") - self._create_cmake_module_alias_target(os.path.join(self.package_folder, self._module_file)) + copy(self, "LICENSE", self.source_folder, join(self.package_folder, "licenses")) + copy(self, "*.h", join(self.source_folder, "tensorflow", "lite"), join(self.package_folder, "include", "tensorflow", "lite")) + copy(self, "*.a", self.build_folder, join(self.package_folder, "lib")) + copy(self, "*.so", self.build_folder, join(self.package_folder, "lib")) + copy(self, "*.dylib", self.build_folder, join(self.package_folder, "lib")) + copy(self, "*.lib", self.build_folder, join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", self.build_folder, join(self.package_folder, "bin"), keep_path=False) + self._create_cmake_module_alias_target(self, join(self.package_folder, self._module_file)) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tensorflowlite") @@ -170,6 +164,6 @@ def package_info(self): defines.append("TFLITE_WITH_RUY") self.cpp_info.defines = defines - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["tensorflow-lite"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("dl") diff --git a/recipes/tensorflow-lite/all/patches/dependencies_2_9.patch b/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch similarity index 60% rename from recipes/tensorflow-lite/all/patches/dependencies_2_9.patch rename to recipes/tensorflow-lite/all/patches/dependencies_2_10.patch index 0c15d040912a97..a82533faee2e8f 100644 --- a/recipes/tensorflow-lite/all/patches/dependencies_2_9.patch +++ b/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch @@ -1,25 +1,14 @@ +commit fcb02f001504c4060f83233cedc9b8f197fcc607 +Author: talyz +Date: Wed Aug 24 19:09:53 2022 +0200 + + Conan deps + diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt -index 40f9485b5d6..f184ac5d30d 100644 +index 663f07ab31c..9f05de4ebec 100644 --- a/tensorflow/lite/CMakeLists.txt +++ b/tensorflow/lite/CMakeLists.txt -@@ -50,14 +50,8 @@ if(NOT TENSORFLOW_SOURCE_DIR) - endif() - set(TF_SOURCE_DIR "${TENSORFLOW_SOURCE_DIR}/tensorflow") - set(TFLITE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}") --set(CMAKE_MODULE_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_MODULE_PATH} --) --set(CMAKE_PREFIX_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_PREFIX_PATH} --) -+list(APPEND CMAKE_MODULE_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") -+list(APPEND CMAKE_PREFIX_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") - include(CMakeDependentOption) - option(TFLITE_ENABLE_RUY "Enable experimental RUY integration" OFF) - option(TFLITE_ENABLE_RESOURCE "Enable experimental support for resources" ON) -@@ -138,12 +132,11 @@ macro(populate_tf_source_vars RELATIVE_DIR SOURCES_VAR) +@@ -138,12 +138,11 @@ macro(populate_tf_source_vars RELATIVE_DIR SOURCES_VAR) endmacro() # Find TensorFlow Lite dependencies. find_package(absl REQUIRED) @@ -35,18 +24,18 @@ index 40f9485b5d6..f184ac5d30d 100644 find_package(clog REQUIRED) find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library find_package(ruy REQUIRED) -@@ -162,6 +155,10 @@ set(TFLITE_TARGET_PUBLIC_OPTIONS "") +@@ -162,6 +161,10 @@ set(TFLITE_TARGET_PUBLIC_OPTIONS "") set(TFLITE_TARGET_PRIVATE_OPTIONS "") # Additional library dependencies based upon enabled features. set(TFLITE_TARGET_DEPENDENCIES "") +if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") -+ find_package(NEON_2_SSE REQUIRED) -+ list(APPEND TFLITE_TARGET_DEPENDENCIES NEON_2_SSE::NEON_2_SSE) ++ find_package(intel-neon2sse REQUIRED) ++ list(APPEND TFLITE_TARGET_DEPENDENCIES intel-neon2sse::intel-neon2sse) +endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") # TFLite uses deprecated methods in neon2sse which generates a huge number of # warnings so surpress these until they're fixed. -@@ -395,7 +392,7 @@ if(TFLITE_ENABLE_XNNPACK) +@@ -411,7 +414,7 @@ if(TFLITE_ENABLE_XNNPACK) FILTER ".*(_test|_tester)\\.(cc|h)" ) list(APPEND TFLITE_TARGET_DEPENDENCIES @@ -55,7 +44,7 @@ index 40f9485b5d6..f184ac5d30d 100644 ) list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFLITE_BUILD_WITH_XNNPACK_DELEGATE") endif() -@@ -499,18 +496,17 @@ target_include_directories(tensorflow-lite +@@ -519,17 +522,16 @@ target_include_directories(tensorflow-lite target_link_libraries(tensorflow-lite PUBLIC Eigen3::Eigen @@ -70,12 +59,10 @@ index 40f9485b5d6..f184ac5d30d 100644 - fft2d_fftsg2d - flatbuffers - gemmlowp -- ruy + farmhash::farmhash + fft::fft + flatbuffers::flatbuffers + gemmlowp::eight_bit_int_gemm -+ ruy::ruy + ruy::ruy ${CMAKE_DL_LIBS} ${TFLITE_TARGET_DEPENDENCIES} - ) diff --git a/recipes/tensorflow-lite/all/patches/dependencies_2_6.patch b/recipes/tensorflow-lite/all/patches/dependencies_2_6.patch deleted file mode 100644 index f5d3dbba999d20..00000000000000 --- a/recipes/tensorflow-lite/all/patches/dependencies_2_6.patch +++ /dev/null @@ -1,81 +0,0 @@ -diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt -index f5cc9b97924..4edc693dd7d 100644 ---- a/tensorflow/lite/CMakeLists.txt -+++ b/tensorflow/lite/CMakeLists.txt -@@ -50,14 +50,8 @@ if(NOT TENSORFLOW_SOURCE_DIR) - endif() - set(TF_SOURCE_DIR "${TENSORFLOW_SOURCE_DIR}/tensorflow") - set(TFLITE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}") --set(CMAKE_MODULE_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_MODULE_PATH} --) --set(CMAKE_PREFIX_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_PREFIX_PATH} --) -+list(APPEND CMAKE_MODULE_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") -+list(APPEND CMAKE_PREFIX_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") - include(CMakeDependentOption) - option(TFLITE_ENABLE_RUY "Enable experimental RUY integration" OFF) - option(TFLITE_ENABLE_RESOURCE "Enable experimental support for resources" ON) -@@ -125,12 +119,11 @@ macro(populate_tf_source_vars RELATIVE_DIR SOURCES_VAR) - endmacro() - # Find TensorFlow Lite dependencies. - find_package(absl REQUIRED) --find_package(eigen REQUIRED) -+find_package(Eigen3 REQUIRED) - find_package(farmhash REQUIRED) --find_package(fft2d REQUIRED) --find_package(flatbuffers REQUIRED) -+find_package(fft REQUIRED) -+find_package(Flatbuffers REQUIRED CONFIG) - find_package(gemmlowp REQUIRED) --find_package(neon2sse REQUIRED) - find_package(ruy REQUIRED) - # Generate TensorFlow Lite FlatBuffer code. - # We used to have an actual compilation logic with flatc but decided to use -@@ -147,6 +140,10 @@ set(TFLITE_TARGET_PUBLIC_OPTIONS "") - set(TFLITE_TARGET_PRIVATE_OPTIONS "") - # Additional library dependencies based upon enabled features. - set(TFLITE_TARGET_DEPENDENCIES "") -+if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") -+ find_package(NEON_2_SSE REQUIRED) -+ list(APPEND TFLITE_TARGET_DEPENDENCIES NEON_2_SSE::NEON_2_SSE) -+endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") - # TFLite uses deprecated methods in neon2sse which generates a huge number of - # warnings so surpress these until they're fixed. -@@ -322,7 +319,7 @@ if(TFLITE_ENABLE_XNNPACK) - FILTER ".*(_test|_tester)\\.(cc|h)" - ) - list(APPEND TFLITE_TARGET_DEPENDENCIES -- XNNPACK -+ xnnpack::xnnpack - ) - list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFLITE_BUILD_WITH_XNNPACK_DELEGATE") - endif() -@@ -418,18 +415,17 @@ target_include_directories(tensorflow-lite - target_link_libraries(tensorflow-lite - PUBLIC - Eigen3::Eigen -- NEON_2_SSE - absl::flags - absl::hash - absl::status - absl::strings - absl::synchronization - absl::variant -- farmhash -- fft2d_fftsg2d -- flatbuffers -- gemmlowp -- ruy -+ farmhash::farmhash -+ fft::fft -+ flatbuffers::flatbuffers -+ gemmlowp::eight_bit_int_gemm -+ ruy::ruy - ${CMAKE_DL_LIBS} - ${TFLITE_TARGET_DEPENDENCIES} - ) diff --git a/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch b/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch new file mode 100644 index 00000000000000..adc6f0561afefa --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch @@ -0,0 +1,12 @@ +diff --git a/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake b/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake +index 9ed95109ba9..4ddf322b95f 100644 +--- a/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake ++++ b/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake +@@ -244,6 +244,7 @@ endfunction() + # All content names passed to this method are added to the global property + # OVERRIDABLE_FETCH_CONTENT_LIST. + function(OverridableFetchContent_Declare CONTENT_NAME) ++ message(FATAL_ERROR "OverridableFetchContent_Declare called by ${CONTENT_NAME}! Failing build.") + set(OVERRIDABLE_ARGS + GIT_REPOSITORY + GIT_TAG diff --git a/recipes/tensorflow-lite/all/patches/msvc_fixes.patch b/recipes/tensorflow-lite/all/patches/msvc_fixes.patch deleted file mode 100644 index 6400721781285e..00000000000000 --- a/recipes/tensorflow-lite/all/patches/msvc_fixes.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 79be9efa5190a4a9c828369ba358e6f9e59fbbe5 Mon Sep 17 00:00:00 2001 -From: Jamie Cook -Date: Thu, 9 Jun 2022 17:54:52 +1000 -Subject: [PATCH 1/4] Use the help macro from absl to avoid gcc specific - compiler macro (__PRETTY_FUNCTION__) - ---- - tensorflow/lite/kernels/internal/compatibility.h | 11 +++++++++++ - .../kernels/internal/optimized/depthwiseconv_float.h | 2 +- - .../kernels/internal/optimized/depthwiseconv_uint8.h | 2 +- - .../internal/optimized/integer_ops/depthwise_conv.h | 2 +- - 4 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/tensorflow/lite/kernels/internal/compatibility.h b/tensorflow/lite/kernels/internal/compatibility.h -index 61becad30c5c2..1b275095092dd 100644 ---- a/tensorflow/lite/kernels/internal/compatibility.h -+++ b/tensorflow/lite/kernels/internal/compatibility.h -@@ -86,6 +86,17 @@ using int32 = std::int32_t; - using uint32 = std::uint32_t; - #endif // !defined(TF_LITE_STATIC_MEMORY) - -+ -+// Allow for cross-compiler usage of function signatures - used for specifying -+// named RUY profiler regions in templated methods. -+#if defined(_MSC_VER) -+#define TFLITE_PRETTY_FUNCTION __FUNCSIG__ -+#elif defined(__GNUC__) -+#define TFLITE_PRETTY_FUNCTION __PRETTY_FUNCTION__ -+#else -+#define TFLITE_PRETTY_FUNCTION __func__ -+#endif -+ - // TFLITE_DEPRECATED() - // - // Duplicated from absl/base/macros.h to avoid pulling in that library. -diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h -index a8903c1d2758a..daafa93ef3baa 100644 ---- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h -+++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h -@@ -768,7 +768,7 @@ void FloatDepthwiseConvAccumRow(int stride, int dilation_factor, - const float* filter_data, - int out_x_buffer_start, int out_x_buffer_end, - int output_depth, float* acc_buffer) { -- ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__); -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION); - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. -diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -index 52469b34c8703..8ebb7411e0ff7 100644 ---- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -+++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -@@ -1519,7 +1519,7 @@ void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor, - int16 filter_offset, int out_x_buffer_start, - int out_x_buffer_end, int output_depth, - int32* acc_buffer) { -- ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__); -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION);; - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. -diff --git a/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h b/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h -index d38d05e81bd3e..b9727e4ad40c3 100644 ---- a/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h -+++ b/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h -@@ -1429,7 +1429,7 @@ void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor, - int out_x_buffer_start, - int out_x_buffer_end, int output_depth, - int32* acc_buffer) { -- ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__); -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION); - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. - -From 3616d189a87a3f7cd3cabb8f3ec44f29f58f7e14 Mon Sep 17 00:00:00 2001 -From: Jamie Cook -Date: Fri, 10 Jun 2022 08:19:52 +1000 -Subject: [PATCH 2/4] designated initializers are only supported on MSVC 2019 - with stdc++20 - ---- - .../lite/delegates/external/external_delegate.cc | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/tensorflow/lite/delegates/external/external_delegate.cc b/tensorflow/lite/delegates/external/external_delegate.cc -index 7fe5c5329dd2a..39a2d04cfca43 100644 ---- a/tensorflow/lite/delegates/external/external_delegate.cc -+++ b/tensorflow/lite/delegates/external/external_delegate.cc -@@ -155,12 +155,12 @@ ExternalDelegateWrapper::ExternalDelegateWrapper( - ckeys.size(), nullptr); - if (external_delegate_) { - wrapper_delegate_ = { -- .data_ = reinterpret_cast(this), -- .Prepare = DelegatePrepare, -- .CopyFromBufferHandle = nullptr, -- .CopyToBufferHandle = nullptr, -- .FreeBufferHandle = nullptr, -- .flags = external_delegate_->flags, -+ reinterpret_cast(this), // .data = -+ DelegatePrepare, // .Prepare = -+ nullptr, // .CopyFromBufferHandle = -+ nullptr, // .CopyToBufferHandle = -+ nullptr, // .FreeBufferHandle = -+ external_delegate_->flags, // .flags = - }; - if (external_delegate_->CopyFromBufferHandle) { - wrapper_delegate_.CopyFromBufferHandle = DelegateCopyFromBufferHandle; - -From 6e7e5291950e8f72f9ad50674ba0162247f5d078 Mon Sep 17 00:00:00 2001 -From: Jamie Cook -Date: Mon, 13 Jun 2022 14:29:51 +1000 -Subject: [PATCH 3/4] Trigger build which was failing last week with DNS issues - ---- - tensorflow/lite/kernels/internal/compatibility.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tensorflow/lite/kernels/internal/compatibility.h b/tensorflow/lite/kernels/internal/compatibility.h -index 1b275095092dd..037697f19fb6c 100644 ---- a/tensorflow/lite/kernels/internal/compatibility.h -+++ b/tensorflow/lite/kernels/internal/compatibility.h -@@ -87,7 +87,7 @@ using uint32 = std::uint32_t; - #endif // !defined(TF_LITE_STATIC_MEMORY) - - --// Allow for cross-compiler usage of function signatures - used for specifying -+// Allow for cross-compiler usage of function signatures - currently used for specifying - // named RUY profiler regions in templated methods. - #if defined(_MSC_VER) - #define TFLITE_PRETTY_FUNCTION __FUNCSIG__ - -From d12d20dfc989f2ebdc74bdcfb8a9155eb51ba03e Mon Sep 17 00:00:00 2001 -From: Mihai Maruseac -Date: Wed, 15 Jun 2022 17:14:47 -0700 -Subject: [PATCH 4/4] Update - tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h - ---- - .../lite/kernels/internal/optimized/depthwiseconv_uint8.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -index 8ebb7411e0ff7..f7176bb8bc7db 100644 ---- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -+++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -@@ -1519,7 +1519,7 @@ void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor, - int16 filter_offset, int out_x_buffer_start, - int out_x_buffer_end, int output_depth, - int32* acc_buffer) { -- ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION);; -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION); - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. diff --git a/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch b/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch index 4e2350cd296788..2f7e6367c52d89 100644 --- a/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch +++ b/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch @@ -1,8 +1,8 @@ diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt -index f184ac5d30d..f59f9ea717c 100644 +index 40f9485b5d6..f250ebccc05 100644 --- a/tensorflow/lite/CMakeLists.txt +++ b/tensorflow/lite/CMakeLists.txt -@@ -199,6 +199,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android") +@@ -202,6 +202,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android") endif() # Build a list of source files to compile into the TF Lite library. populate_tflite_source_vars("." TFLITE_SRCS) diff --git a/recipes/tensorflow-lite/all/test_package/CMakeLists.txt b/recipes/tensorflow-lite/all/test_package/CMakeLists.txt index afc3ca81165735..b1b0f24e0aa992 100644 --- a/recipes/tensorflow-lite/all/test_package/CMakeLists.txt +++ b/recipes/tensorflow-lite/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(tensorflowlite REQUIRED CONFIG) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE tensorflow::tensorflowlite) -target_compile_features(test_package PRIVATE cxx_std_14) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/tensorflow-lite/all/test_package/conanfile.py b/recipes/tensorflow-lite/all/test_package/conanfile.py index ac6751f7f689b0..841a097747d320 100644 --- a/recipes/tensorflow-lite/all/test_package/conanfile.py +++ b/recipes/tensorflow-lite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): model_path = os.path.join(self.source_folder, "model.tflite") - command = os.path.join("bin", "test_package") - self.run(" ".join([command, model_path]), run_environment=True) + command = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{command} {model_path}", env="conanrun") diff --git a/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt b/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ff2f7e7d395363 --- /dev/null +++ b/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tensorflowlite REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package PRIVATE tensorflow::tensorflowlite) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/tensorflow-lite/all/test_v1_package/conanfile.py b/recipes/tensorflow-lite/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..17a163fae24bd3 --- /dev/null +++ b/recipes/tensorflow-lite/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + model_path = os.path.join(self.source_folder, os.pardir, "test_package", "model.tflite") + command = os.path.join("bin", "test_package") + self.run(f"{command} {model_path}", run_environment=True) diff --git a/recipes/tensorflow-lite/config.yml b/recipes/tensorflow-lite/config.yml index 939866f077b061..22d65dcfdfac61 100644 --- a/recipes/tensorflow-lite/config.yml +++ b/recipes/tensorflow-lite/config.yml @@ -1,7 +1,3 @@ versions: - "2.6.0": - folder: all - "2.6.2": - folder: all - "2.9.1": + "2.10.0": folder: all