Skip to content

Commit 2b698b3

Browse files
committed
Upgrade to TensorFlow 2.21.0 and fix build issues
1 parent 53fcdd7 commit 2b698b3

54 files changed

Lines changed: 391 additions & 431 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,22 @@ build:linux --copt=-w
3535
build:macos --copt=-w
3636

3737
# By default, build TF in C++ 17 mode.
38-
build:linux --cxxopt=-std=c++17
38+
build --cxxopt=-std=c++17
39+
build --host_cxxopt=-std=c++17
3940
build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1
40-
build:linux --host_cxxopt=-std=c++17
41-
build:macos --cxxopt=-std=c++17
4241
build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1
43-
build:macos --host_cxxopt=-std=c++17
42+
43+
# Disable sframe in assembler to avoid linker errors with gcc 15
44+
build:linux --copt=-Wa,--gsframe=no
45+
46+
47+
4448

4549

4650
# Suppress all warning messages.
4751
build:short_logs --output_filter=DONT_MATCH_ANYTHING
4852

4953
build:macos --macos_minimum_os=10.12
54+
build --action_env TF_HEADER_DIR="/usr/local/google/home/vkarampudi/anaconda3/lib/python3.12/site-packages/tensorflow/include"
55+
build --action_env TF_SHARED_LIBRARY_DIR="/usr/local/google/home/vkarampudi/anaconda3/lib/python3.12/site-packages/tensorflow"
56+
build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.so.2"

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.5.0

WORKSPACE

Lines changed: 122 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,58 @@
1616

1717
workspace(name = "struct2tensor")
1818

19+
local_repository(
20+
name = "python_version_repo",
21+
path = "third_party/python_version_repo",
22+
)
23+
24+
local_repository(
25+
name = "python_3_11_host",
26+
path = "third_party/python_3_11_host",
27+
)
28+
29+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
30+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
31+
32+
local_repository(
33+
name = "rules_java",
34+
path = "third_party/rules_java",
35+
)
36+
37+
local_repository(
38+
name = "local_config_cuda",
39+
path = "third_party/local_config_cuda",
40+
)
41+
42+
local_repository(
43+
name = "local_config_tensorrt",
44+
path = "third_party/local_config_tensorrt",
45+
)
46+
47+
local_repository(
48+
name = "local_config_rocm",
49+
path = "third_party/local_config_rocm",
50+
)
51+
52+
local_repository(
53+
name = "local_config_sycl",
54+
path = "third_party/local_config_sycl",
55+
)
56+
57+
local_repository(
58+
name = "tf_wheel_version_suffix",
59+
path = "third_party/tf_wheel_version_suffix",
60+
)
61+
62+
maybe(
63+
http_archive,
64+
name = "platforms",
65+
urls = [
66+
"https://github.com/bazelbuild/platforms/releases/download/0.0.11/platforms-0.0.11.tar.gz",
67+
],
68+
sha256 = "29742e87275809b5e598dc2f04d86960cc7a55b3067d97221c9abbc9926bff0f",
69+
)
70+
1971
load("//tf:tf_configure.bzl", "tf_configure")
2072

2173
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
@@ -26,22 +78,46 @@ tf_configure(name = "local_config_tf")
2678

2779
#####################################################################################
2880

81+
82+
83+
# ===== Abseil dependency =====
2984
http_archive(
30-
name = "zlib",
31-
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
32-
sha256 = "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c",
33-
strip_prefix = "zlib-1.3.1",
34-
urls = ["https://github.com/madler/zlib/archive/v1.3.1.tar.gz"],
85+
name = "com_google_absl",
86+
sha256 = "d1abe9da2003e6cbbd7619b0ced3e52047422f4f4ac6c66a9bef5d2e99fea837",
87+
strip_prefix = "abseil-cpp-d38452e1ee03523a208362186fd42248ff2609f6",
88+
urls = [
89+
"https://github.com/abseil/abseil-cpp/archive/d38452e1ee03523a208362186fd42248ff2609f6.tar.gz",
90+
],
91+
patches = [
92+
"//third_party:abseil_visibility.patch",
93+
],
94+
patch_args = ["-p0"],
95+
)
96+
97+
http_archive(
98+
name = "abseil-cpp",
99+
sha256 = "d1abe9da2003e6cbbd7619b0ced3e52047422f4f4ac6c66a9bef5d2e99fea837",
100+
strip_prefix = "abseil-cpp-d38452e1ee03523a208362186fd42248ff2609f6",
101+
urls = [
102+
"https://github.com/abseil/abseil-cpp/archive/d38452e1ee03523a208362186fd42248ff2609f6.tar.gz",
103+
],
104+
patches = [
105+
"//third_party:abseil_visibility.patch",
106+
],
107+
patch_args = ["-p0"],
35108
)
36109

37-
# ===== Protobuf 4.25.6 dependency =====
110+
111+
112+
113+
# ===== Protobuf 6.31.1 dependency =====
38114
# Must be declared BEFORE TensorFlow's workspaces to override the version they pull
39115
http_archive(
40116
name = "com_google_protobuf",
41-
sha256 = "4e6727bc5d23177edefa3ad86fd2f5a92cd324151636212fd1f7f13aef3fd2b7",
42-
strip_prefix = "protobuf-4.25.6",
117+
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
118+
strip_prefix = "protobuf-6.31.1",
43119
urls = [
44-
"https://github.com/protocolbuffers/protobuf/archive/v4.25.6.tar.gz",
120+
"https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip",
45121
],
46122
)
47123

@@ -60,8 +136,8 @@ http_archive(
60136
# 3. Request the new archive to be mirrored on mirror.bazel.build for more
61137
# reliable downloads.
62138

63-
_TENSORFLOW_GIT_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" # tf 2.17.1
64-
_TENSORFLOW_ARCHIVE_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68"
139+
_TENSORFLOW_GIT_COMMIT = "2.21.0" # tf 2.21.0
140+
_TENSORFLOW_ARCHIVE_SHA256 = "ef3568bb4865d6c1b2564fb5689c19b6b9a5311572cd1f2ff9198636a8520921"
65141

66142
http_archive(
67143
name = "org_tensorflow",
@@ -72,11 +148,43 @@ http_archive(
72148
strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT,
73149
patches = ["//third_party:tensorflow.patch"],
74150
patch_args = ["-p1"],
151+
repo_mapping = {
152+
"@abseil-cpp": "@com_google_absl",
153+
},
154+
)
155+
156+
http_archive(
157+
name = "llvm-raw",
158+
sha256 = "3f986184ee126677dbd77edb16d6b82c057ec869fefd7a9871979941e52e837a",
159+
strip_prefix = "llvm-project-909041e4802c4b9a2223ca04099f35bf1dbbd460",
160+
urls = [
161+
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/909041e4802c4b9a2223ca04099f35bf1dbbd460.tar.gz",
162+
"https://github.com/llvm/llvm-project/archive/909041e4802c4b9a2223ca04099f35bf1dbbd460.tar.gz",
163+
],
164+
build_file = "@xla//third_party/llvm:llvm.BUILD",
165+
patches = [
166+
"@xla//third_party/llvm:generated.patch",
167+
"@xla//third_party/llvm:build.patch",
168+
"@xla//third_party/llvm:mathextras.patch",
169+
"@xla//third_party/llvm:toolchains.patch",
170+
"@xla//third_party/llvm:zstd.patch",
171+
"@xla//third_party/llvm:lit_test.patch",
172+
"//third_party:llvm_configure.patch",
173+
],
174+
patch_args = ["-p1"],
175+
)
176+
177+
http_archive(
178+
name = "zlib",
179+
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
180+
sha256 = "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c",
181+
strip_prefix = "zlib-1.3.1",
182+
urls = ["https://github.com/madler/zlib/archive/v1.3.1.tar.gz"],
75183
)
76184

77-
load("//third_party:python_configure.bzl", "local_python_configure")
78-
local_python_configure(name = "local_config_python")
79-
local_python_configure(name = "local_execution_config_python")
185+
# load("//third_party:python_configure.bzl", "local_python_configure")
186+
# local_python_configure(name = "local_config_python")
187+
# local_python_configure(name = "local_execution_config_python")
80188

81189

82190
# Please add all new struct2tensor dependencies in workspace.bzl.

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ def select_constraint(default, nightly=None, git_master=None):
7979
# TODO(b/263060885): Remove the explicit numpy dependency once TF works
8080
# with numpy>=1.24.
8181
'numpy>=1.22',
82-
'protobuf>=4.25.2,<6.0.0;python_version>="3.11"',
83-
'protobuf>=4.21.6,<6.0.0;python_version<"3.11"',
84-
'tensorflow>=2.17,<2.18',
82+
'protobuf>=4.25.2,<7.0.0;python_version>="3.11"',
83+
'protobuf>=4.21.6,<7.0.0;python_version<"3.11"',
84+
'tensorflow>=2.21,<2.22',
8585
'tensorflow-metadata'
8686
+ select_constraint(
8787
default='>=1.17.0,<1.18.0',
8888
nightly='>=1.18.0.dev',
8989
git_master='@git+https://github.com/tensorflow/metadata@master',
9090
),
91-
'pyarrow>=10,<11',
91+
'pyarrow>=14',
9292
],
9393
# Add in any packaged data.
9494
include_package_data=True,

struct2tensor/kernels/equi_join_any_indices_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818
// This differs from equi_join_indices in that vectors a,b do not need to be
1919
// monotonically increasing.
2020

21+
#include <cstdint>
2122
#include "tensorflow/core/framework/op.h"
2223
#include "tensorflow/core/framework/op_kernel.h"
2324
#include "tensorflow/core/framework/shape_inference.h"

struct2tensor/kernels/equi_join_indices_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222
// Notice that when combined with tf.gather(...), this can be used to do "some"
2323
// sparse_gather operations.
2424

25+
#include <cstdint>
2526
#include "tensorflow/core/framework/op.h"
2627
#include "tensorflow/core/framework/op_kernel.h"
2728
#include "tensorflow/core/framework/shape_inference.h"

struct2tensor/kernels/parquet/parquet_dataset_kernel.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15+
#include <cstdint>
1516
#include "absl/container/flat_hash_map.h"
1617
#include "struct2tensor/kernels/parquet/parquet_reader.h"
1718
#include "struct2tensor/kernels/parquet/parquet_reader_util.h"

struct2tensor/kernels/run_length_before_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616
// b_n := \sum_{i=0}^{n-1} I(a_i=a_n)
1717
// This assumes that for all a_i, a_j, if i <= j, then a_i <= a_j.
1818

19+
#include <cstdint>
1920
#include "tensorflow/core/framework/op.h"
2021
#include "tensorflow/core/framework/op_kernel.h"
2122
#include "tensorflow/core/framework/shape_inference.h"

struct2tensor/ops/decode_proto_map_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include <cstdint>
1617
#include "tensorflow/core/framework/op.h"
1718
#include "tensorflow/core/framework/shape_inference.h"
1819

struct2tensor/ops/decode_proto_sparse_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include <cstdint>
1617
#include "tensorflow/core/framework/op.h"
1718
#include "tensorflow/core/framework/shape_inference.h"
1819

0 commit comments

Comments
 (0)