Skip to content

Commit

Permalink
Upgrade tensorflow and flatbuffers
Browse files Browse the repository at this point in the history
Summary:
This upgrades tensorflow and flatbuffers to the corresponding version
expected by tensorflow. Also removes com_google_googleapis override which doesn't
seem necessary anymore.

This unblocks upgrade to bazel 6.

Test Plan: All existing builds and tests work.

Reviewers: zasgar, jamesbartlett, michelle, #third_party_approvers

Reviewed By: zasgar, #third_party_approvers

Signed-off-by: Vihang Mehta <[email protected]>

Differential Revision: https://phab.corp.pixielabs.ai/D12640

GitOrigin-RevId: fac4f1cddf3663231d01f5bc37e0b120e2b4b753
  • Loading branch information
vihangm authored and copybaranaut committed Dec 22, 2022
1 parent 00a76c5 commit dbc9ccc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 37 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ tf_workspace2()

load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")

tf_workspace1()
tf_workspace1(with_rules_cc = False)

load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")

Expand Down
36 changes: 16 additions & 20 deletions bazel/external/tensorflow.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/tensorflow/lite/build_def.bzl b/tensorflow/lite/build_def.bzl
index 43015747773..aca30b42527 100644
index b9bf02b373d..2e8b262c6d3 100644
--- a/tensorflow/lite/build_def.bzl
+++ b/tensorflow/lite/build_def.bzl
@@ -16,6 +16,7 @@ def tflite_copts():
Expand All @@ -11,23 +11,19 @@ index 43015747773..aca30b42527 100644
clean_dep("//tensorflow:android_arm"): [
"-mfpu=neon",
diff --git a/tensorflow/workspace1.bzl b/tensorflow/workspace1.bzl
index 809b811eb1a..c9341ee70bc 100644
index fb72d54e4d6..0ece61ce702 100644
--- a/tensorflow/workspace1.bzl
+++ b/tensorflow/workspace1.bzl
@@ -7,8 +7,9 @@ load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
load("@rules_cuda//cuda:dependencies.bzl", "rules_cuda_dependencies")

def workspace():
@@ -14,7 +14,6 @@ def workspace(with_rules_cc = True):
Args:
with_rules_cc: whether to load and patch rules_cc repository.
"""
- native.register_toolchains("@local_config_python//:py_toolchain")
- rules_cuda_dependencies()
+ # Disable py_toolchain, since I can't get it to work. If someone needs it in the future they'll have to figure out tensorflow's //third_party/py:python_configure.bzl system.
+ # Disable rules_cc patching for CUDA since we don't need CUDA and it doesn't work with Pixie's build system.
+ rules_cuda_dependencies(with_rules_cc=False)

closure_repositories()
rules_cuda_dependencies(with_rules_cc)
rules_pkg_dependencies()

diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl
index 77c76aa6e20..0395ce62d99 100644
index 18b63ab47fb..92993d7c341 100644
--- a/tensorflow/workspace2.bzl
+++ b/tensorflow/workspace2.bzl
@@ -14,7 +14,7 @@ load("//tensorflow/tools/toolchains/embedded/arm-linux:arm_linux_toolchain_confi
Expand All @@ -39,8 +35,8 @@ index 77c76aa6e20..0395ce62d99 100644

# Import third party repository rules. See go/tfbr-thirdparty.
load("//third_party/FP16:workspace.bzl", FP16 = "repo")
@@ -516,7 +516,7 @@ def _tf_repositories():
urls = tf_mirror_urls("https://github.com/antirez/linenoise/archive/c894b9e59f02203dbe4e2be657572cf88c4230c3.tar.gz"),
@@ -530,7 +530,7 @@ def _tf_repositories():
urls = tf_mirror_urls("https://github.com/antirez/linenoise/archive/4ce393a66b10903a0ef52edf9775ed526a17395f.tar.gz"),
)

- llvm_setup(name = "llvm-project")
Expand All @@ -49,10 +45,10 @@ index 77c76aa6e20..0395ce62d99 100644
# Intel openMP that is part of LLVM sources.
tf_http_archive(
diff --git a/tensorflow/workspace3.bzl b/tensorflow/workspace3.bzl
index 61d18b566c6..ad351fbe726 100644
index a6c2c5c5835..3866493fcc9 100644
--- a/tensorflow/workspace3.bzl
+++ b/tensorflow/workspace3.bzl
@@ -39,7 +39,7 @@ def workspace():
@@ -38,7 +38,7 @@ def workspace():

# Load the raw llvm-project. llvm does not have build rules set up by default,
# but provides a script for setting up build rules via overlays.
Expand All @@ -62,7 +58,7 @@ index 61d18b566c6..ad351fbe726 100644
# Alias so it can be loaded without assigning to a different symbol to prevent
# shadowing previous loads and trigger a buildifier warning.
diff --git a/third_party/llvm/workspace.bzl b/third_party/llvm/workspace.bzl
index 82d0f71ccbd..94104822e98 100644
index 5c61810c5f0..b095208c079 100644
--- a/third_party/llvm/workspace.bzl
+++ b/third_party/llvm/workspace.bzl
@@ -12,7 +12,6 @@ def repo(name):
Expand All @@ -74,7 +70,7 @@ index 82d0f71ccbd..94104822e98 100644
],
build_file = "//third_party/llvm:llvm.BUILD",
diff --git a/third_party/repo.bzl b/third_party/repo.bzl
index 795f0b00b98..eb594737728 100644
index bda9e9518b4..4d294fbacbe 100644
--- a/third_party/repo.bzl
+++ b/third_party/repo.bzl
@@ -20,12 +20,8 @@ def tf_mirror_urls(url):
Expand All @@ -92,7 +88,7 @@ index 795f0b00b98..eb594737728 100644

def _get_env_var(ctx, name):
if name in ctx.os.environ:
@@ -106,23 +102,10 @@ def tf_http_archive(name, sha256, urls, **kwargs):
@@ -114,23 +110,10 @@ def tf_http_archive(name, sha256, urls, **kwargs):
labels (e.g. '@foo//:bar') or from a label created in their repository (e.g.
'str(Label("//:bar"))').
"""
Expand Down
1 change: 0 additions & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def _pl_deps():
_bazel_repo("rules_python")
_bazel_repo("rules_pkg")
_bazel_repo("com_github_bazelbuild_buildtools")
_bazel_repo("com_google_googleapis")
_bazel_repo("com_github_fmeum_rules_meta")
_bazel_repo("com_google_protobuf_javascript", patches = ["//bazel/external:protobuf_javascript.patch"], patch_args = ["-p1"])

Expand Down
21 changes: 6 additions & 15 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,9 @@ REPOSITORY_LOCATIONS = dict(
urls = ["https://github.com/google/farmhash/archive/2f0e005b81e296fa6963e395626137cf729b710c.tar.gz"],
),
com_google_flatbuffers = dict(
sha256 = "9ddb9031798f4f8754d00fca2f1a68ecf9d0f83dfac7239af1311e4fd9a565c4",
strip_prefix = "flatbuffers-2.0.0",
urls = ["https://github.com/google/flatbuffers/archive/refs/tags/v2.0.0.tar.gz"],
),
# To workaround issues in TF 2.9.1 bazel workspace setup, we directly load this library that tensorflow should have loaded itself.
com_google_googleapis = dict(
sha256 = "5bb6b0253ccf64b53d6c7249625a7e3f6c3bc6402abd52d3778bfa48258703a0",
strip_prefix = "googleapis-2f9af297c84c55c8b871ba4495e01ade42476c92",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/googleapis/googleapis/archive/2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz",
"https://github.com/googleapis/googleapis/archive/2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz",
],
sha256 = "e2dc24985a85b278dd06313481a9ca051d048f9474e0f199e372fea3ea4248c9",
strip_prefix = "flatbuffers-2.0.6",
urls = ["https://github.com/google/flatbuffers/archive/refs/tags/v2.0.6.tar.gz"],
),
com_google_googletest = dict(
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
Expand Down Expand Up @@ -337,9 +328,9 @@ REPOSITORY_LOCATIONS = dict(
strip_prefix = "rules_scala-4ba3780fcba8d26980daff4639abc6f18517308b",
),
org_tensorflow = dict(
sha256 = "6eaf86ead73e23988fe192da1db68f4d3828bcdd0f3a9dc195935e339c95dbdc",
strip_prefix = "tensorflow-2.9.1",
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.9.1.tar.gz"],
sha256 = "99c732b92b1b37fc243a559e02f9aef5671771e272758aa4aec7f34dc92dac48",
strip_prefix = "tensorflow-2.11.0",
urls = ["https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.11.0.tar.gz"],
),
rules_foreign_cc = dict(
sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc",
Expand Down

0 comments on commit dbc9ccc

Please sign in to comment.