Skip to content

Commit 36a80ac

Browse files
committed
build: update flatbuffers dependency to v23.5.26
Update the third_party flatbuffers library to v23.5.26, the current version in upstream TF. Synchronize the override BUILD and build_defs.bzl files with those from upstream TF at e4485c98eae. Also update the Makefile build, which downloads flatbuffers separately. Rebase the patch applied to the download. Regenerate the generated-and-checked-in schemas (see ci/sync_from_upstream_tf.sh), because they are stamped with the version of the flatbuffers library, and fail a static_assert if they are built with a different version of flatbuffers than they were generated with. BUG=unsuccessful attempt to fix warning in #2183
1 parent ba8364a commit 36a80ac

File tree

8 files changed

+16657
-16525
lines changed

8 files changed

+16657
-16525
lines changed

tensorflow/lite/micro/tools/make/Makefile

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -517,25 +517,36 @@ $(TFL_CC_HDRS)
517517
# the implemenation of three different resolution fft from one single c file.
518518
# See http://b/201319430 for additional context.
519519
THIRD_PARTY_CC_HDRS := \
520-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/allocator.h \
521-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/array.h \
522-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/base.h \
523-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/buffer.h \
524-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/buffer_ref.h \
525-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/default_allocator.h \
526-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/detached_buffer.h \
527-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flatbuffer_builder.h \
528-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flatbuffers.h \
529-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flexbuffers.h \
530-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/stl_emulation.h \
531-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/string.h \
532-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/struct.h \
533-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/table.h \
534-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/vector.h \
535-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/vector_downward.h \
536-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/verifier.h \
537-
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/util.h \
538-
$(DOWNLOADS_DIR)/flatbuffers/LICENSE.txt \
520+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/allocator.h" \
521+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/array.h" \
522+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/base.h" \
523+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/buffer.h" \
524+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/buffer_ref.h" \
525+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/code_generator.h" \
526+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/code_generators.h" \
527+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/default_allocator.h" \
528+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/detached_buffer.h" \
529+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/file_manager.h" \
530+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flatbuffer_builder.h" \
531+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flatbuffers.h" \
532+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flex_flat_util.h" \
533+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/flexbuffers.h" \
534+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/grpc.h" \
535+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/hash.h" \
536+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/idl.h" \
537+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/minireflect.h" \
538+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/reflection.h" \
539+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/reflection_generated.h" \
540+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/registry.h" \
541+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/stl_emulation.h" \
542+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/string.h" \
543+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/struct.h" \
544+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/table.h" \
545+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/util.h" \
546+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/vector.h" \
547+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/vector_downward.h" \
548+
$(DOWNLOADS_DIR)/flatbuffers/include/flatbuffers/verifier.h" \
549+
$(DOWNLOADS_DIR)/flatbuffers/LICENSE \
539550
$(DOWNLOADS_DIR)/gemmlowp/fixedpoint/fixedpoint.h \
540551
$(DOWNLOADS_DIR)/gemmlowp/fixedpoint/fixedpoint_neon.h \
541552
$(DOWNLOADS_DIR)/gemmlowp/fixedpoint/fixedpoint_sse.h \

tensorflow/lite/micro/tools/make/flatbuffers.patch

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h
2-
index a5ac10d..371b6fd 100644
2+
index 5c4cae79..1a631641 100644
33
--- a/include/flatbuffers/base.h
44
+++ b/include/flatbuffers/base.h
55
@@ -1,6 +1,16 @@
@@ -20,10 +20,10 @@ index a5ac10d..371b6fd 100644
2020

2121
// If activate should be declared and included first.
2222
diff --git a/include/flatbuffers/default_allocator.h b/include/flatbuffers/default_allocator.h
23-
index 8b173af..975d938 100644
23+
index d4724122..975d9380 100644
2424
--- a/include/flatbuffers/default_allocator.h
2525
+++ b/include/flatbuffers/default_allocator.h
26-
@@ -39,26 +39,20 @@ class DefaultAllocator : public Allocator {
26+
@@ -39,24 +39,18 @@ class DefaultAllocator : public Allocator {
2727
// This is to avoid having a statically or dynamically allocated default
2828
// allocator, or having to move it between the classes that may own it.
2929
inline uint8_t *Allocate(Allocator *allocator, size_t size) {
@@ -52,15 +52,11 @@ index 8b173af..975d938 100644
5252
}
5353

5454
} // namespace flatbuffers
55-
56-
-#endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_
57-
\ No newline at end of file
58-
+#endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_
5955
diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h
60-
index 89f3f30..6e6d0b3 100644
56+
index 8e8cac14..52dae316 100644
6157
--- a/include/flatbuffers/flexbuffers.h
6258
+++ b/include/flatbuffers/flexbuffers.h
63-
@@ -496,9 +496,24 @@ class Reference {
59+
@@ -495,9 +495,24 @@ class Reference {
6460
return static_cast<double>(ReadUInt64(Indirect(), byte_width_));
6561
case FBT_NULL: return 0.0;
6662
case FBT_STRING: {
@@ -86,10 +82,10 @@ index 89f3f30..6e6d0b3 100644
8682
case FBT_VECTOR: return static_cast<double>(AsVector().size());
8783
case FBT_BOOL:
8884
diff --git a/include/flatbuffers/util.h b/include/flatbuffers/util.h
89-
index 93a39de..1cd4e8f 100644
85+
index 1ccf3517..34a75193 100644
9086
--- a/include/flatbuffers/util.h
9187
+++ b/include/flatbuffers/util.h
92-
@@ -24,6 +24,12 @@
88+
@@ -23,6 +23,12 @@
9389
#include "flatbuffers/base.h"
9490
#include "flatbuffers/stl_emulation.h"
9591

@@ -102,4 +98,3 @@ index 93a39de..1cd4e8f 100644
10298
#ifndef FLATBUFFERS_PREFER_PRINTF
10399
# include <iomanip>
104100
# include <sstream>
105-

tensorflow/lite/micro/tools/make/flatbuffers_download.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ DOWNLOADED_FLATBUFFERS_PATH=${DOWNLOADS_DIR}/flatbuffers
5454
if [ -d ${DOWNLOADED_FLATBUFFERS_PATH} ]; then
5555
echo >&2 "${DOWNLOADED_FLATBUFFERS_PATH} already exists, skipping the download."
5656
else
57-
ZIP_PREFIX="a66de58af9565586832c276fbb4251fc416bf07f"
57+
ZIP_PREFIX="v23.5.26"
5858
FLATBUFFERS_URL="https://github.com/google/flatbuffers/archive/${ZIP_PREFIX}.zip"
59-
FLATBUFFERS_MD5="51a7a96747e1c33eb4aac6d52513a02f"
59+
FLATBUFFERS_MD5="e87e8acd8e2d53653387ad78720316e2"
6060

6161
TEMPDIR="$(mktemp -d)"
6262
TEMPFILE="${TEMPDIR}/${ZIP_PREFIX}.zip"
6363
wget ${FLATBUFFERS_URL} -O "$TEMPFILE" >&2
6464
check_md5 "${TEMPFILE}" ${FLATBUFFERS_MD5}
6565

6666
unzip -qo "$TEMPFILE" -d "${TEMPDIR}" >&2
67-
mv "${TEMPDIR}/flatbuffers-${ZIP_PREFIX}" ${DOWNLOADED_FLATBUFFERS_PATH}
67+
mv "${TEMPDIR}/flatbuffers-${ZIP_PREFIX#v}" ${DOWNLOADED_FLATBUFFERS_PATH}
6868
rm -rf "${TEMPDIR}"
6969

7070
pushd ${DOWNLOADED_FLATBUFFERS_PATH} > /dev/null

0 commit comments

Comments
 (0)