Skip to content

Commit

Permalink
tensorflow-lite: Add v2.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
talyz committed Jun 9, 2024
1 parent 2123261 commit 2c661e1
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 2 deletions.
14 changes: 14 additions & 0 deletions recipes/tensorflow-lite/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
sources:
"2.15.0":
url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.15.0.tar.gz"
sha256: "9cec5acb0ecf2d47b16891f8bc5bc6fbfdffe1700bdadc0d9ebe27ea34f0c220"
"2.12.0":
url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.12.0.tar.gz"
sha256: "c030cb1905bff1d2446615992aad8d8d85cbe90c4fb625cee458c63bf466bc8e"
"2.10.0":
url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.10.0.tar.gz"
sha256: "b5a1bb04c84b6fe1538377e5a1f649bb5d5f0b2e3625a3c526ff3a8af88633e8"
patches:
"2.15.0":
- patch_file: "patches/disable_fetch_content.patch"
patch_description: "Fail if the CMake build script tries to fetch external dependencies"
patch_type: "conan"
- patch_file: "patches/windows_mmap.patch"
patch_description: "Disable mmap on Windows."
patch_type: "bugfix"
patch_source: "https://github.com/tensorflow/tensorflow/pull/62636"
- patch_file: "patches/dependencies_2_15.patch"
patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc"
patch_type: "conan"
"2.12.0":
- patch_file: "patches/2.12.0-0001-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."
Expand Down
8 changes: 6 additions & 2 deletions recipes/tensorflow-lite/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ def requirements(self):
self.requires("eigen/3.4.0")
self.requires("farmhash/cci.20190513")
self.requires("fft/cci.20061228")
self.requires("flatbuffers/23.3.3", transitive_headers=True)
if Version(self.version) < "2.15.0":
self.requires("flatbuffers/23.3.3", transitive_headers=True)
else:
self.requires("flatbuffers/23.5.26", transitive_headers=True)
self.requires("gemmlowp/cci.20210928")
self.requires("ruy/cci.20220628")
self.requires("ruy/cci.20231129")
if self.settings.arch in ("x86", "x86_64"):
self.requires("intel-neon2sse/cci.20210225")
if self.options.with_xnnpack:
Expand Down Expand Up @@ -124,6 +127,7 @@ def generate(self):
"TFLITE_ENABLE_XNNPACK": self.options.with_xnnpack,
"TFLITE_ENABLE_MMAP": self.options.get_safe("with_mmap", False),
"FETCHCONTENT_FULLY_DISCONNECTED": True,
"SYSTEM_PTHREADPOOL": True,
"clog_POPULATED": True,
})
if self.settings.arch == "armv8":
Expand Down
68 changes: 68 additions & 0 deletions recipes/tensorflow-lite/all/patches/dependencies_2_15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt
index 0958ed1b9ce..13d06f12ca6 100644
--- a/tensorflow/lite/CMakeLists.txt
+++ b/tensorflow/lite/CMakeLists.txt
@@ -147,7 +147,7 @@ set(TFLITE_TARGET_DEPENDENCIES "")
find_package(absl REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(farmhash REQUIRED)
-find_package(fft2d REQUIRED)
+find_package(fft REQUIRED)
find_package(FlatBuffers REQUIRED)
find_package(gemmlowp REQUIRED)
if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
@@ -155,7 +155,6 @@ if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
list(APPEND TFLITE_TARGET_DEPENDENCIES NEON_2_SSE::NEON_2_SSE)
endif()
find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library
-find_package(ml_dtypes REQUIRED)
find_package(ruy REQUIRED)
# Include TSL, which is in tensorflow/third_party
include_directories(
@@ -183,6 +182,11 @@ if(NOT SYSTEM_PTHREADPOOL AND NOT TARGET pthreadpool)
"${PTHREADPOOL_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/pthreadpool")
endif()
+if(TARGET flatbuffers::flatbuffers_shared)
+ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared)
+else()
+ set(FLATBUFFERS_TARGET flatbuffers::flatbuffers)
+endif()
set(TF_TARGET_PRIVATE_OPTIONS "")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
# TensorFlow uses a heap of deprecated proto fields so surpress these
@@ -483,13 +487,13 @@ else()
endif()
if(TFLITE_ENABLE_XNNPACK)
find_package(fp16_headers REQUIRED)
- find_package(XNNPACK REQUIRED)
+ find_package(xnnpack REQUIRED)
populate_tflite_source_vars("delegates/xnnpack"
TFLITE_DELEGATES_XNNPACK_SRCS
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()
@@ -633,13 +637,12 @@ target_link_libraries(tensorflow-lite
absl::strings
absl::synchronization
absl::variant
- farmhash
- fft2d_fftsg2d
- flatbuffers::flatbuffers
- gemmlowp::gemmlowp
- ml_dtypes
+ farmhash::farmhash
+ fft::fft
+ ${FLATBUFFERS_TARGET}
+ gemmlowp::eight_bit_int_gemm
ruy::ruy
- pthreadpool
+ pthreadpool::pthreadpool
${CMAKE_DL_LIBS}
${TFLITE_TARGET_DEPENDENCIES}
)
20 changes: 20 additions & 0 deletions recipes/tensorflow-lite/all/patches/windows_mmap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
commit 77056b1ab930c36c8066446615577be4d121e3ea
Author: talyz <kim.lindberger@gmail.com>
Date: Thu Dec 14 11:43:16 2023 +0100

cmake: Disable the use of mmap on Windows

diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt
index 83bc7629004..0958ed1b9ce 100644
--- a/tensorflow/lite/CMakeLists.txt
+++ b/tensorflow/lite/CMakeLists.txt
@@ -202,7 +202,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
# Use NOMINMAX to disable the min / max macros in windows.h as they break
# use of std::min std::max.
# Use NOGDI to ERROR macro which breaks TensorFlow logging.
- list(APPEND TFLITE_TARGET_PRIVATE_OPTIONS "-DNOMINMAX" "-DNOGDI")
+ # Disable mmap, which is not available on Windows.
+ list(APPEND TFLITE_TARGET_PRIVATE_OPTIONS "-DNOMINMAX" "-DNOGDI" "-DTFLITE_MMAP_DISABLED")
# lite/kernels/conv.cc has more than 64k sections so enable /bigobj to
# support compilation with MSVC2015.
if(MSVC)
2 changes: 2 additions & 0 deletions recipes/tensorflow-lite/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.15.0":
folder: all
"2.12.0":
folder: all
"2.10.0":
Expand Down

0 comments on commit 2c661e1

Please sign in to comment.