Skip to content

Commit

Permalink
[tensorflow-lite] update patch files
Browse files Browse the repository at this point in the history
  • Loading branch information
luncliff committed Jan 20, 2024
1 parent 92699e4 commit b73f0b0
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 57 deletions.
23 changes: 0 additions & 23 deletions ports/tensorflow-lite/fix-cmake-nnapi.patch

This file was deleted.

24 changes: 24 additions & 0 deletions ports/tensorflow-lite/fix-cmake-vcpkg.patch
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,27 @@ index 6e206ca7..72933afd 100644
endif()

# Handle TFLite logging source.
diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt
index 72933afd..8f6fa5f6 100644
--- a/tensorflow/lite/CMakeLists.txt
+++ b/tensorflow/lite/CMakeLists.txt
@@ -541,9 +541,19 @@ if(_TFLITE_ENABLE_NNAPI)
)

list(APPEND TFLITE_NNAPI_SRCS
+ "${TF_SOURCE_DIR}/../third_party/xla/third_party/tsl/tsl/platform/default/logging.cc"
+ "${TF_SOURCE_DIR}/../third_party/xla/third_party/tsl/tsl/platform/default/mutex.cc"
"${TFLITE_SOURCE_DIR}/nnapi/sl/SupportLibrary.cc"
)

+ # tsl::mutex requires nsync_cpp
+ find_library(NSYNC_LIBRARY NAMES nsync_cpp REQUIRED)
+ list(APPEND TFLITE_TARGET_DEPENDENCIES ${NSYNC_LIBRARY})
+
+ # disable ml_dtypes/float8.h which requries libeigen3 master branch ...
+ set_source_files_properties(${TFLITE_NNAPI_SRCS} PROPERTIES
+ COMPILE_DEFINITIONS "TENSORFLOW_TSL_PLATFORM_FLOAT8_H_;TENSORFLOW_CORE_PLATFORM_FLOAT8_H_"
+ )
if(${TFLITE_ENABLE_NNAPI_VERBOSE_VALIDATION})
list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DNNAPI_VERBOSE_VALIDATION")
endif()
13 changes: 0 additions & 13 deletions ports/tensorflow-lite/fix-source-cpp20.patch

This file was deleted.

28 changes: 28 additions & 0 deletions ports/tensorflow-lite/fix-source.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/third_party/xla/third_party/tsl/tsl/platform/ml_dtypes.h b/third_party/xla/third_party/tsl/tsl/platform/ml_dtypes.h
index c25efc2f..23a04428 100644
--- a/third_party/xla/third_party/tsl/tsl/platform/ml_dtypes.h
+++ b/third_party/xla/third_party/tsl/tsl/platform/ml_dtypes.h
@@ -16,8 +16,8 @@ limitations under the License.
#ifndef TENSORFLOW_TSL_PLATFORM_ML_DTYPES_H_
#define TENSORFLOW_TSL_PLATFORM_ML_DTYPES_H_

-#include "ml_dtypes/include/float8.h" // from @ml_dtypes
-#include "ml_dtypes/include/int4.h" // from @ml_dtypes
+#include "ml_dtypes/float8.h" // from @ml_dtypes
+#include "ml_dtypes/int4.h" // from @ml_dtypes

namespace tsl {
using float8_e4m3fn = ml_dtypes::float8_e4m3fn;
diff --git a/tensorflow/lite/core/interpreter.h b/tensorflow/lite/core/interpreter.h
index 54e9a472..98a2fd67 100644
--- a/tensorflow/lite/core/interpreter.h
+++ b/tensorflow/lite/core/interpreter.h
@@ -994,7 +994,7 @@ class Interpreter {
// The flag is shared across all subgraphs in the interpreter.
// When the application calls `Cancel`, the flag will be set to false.
// It "resets" to true at the beginning of each `Invoke`.
- std::atomic_flag continue_invocation_{false};
+ std::atomic_flag continue_invocation_ = ATOMIC_FLAG_INIT;
bool cancellation_enabled_ = false;
};

26 changes: 5 additions & 21 deletions ports/tensorflow-lite/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ vcpkg_from_github(
tensorflow-pr-62705.patch
fix-cmake-c-api.patch
fix-cmake-vcpkg.patch
# fix-cmake-gpu.patch # build settings for GPU features
# fix-cmake-nnapi.patch # Android NNAPI
fix-source-abseil.patch # replace std:: and absl::
fix-source-cpp20.patch
fix-source-abseil.patch
fix-source.patch
fix-source-apple-opencl.patch
)

file(REMOVE_RECURSE
"${SOURCE_PATH}/third_party/eigen3"
# "${SOURCE_PATH}/third_party/xla"
# "${SOURCE_PATH}/third_party/xla" # create openxla-xla in future?
)
file(COPY "${CURRENT_INSTALLED_DIR}/include/eigen3" DESTINATION "${SOURCE_PATH}/third_party")

Expand Down Expand Up @@ -103,25 +102,10 @@ if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
else()
set(DELEGATES_GPU_GL_PATH "${TFLITE_SOURCE_DIR}/delegates/gpu/gl")
vcpkg_execute_required_process(
COMMAND ${FLATC} --cpp common.fbs
COMMAND ${FLATC} --cpp --scoped-enums common.fbs metadata.fbs workgroups.fbs compiled_model.fbs
LOGNAME codegen-flatc-cpp-gl-common
WORKING_DIRECTORY "${DELEGATES_GPU_GL_PATH}"
)
vcpkg_execute_required_process(
COMMAND ${FLATC} --cpp metadata.fbs
LOGNAME codegen-flatc-cpp-gl-metadata
WORKING_DIRECTORY "${DELEGATES_GPU_GL_PATH}"
)
vcpkg_execute_required_process(
COMMAND ${FLATC} --cpp workgroups.fbs
LOGNAME codegen-flatc-cpp-gl-workgroups
WORKING_DIRECTORY "${DELEGATES_GPU_GL_PATH}"
)
vcpkg_execute_required_process(
COMMAND ${FLATC} --cpp --scoped-enums compiled_model.fbs
LOGNAME codegen-flatc-cpp-gl-compiled_model
WORKING_DIRECTORY "${DELEGATES_GPU_GL_PATH}"
)
endif()

set(DELEGATES_GPU_CL_PATH "${TFLITE_SOURCE_DIR}/delegates/gpu/cl")
Expand Down

0 comments on commit b73f0b0

Please sign in to comment.