Skip to content

Commit

Permalink
update tensorflow and serving to 2.6.0
Browse files Browse the repository at this point in the history
update patches with upstream changes

update main.cc with upstream changes

minor readme updates
  • Loading branch information
emacski committed Aug 26, 2021
1 parent 14684fd commit ef41cec
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# upstream tensorflow/serving version
build --embed_label=2.5.1
build --embed_label=2.6.0

common --experimental_repo_remote_exec

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ On many consumer / developer 64-bit and 32-bit arm platforms you can simply:
```sh
docker pull emacski/tensorflow-serving:latest
# or
docker pull emacski/tensorflow-serving:2.5.1
docker pull emacski/tensorflow-serving:2.6.0
```

Refer to [TensorFlow Serving with Docker](https://www.tensorflow.org/tfx/serving/docker)
Expand All @@ -58,7 +58,7 @@ for configuration and setting up a model for serving.
Example
```bash
# on beaglebone black
docker pull emacski/tensorflow-serving:2.5.1-linux_arm_armv7-a_neon_vfpv3
docker pull emacski/tensorflow-serving:2.6.0-linux_arm_armv7-a_neon_vfpv3
```

### Aliases
Expand All @@ -77,7 +77,7 @@ docker pull emacski/tensorflow-serving:2.5.1-linux_arm_armv7-a_neon_vfpv3
Examples
```bash
# on Raspberry PI 3 B+
docker pull emacski/tensorflow-serving:2.5.1-linux_arm64
docker pull emacski/tensorflow-serving:2.6.0-linux_arm64
# or
docker pull emacski/tensorflow-serving:latest-linux_arm64
```
Expand Down Expand Up @@ -113,9 +113,9 @@ docker pull emacski/tensorflow-serving:latest
Example
```sh
# on Raspberry PI 3 B+
docker pull emacski/tensorflow-serving:2.5.1
# the actual image used is emacski/tensorflow-serving:2.5.1-linux_arm64
# itself actually being emacski/tensorflow-serving:2.5.1-linux_arm64_armv8-a
docker pull emacski/tensorflow-serving:2.6.0
# the actual image used is emacski/tensorflow-serving:2.6.0-linux_arm64
# itself actually being emacski/tensorflow-serving:2.6.0-linux_arm64_armv8-a
```

### Debug Images
Expand All @@ -130,9 +130,9 @@ suffix (if one is required) in the image tag.

```sh
# multi-arch
docker pull emacski/tensorflow-serving:2.5.1-debug
docker pull emacski/tensorflow-serving:2.6.0-debug
# specific image
docker pull emacski/tensorflow-serving:2.5.1-debug-linux_arm64_armv8-a
docker pull emacski/tensorflow-serving:2.6.0-debug-linux_arm64_armv8-a
# specific alias
docker pull emacski/tensorflow-serving:latest-debug-linux_arm64
```
Expand Down
30 changes: 16 additions & 14 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,34 @@ protobuf_deps()

# tensorflow/tensorflow and deps

# tensorflow 2.5.0
# tensorflow 2.6.0
http_archive(
name = "org_tensorflow",
patches = [
# align arm cpu config values
# aws - align arm cpu config values
"//third_party/tensorflow:aws.patch",
# arm (32-bit) datatype sizes
# curl and hwloc - arm (32-bit) datatype sizes
"//third_party/tensorflow:curl.patch",
"//third_party/tensorflow:hwloc.patch",
# set platform cpu constraint on aarch64 config_setting
# mkl - set platform cpu constraint on aarch64 config_setting
"//third_party/tensorflow:mkl.patch",
# remove explicit linker dep on libgomp
# mkl_dnn - remove explicit linker dep on libgomp
"//third_party/tensorflow:mkl_dnn.patch",
# allow android cpu helper to be used for linux_arm and linux_arm64
# tensorflow - use android cpu helper for arm and arm64 on linux, don't
# let cuda tools hijack rules_cc, llvm omp.h is already in the include
# path for this project's cc toolchain
"//third_party/tensorflow:tensorflow.patch",
],
patch_args = ["-p1"],
sha256 = "cb99f136dc5c89143669888a44bfdd134c086e1e2d9e36278c1eb0f03fe62d76",
strip_prefix = "tensorflow-a4dfb8d1a71385bd6d122e4f27f86dcebb96712d",
sha256 = "70a865814b9d773024126a6ce6fea68fefe907b7ae6f9ac7e656613de93abf87",
strip_prefix = "tensorflow-919f693420e35d00c8d0a42100837ae3718f7927",
urls = [
"https://github.com/tensorflow/tensorflow/archive/a4dfb8d1a71385bd6d122e4f27f86dcebb96712d.tar.gz",
"https://github.com/tensorflow/tensorflow/archive/919f693420e35d00c8d0a42100837ae3718f7927.tar.gz",
],
)

# tensorflow dependency patch: disable default c++ includes as these are set
# (and configurable) within the custom llvm/clang toolchain
# at build time by the llvm/clang toolchain
http_archive(
name = "nsync",
patches = [
Expand All @@ -114,13 +116,13 @@ http_archive(
],
)

# tensorflow serving 2.5.1
# tensorflow serving 2.6.0
http_archive(
name = "tf_serving",
sha256 = "e94726632a0637a460b07e5e1c6c5a30c9f776dda22b5e9132b9ef526fbefa7e",
strip_prefix = "serving-da76fc74b48f6afe190125f9ed572e690cef8570",
sha256 = "5fe87c899e2afea297dead1ee0e1709852ed55578b7975cffefe135f82b61c77",
strip_prefix = "serving-04d47f8aa567f429185a4416ef58f7fe11a21a43",
urls = [
"https://github.com/tensorflow/serving/archive/da76fc74b48f6afe190125f9ed572e690cef8570.tar.gz",
"https://github.com/tensorflow/serving/archive/04d47f8aa567f429185a4416ef58f7fe11a21a43.tar.gz",
],
)

Expand Down
8 changes: 7 additions & 1 deletion tensorflow_model_server/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ int main(int argc, char** argv) {
"simultaneously. Auto-configured by default."
"Note that this option is ignored if "
"--platform_config_file is non-empty."),
tensorflow::Flag("use_alts_credentials", &options.use_alts_credentials,
"Use Google ALTS credentials"),
tensorflow::Flag(
"ssl_config_file", &options.ssl_config_file,
"If non-empty, read an ascii SSLConfig protobuf from "
Expand Down Expand Up @@ -244,7 +246,11 @@ int main(int argc, char** argv) {
"disabled, models utilizing this feature will return bad Status "
"on first compilation request."),
tensorflow::Flag("enable_profiler", &options.enable_profiler,
"Enable profiler service.")};
"Enable profiler service."),
tensorflow::Flag("thread_pool_factory_config_file",
&options.thread_pool_factory_config_file,
"If non-empty, read an ascii ThreadPoolConfig protobuf "
"from the supplied file name.")};

const auto& usage = tensorflow::Flags::Usage(argv[0], flag_list);
if (!tensorflow::Flags::Parse(&argc, argv, flag_list)) {
Expand Down
4 changes: 2 additions & 2 deletions third_party/tensorflow/aws.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/third_party/aws/BUILD.bazel b/third_party/aws/BUILD.bazel
index d9e40703caa..afc4a9de1ba 100644
index d9e40703caa..809c06338d6 100644
--- a/third_party/aws/BUILD.bazel
+++ b/third_party/aws/BUILD.bazel
@@ -24,7 +24,7 @@ cc_library(
Expand All @@ -12,7 +12,7 @@ index d9e40703caa..afc4a9de1ba 100644
]),
"@org_tensorflow//tensorflow:freebsd": glob([
diff --git a/third_party/aws/aws-c-common.bazel b/third_party/aws/aws-c-common.bazel
index ab9406805c2..65c3bca244c 100644
index ab9406805c2..6cf6f3ccc70 100644
--- a/third_party/aws/aws-c-common.bazel
+++ b/third_party/aws/aws-c-common.bazel
@@ -24,7 +24,7 @@ cc_library(
Expand Down
6 changes: 3 additions & 3 deletions third_party/tensorflow/curl.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/third_party/curl.BUILD b/third_party/curl.BUILD
index 42d2bb03049..6261379632b 100644
index 85b09cf1bf4..4be33505f7d 100644
--- a/third_party/curl.BUILD
+++ b/third_party/curl.BUILD
@@ -595,7 +595,13 @@ genrule(
@@ -597,7 +597,13 @@ genrule(
"# define HAVE_RAND_STATUS 1",
"# define HAVE_SSL_GET_SHUTDOWN 1",
"# define HAVE_TERMIOS_H 1",
Expand All @@ -17,7 +17,7 @@ index 42d2bb03049..6261379632b 100644
"# define RANDOM_FILE \"/dev/urandom\"",
"# define USE_OPENSSL 1",
"#endif",
@@ -771,13 +777,23 @@ genrule(
@@ -773,13 +779,23 @@ genrule(
"# define SEND_TYPE_ARG4 int",
"# define SEND_TYPE_RETV ssize_t",
"# define SIZEOF_INT 4",
Expand Down
8 changes: 4 additions & 4 deletions third_party/tensorflow/hwloc.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
diff --git a/third_party/hwloc/BUILD.bazel b/third_party/hwloc/BUILD.bazel
index a9de93686c0..63e4d5b3b0e 100644
index 46149dd497f..65db0c23cdb 100644
--- a/third_party/hwloc/BUILD.bazel
+++ b/third_party/hwloc/BUILD.bazel
@@ -209,14 +209,21 @@ _INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_LINUX_SUBS.update(_INCLUDE_PRIVATE_HWLO

_INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_CUDA_SUBS.update(_INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_LINUX_SUBS)

+_INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_LINUX_ARMV7_SUBS = dict(_INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_LINUX_SUBS)
+_INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_LINUX_ARMV7_SUBS.update({
+ "#undef HWLOC_SIZEOF_UNSIGNED_LONG": "#define HWLOC_SIZEOF_UNSIGNED_LONG 4",
Expand All @@ -26,5 +26,5 @@ index a9de93686c0..63e4d5b3b0e 100644
+ "//conditions:default": _INCLUDE_PRIVATE_HWLOC_AUTOIGEN_CONFIG_H_LINUX_SUBS,
+ }),
)

template_rule(
2 changes: 1 addition & 1 deletion third_party/tensorflow/mkl.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/third_party/mkl/BUILD b/third_party/mkl/BUILD
index aa65b585b85..ca18a6e61d6 100644
index 196897fea46..c23894bacdf 100644
--- a/third_party/mkl/BUILD
+++ b/third_party/mkl/BUILD
@@ -47,6 +47,9 @@ config_setting(
Expand Down
12 changes: 6 additions & 6 deletions third_party/tensorflow/mkl_dnn.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/third_party/mkl_dnn/mkldnn_acl.BUILD b/third_party/mkl_dnn/mkldnn_acl.BUILD
index 017abff688a..19d90053006 100644
index cafe160f433..5915d0c9f6d 100644
--- a/third_party/mkl_dnn/mkldnn_acl.BUILD
+++ b/third_party/mkl_dnn/mkldnn_acl.BUILD
@@ -72,7 +72,6 @@ cc_library(
"src/cpu/aarch64/xbyak_aarch64/src",
@@ -61,7 +61,6 @@ cc_library(
"src/cpu/aarch64/xbyak_aarch64/xbyak_aarch64",
"src/cpu/gemm",
],
- linkopts = ["-lgomp"],
visibility = ["//visibility:public"],
deps = [
"@compute_library//:arm_compute_graph",
textual_hdrs = glob(
[
"include/**/*",
42 changes: 34 additions & 8 deletions third_party/tensorflow/tensorflow.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/tensorflow/compiler/xla/service/llvm_ir/llvm_util.cc b/tensorflow/compiler/xla/service/llvm_ir/llvm_util.cc
index 06ea682d4b4..156c55d29fd 100644
index 14651d99e8c..9e233fbd003 100644
--- a/tensorflow/compiler/xla/service/llvm_ir/llvm_util.cc
+++ b/tensorflow/compiler/xla/service/llvm_ir/llvm_util.cc
@@ -378,10 +378,17 @@ static void LogS64(const char* tag, int64 value) {
Expand All @@ -18,20 +18,33 @@ index 06ea682d4b4..156c55d29fd 100644
{b->getInt64(absl::bit_cast<int64>(tag)), value});
+#endif
}

void SetAlignmentMetadataForLoad(llvm::LoadInst* load, uint64_t alignment) {
diff --git a/tensorflow/core/common_runtime/threadpool_device.cc b/tensorflow/core/common_runtime/threadpool_device.cc
index b342a03966b..a513784fc39 100644
--- a/tensorflow/core/common_runtime/threadpool_device.cc
+++ b/tensorflow/core/common_runtime/threadpool_device.cc
@@ -16,7 +16,7 @@ limitations under the License.
#if defined(ENABLE_ONEDNN_OPENMP) && defined(ENABLE_MKL) && defined(_OPENMP)
#ifndef DNNL_AARCH64_USE_ACL
// Using LLVM's OpenMP header
-#include "external/llvm_openmp/include/omp.h"
+#include "omp.h"
/* Added EIGEN_DONT_PARALLELIZE to avoid duplicating omp.h, please refer to
this link https://eigen.tuxfamily.org/dox/TopicMultiThreading.html for more
info. It does not have any negative impact on performance. */
diff --git a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc
index d61a036181d..cd982a85e42 100644
--- a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc
+++ b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc
@@ -15,7 +15,7 @@ limitations under the License.

#include "tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h"

-#if defined(__ANDROID__) && (__ANDROID_API__ >= 21) && \
+#if (defined(__ANDROID__) && (__ANDROID_API__ >= 21)) || defined(__linux__) && \
(defined(__ARM_ARCH_7A__) || defined(__aarch64__))

#include <asm/unistd.h>
diff --git a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h
index 66bc0fd5928..ac2be9af930 100644
Expand All @@ -40,14 +53,14 @@ index 66bc0fd5928..ac2be9af930 100644
@@ -22,7 +22,7 @@ limitations under the License.
#include "tensorflow/core/platform/profile_utils/i_cpu_utils_helper.h"
#include "tensorflow/core/platform/types.h"

-#if defined(__ANDROID__) && (__ANDROID_API__ >= 21) && \
+#if (defined(__ANDROID__) && (__ANDROID_API__ >= 21)) || defined(__linux__) && \
(defined(__ARM_ARCH_7A__) || defined(__aarch64__))

struct perf_event_attr;
diff --git a/tensorflow/core/platform/profile_utils/cpu_utils.cc b/tensorflow/core/platform/profile_utils/cpu_utils.cc
index 5f693d73a98..a4f88aac92f 100644
index 4cc498ab412..468e4862648 100644
--- a/tensorflow/core/platform/profile_utils/cpu_utils.cc
+++ b/tensorflow/core/platform/profile_utils/cpu_utils.cc
@@ -80,6 +80,15 @@ static ICpuUtilsHelper* cpu_utils_helper_instance_ = nullptr;
Expand Down Expand Up @@ -75,3 +88,16 @@ index 5f693d73a98..a4f88aac92f 100644
(defined(__ARM_ARCH_7A__) || defined(__aarch64__))
cpu_utils_helper_instance_ = new AndroidArmV7ACpuUtilsHelper();
#else
diff --git a/tensorflow/workspace1.bzl b/tensorflow/workspace1.bzl
index 6fa7f2f5828..2bdcb4d53db 100644
--- a/tensorflow/workspace1.bzl
+++ b/tensorflow/workspace1.bzl
@@ -8,7 +8,7 @@ load("@rules_cuda//cuda:dependencies.bzl", "rules_cuda_dependencies")

def workspace():
native.register_toolchains("@local_config_python//:py_toolchain")
- rules_cuda_dependencies()
+ rules_cuda_dependencies(with_rules_cc=False)

closure_repositories()
bazel_toolchains_archive()
4 changes: 2 additions & 2 deletions third_party/tf_text/tftext.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/tensorflow_text/tftext.bzl b/tensorflow_text/tftext.bzl
index 8ca1a37..c7acdac 100644
index 7f703b3..d2c590a 100644
--- a/tensorflow_text/tftext.bzl
+++ b/tensorflow_text/tftext.bzl
@@ -98,8 +98,7 @@ def tf_deps(deps = []):
@@ -93,8 +93,7 @@ def tf_deps(deps = []):
"@org_tensorflow//tensorflow/core:portable_tensorflow_lib_lite",
],
"//conditions:default": [
Expand Down

0 comments on commit ef41cec

Please sign in to comment.