From 2b698b31f228dfac7f0096bd1e6ea1bac359aa61 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Fri, 10 Apr 2026 19:03:43 +0000 Subject: [PATCH 01/32] Upgrade to TensorFlow 2.21.0 and fix build issues --- .bazelrc | 15 +- .bazelversion | 1 + WORKSPACE | 136 ++++- setup.py | 8 +- .../kernels/equi_join_any_indices_op.cc | 1 + struct2tensor/kernels/equi_join_indices_op.cc | 1 + .../kernels/parquet/parquet_dataset_kernel.cc | 1 + struct2tensor/kernels/run_length_before_op.cc | 1 + struct2tensor/ops/decode_proto_map_op.cc | 1 + struct2tensor/ops/decode_proto_sparse_op.cc | 1 + struct2tensor/ops/equi_join_any_indices_op.cc | 1 + struct2tensor/ops/equi_join_indices_op.cc | 1 + .../ops/op_kernel_registration_test.cc | 1 + struct2tensor/ops/parquet_dataset_op.cc | 1 + struct2tensor/ops/run_length_before_op.cc | 1 + third_party/abseil_visibility.patch | 7 + third_party/llvm_configure.patch | 11 + third_party/local_config_cuda/BUILD | 5 + third_party/local_config_cuda/WORKSPACE | 0 third_party/local_config_cuda/cuda/BUILD | 0 .../local_config_cuda/cuda/build_defs.bzl | 20 + third_party/local_config_rocm/BUILD | 0 third_party/local_config_rocm/WORKSPACE | 0 third_party/local_config_rocm/rocm/BUILD | 9 + .../local_config_rocm/rocm/build_defs.bzl | 26 + third_party/local_config_sycl/BUILD | 0 third_party/local_config_sycl/WORKSPACE | 0 third_party/local_config_sycl/sycl/BUILD | 0 .../local_config_sycl/sycl/build_defs.bzl | 7 + third_party/local_config_tensorrt/BUILD | 0 third_party/local_config_tensorrt/WORKSPACE | 0 .../local_config_tensorrt/build_defs.bzl | 5 + third_party/python_3_11_host/BUILD | 1 + third_party/python_3_11_host/WORKSPACE | 0 third_party/python_3_11_host/python | 2 + third_party/python_version_repo/BUILD | 1 + third_party/python_version_repo/WORKSPACE | 0 .../python_version_repo/py_version.bzl | 2 + third_party/rules_java/BUILD | 1 + third_party/rules_java/WORKSPACE | 0 third_party/rules_java/java/BUILD | 0 third_party/rules_java/java/common/BUILD | 0 .../rules_java/java/common/java_common.bzl | 1 + .../rules_java/java/common/java_info.bzl | 1 + .../java/common/proguard_spec_info.bzl | 1 + third_party/rules_java/java/defs.bzl | 21 + third_party/rules_java/java/private/BUILD | 0 .../rules_java/java/private/proto_support.bzl | 5 + third_party/rules_java/java/proto/BUILD | 4 + .../rules_java/java/rules_java_deps.bzl | 2 + third_party/tensorflow.patch | 517 ++++-------------- third_party/tf_wheel_version_suffix/BUILD | 0 third_party/tf_wheel_version_suffix/WORKSPACE | 0 .../wheel_version_suffix.bzl | 2 + 54 files changed, 391 insertions(+), 431 deletions(-) create mode 100644 third_party/abseil_visibility.patch create mode 100644 third_party/llvm_configure.patch create mode 100644 third_party/local_config_cuda/BUILD create mode 100644 third_party/local_config_cuda/WORKSPACE create mode 100644 third_party/local_config_cuda/cuda/BUILD create mode 100644 third_party/local_config_cuda/cuda/build_defs.bzl create mode 100644 third_party/local_config_rocm/BUILD create mode 100644 third_party/local_config_rocm/WORKSPACE create mode 100644 third_party/local_config_rocm/rocm/BUILD create mode 100644 third_party/local_config_rocm/rocm/build_defs.bzl create mode 100644 third_party/local_config_sycl/BUILD create mode 100644 third_party/local_config_sycl/WORKSPACE create mode 100644 third_party/local_config_sycl/sycl/BUILD create mode 100644 third_party/local_config_sycl/sycl/build_defs.bzl create mode 100644 third_party/local_config_tensorrt/BUILD create mode 100644 third_party/local_config_tensorrt/WORKSPACE create mode 100644 third_party/local_config_tensorrt/build_defs.bzl create mode 100644 third_party/python_3_11_host/BUILD create mode 100644 third_party/python_3_11_host/WORKSPACE create mode 100755 third_party/python_3_11_host/python create mode 100644 third_party/python_version_repo/BUILD create mode 100644 third_party/python_version_repo/WORKSPACE create mode 100644 third_party/python_version_repo/py_version.bzl create mode 100644 third_party/rules_java/BUILD create mode 100644 third_party/rules_java/WORKSPACE create mode 100644 third_party/rules_java/java/BUILD create mode 100644 third_party/rules_java/java/common/BUILD create mode 100644 third_party/rules_java/java/common/java_common.bzl create mode 100644 third_party/rules_java/java/common/java_info.bzl create mode 100644 third_party/rules_java/java/common/proguard_spec_info.bzl create mode 100644 third_party/rules_java/java/defs.bzl create mode 100644 third_party/rules_java/java/private/BUILD create mode 100644 third_party/rules_java/java/private/proto_support.bzl create mode 100644 third_party/rules_java/java/proto/BUILD create mode 100644 third_party/rules_java/java/rules_java_deps.bzl create mode 100644 third_party/tf_wheel_version_suffix/BUILD create mode 100644 third_party/tf_wheel_version_suffix/WORKSPACE create mode 100644 third_party/tf_wheel_version_suffix/wheel_version_suffix.bzl diff --git a/.bazelrc b/.bazelrc index 5f706c86..82d6a8a1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -35,15 +35,22 @@ build:linux --copt=-w build:macos --copt=-w # By default, build TF in C++ 17 mode. -build:linux --cxxopt=-std=c++17 +build --cxxopt=-std=c++17 +build --host_cxxopt=-std=c++17 build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 -build:linux --host_cxxopt=-std=c++17 -build:macos --cxxopt=-std=c++17 build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 -build:macos --host_cxxopt=-std=c++17 + +# Disable sframe in assembler to avoid linker errors with gcc 15 +build:linux --copt=-Wa,--gsframe=no + + + # Suppress all warning messages. build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 +build --action_env TF_HEADER_DIR="/usr/local/google/home/vkarampudi/anaconda3/lib/python3.12/site-packages/tensorflow/include" +build --action_env TF_SHARED_LIBRARY_DIR="/usr/local/google/home/vkarampudi/anaconda3/lib/python3.12/site-packages/tensorflow" +build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.so.2" diff --git a/.bazelversion b/.bazelversion index e69de29b..f22d756d 100644 --- a/.bazelversion +++ b/.bazelversion @@ -0,0 +1 @@ +6.5.0 diff --git a/WORKSPACE b/WORKSPACE index dcede96d..1fd18802 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -16,6 +16,58 @@ workspace(name = "struct2tensor") +local_repository( + name = "python_version_repo", + path = "third_party/python_version_repo", +) + +local_repository( + name = "python_3_11_host", + path = "third_party/python_3_11_host", +) + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +local_repository( + name = "rules_java", + path = "third_party/rules_java", +) + +local_repository( + name = "local_config_cuda", + path = "third_party/local_config_cuda", +) + +local_repository( + name = "local_config_tensorrt", + path = "third_party/local_config_tensorrt", +) + +local_repository( + name = "local_config_rocm", + path = "third_party/local_config_rocm", +) + +local_repository( + name = "local_config_sycl", + path = "third_party/local_config_sycl", +) + +local_repository( + name = "tf_wheel_version_suffix", + path = "third_party/tf_wheel_version_suffix", +) + +maybe( + http_archive, + name = "platforms", + urls = [ + "https://github.com/bazelbuild/platforms/releases/download/0.0.11/platforms-0.0.11.tar.gz", + ], + sha256 = "29742e87275809b5e598dc2f04d86960cc7a55b3067d97221c9abbc9926bff0f", +) + load("//tf:tf_configure.bzl", "tf_configure") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") @@ -26,22 +78,46 @@ tf_configure(name = "local_config_tf") ##################################################################################### + + +# ===== Abseil dependency ===== http_archive( - name = "zlib", - build_file = "@com_google_protobuf//:third_party/zlib.BUILD", - sha256 = "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c", - strip_prefix = "zlib-1.3.1", - urls = ["https://github.com/madler/zlib/archive/v1.3.1.tar.gz"], + name = "com_google_absl", + sha256 = "d1abe9da2003e6cbbd7619b0ced3e52047422f4f4ac6c66a9bef5d2e99fea837", + strip_prefix = "abseil-cpp-d38452e1ee03523a208362186fd42248ff2609f6", + urls = [ + "https://github.com/abseil/abseil-cpp/archive/d38452e1ee03523a208362186fd42248ff2609f6.tar.gz", + ], + patches = [ + "//third_party:abseil_visibility.patch", + ], + patch_args = ["-p0"], +) + +http_archive( + name = "abseil-cpp", + sha256 = "d1abe9da2003e6cbbd7619b0ced3e52047422f4f4ac6c66a9bef5d2e99fea837", + strip_prefix = "abseil-cpp-d38452e1ee03523a208362186fd42248ff2609f6", + urls = [ + "https://github.com/abseil/abseil-cpp/archive/d38452e1ee03523a208362186fd42248ff2609f6.tar.gz", + ], + patches = [ + "//third_party:abseil_visibility.patch", + ], + patch_args = ["-p0"], ) -# ===== Protobuf 4.25.6 dependency ===== + + + +# ===== Protobuf 6.31.1 dependency ===== # Must be declared BEFORE TensorFlow's workspaces to override the version they pull http_archive( name = "com_google_protobuf", - sha256 = "4e6727bc5d23177edefa3ad86fd2f5a92cd324151636212fd1f7f13aef3fd2b7", - strip_prefix = "protobuf-4.25.6", + sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88", + strip_prefix = "protobuf-6.31.1", urls = [ - "https://github.com/protocolbuffers/protobuf/archive/v4.25.6.tar.gz", + "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip", ], ) @@ -60,8 +136,8 @@ http_archive( # 3. Request the new archive to be mirrored on mirror.bazel.build for more # reliable downloads. -_TENSORFLOW_GIT_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" # tf 2.17.1 -_TENSORFLOW_ARCHIVE_SHA256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68" +_TENSORFLOW_GIT_COMMIT = "2.21.0" # tf 2.21.0 +_TENSORFLOW_ARCHIVE_SHA256 = "ef3568bb4865d6c1b2564fb5689c19b6b9a5311572cd1f2ff9198636a8520921" http_archive( name = "org_tensorflow", @@ -72,11 +148,43 @@ http_archive( strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT, patches = ["//third_party:tensorflow.patch"], patch_args = ["-p1"], + repo_mapping = { + "@abseil-cpp": "@com_google_absl", + }, +) + +http_archive( + name = "llvm-raw", + sha256 = "3f986184ee126677dbd77edb16d6b82c057ec869fefd7a9871979941e52e837a", + strip_prefix = "llvm-project-909041e4802c4b9a2223ca04099f35bf1dbbd460", + urls = [ + "https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/909041e4802c4b9a2223ca04099f35bf1dbbd460.tar.gz", + "https://github.com/llvm/llvm-project/archive/909041e4802c4b9a2223ca04099f35bf1dbbd460.tar.gz", + ], + build_file = "@xla//third_party/llvm:llvm.BUILD", + patches = [ + "@xla//third_party/llvm:generated.patch", + "@xla//third_party/llvm:build.patch", + "@xla//third_party/llvm:mathextras.patch", + "@xla//third_party/llvm:toolchains.patch", + "@xla//third_party/llvm:zstd.patch", + "@xla//third_party/llvm:lit_test.patch", + "//third_party:llvm_configure.patch", + ], + patch_args = ["-p1"], +) + +http_archive( + name = "zlib", + build_file = "@com_google_protobuf//:third_party/zlib.BUILD", + sha256 = "17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c", + strip_prefix = "zlib-1.3.1", + urls = ["https://github.com/madler/zlib/archive/v1.3.1.tar.gz"], ) -load("//third_party:python_configure.bzl", "local_python_configure") -local_python_configure(name = "local_config_python") -local_python_configure(name = "local_execution_config_python") +# load("//third_party:python_configure.bzl", "local_python_configure") +# local_python_configure(name = "local_config_python") +# local_python_configure(name = "local_execution_config_python") # Please add all new struct2tensor dependencies in workspace.bzl. diff --git a/setup.py b/setup.py index f072d746..8d1bce6a 100644 --- a/setup.py +++ b/setup.py @@ -79,16 +79,16 @@ def select_constraint(default, nightly=None, git_master=None): # TODO(b/263060885): Remove the explicit numpy dependency once TF works # with numpy>=1.24. 'numpy>=1.22', - 'protobuf>=4.25.2,<6.0.0;python_version>="3.11"', - 'protobuf>=4.21.6,<6.0.0;python_version<"3.11"', - 'tensorflow>=2.17,<2.18', + 'protobuf>=4.25.2,<7.0.0;python_version>="3.11"', + 'protobuf>=4.21.6,<7.0.0;python_version<"3.11"', + 'tensorflow>=2.21,<2.22', 'tensorflow-metadata' + select_constraint( default='>=1.17.0,<1.18.0', nightly='>=1.18.0.dev', git_master='@git+https://github.com/tensorflow/metadata@master', ), - 'pyarrow>=10,<11', + 'pyarrow>=14', ], # Add in any packaged data. include_package_data=True, diff --git a/struct2tensor/kernels/equi_join_any_indices_op.cc b/struct2tensor/kernels/equi_join_any_indices_op.cc index a4eade78..19e7fe4e 100644 --- a/struct2tensor/kernels/equi_join_any_indices_op.cc +++ b/struct2tensor/kernels/equi_join_any_indices_op.cc @@ -18,6 +18,7 @@ limitations under the License. // This differs from equi_join_indices in that vectors a,b do not need to be // monotonically increasing. +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/kernels/equi_join_indices_op.cc b/struct2tensor/kernels/equi_join_indices_op.cc index 0e881bc5..47f0906b 100644 --- a/struct2tensor/kernels/equi_join_indices_op.cc +++ b/struct2tensor/kernels/equi_join_indices_op.cc @@ -22,6 +22,7 @@ limitations under the License. // Notice that when combined with tf.gather(...), this can be used to do "some" // sparse_gather operations. +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/kernels/parquet/parquet_dataset_kernel.cc b/struct2tensor/kernels/parquet/parquet_dataset_kernel.cc index 449a8588..64daab02 100644 --- a/struct2tensor/kernels/parquet/parquet_dataset_kernel.cc +++ b/struct2tensor/kernels/parquet/parquet_dataset_kernel.cc @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "absl/container/flat_hash_map.h" #include "struct2tensor/kernels/parquet/parquet_reader.h" #include "struct2tensor/kernels/parquet/parquet_reader_util.h" diff --git a/struct2tensor/kernels/run_length_before_op.cc b/struct2tensor/kernels/run_length_before_op.cc index fc31d681..628726d8 100644 --- a/struct2tensor/kernels/run_length_before_op.cc +++ b/struct2tensor/kernels/run_length_before_op.cc @@ -16,6 +16,7 @@ limitations under the License. // b_n := \sum_{i=0}^{n-1} I(a_i=a_n) // This assumes that for all a_i, a_j, if i <= j, then a_i <= a_j. +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/ops/decode_proto_map_op.cc b/struct2tensor/ops/decode_proto_map_op.cc index f23b93a0..732f388e 100644 --- a/struct2tensor/ops/decode_proto_map_op.cc +++ b/struct2tensor/ops/decode_proto_map_op.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/ops/decode_proto_sparse_op.cc b/struct2tensor/ops/decode_proto_sparse_op.cc index 88e6d5fb..12c69cc2 100644 --- a/struct2tensor/ops/decode_proto_sparse_op.cc +++ b/struct2tensor/ops/decode_proto_sparse_op.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/ops/equi_join_any_indices_op.cc b/struct2tensor/ops/equi_join_any_indices_op.cc index 9d1a591b..d37fa02f 100644 --- a/struct2tensor/ops/equi_join_any_indices_op.cc +++ b/struct2tensor/ops/equi_join_any_indices_op.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/ops/equi_join_indices_op.cc b/struct2tensor/ops/equi_join_indices_op.cc index 25341d22..82347b3e 100644 --- a/struct2tensor/ops/equi_join_indices_op.cc +++ b/struct2tensor/ops/equi_join_indices_op.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/struct2tensor/ops/op_kernel_registration_test.cc b/struct2tensor/ops/op_kernel_registration_test.cc index 76973b53..a8cd1003 100644 --- a/struct2tensor/ops/op_kernel_registration_test.cc +++ b/struct2tensor/ops/op_kernel_registration_test.cc @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include #include diff --git a/struct2tensor/ops/parquet_dataset_op.cc b/struct2tensor/ops/parquet_dataset_op.cc index be20a613..279c8f66 100644 --- a/struct2tensor/ops/parquet_dataset_op.cc +++ b/struct2tensor/ops/parquet_dataset_op.cc @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/core/framework/common_shape_fns.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_def_builder.h" diff --git a/struct2tensor/ops/run_length_before_op.cc b/struct2tensor/ops/run_length_before_op.cc index 849f896f..72584729 100644 --- a/struct2tensor/ops/run_length_before_op.cc +++ b/struct2tensor/ops/run_length_before_op.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/shape_inference.h" diff --git a/third_party/abseil_visibility.patch b/third_party/abseil_visibility.patch new file mode 100644 index 00000000..3a16ecf9 --- /dev/null +++ b/third_party/abseil_visibility.patch @@ -0,0 +1,7 @@ +--- absl/base/BUILD.bazel ++++ absl/base/BUILD.bazel +@@ -546,3 +546,3 @@ + visibility = [ +- "//absl:__subpackages__", ++ "//visibility:public", + ], diff --git a/third_party/llvm_configure.patch b/third_party/llvm_configure.patch new file mode 100644 index 00000000..adf3c3e7 --- /dev/null +++ b/third_party/llvm_configure.patch @@ -0,0 +1,11 @@ +--- a/utils/bazel/configure.bzl ++++ b/utils/bazel/configure.bzl +@@ -53,7 +53,7 @@ + name = entry.basename + full_rel_path = rel_dir + "/" + name + +- if entry.is_dir: ++ if repository_ctx.execute(["test", "-d", str(entry)]).return_code == 0: + stack.append(full_rel_path) + overlay_dirs[name] = None + else: diff --git a/third_party/local_config_cuda/BUILD b/third_party/local_config_cuda/BUILD new file mode 100644 index 00000000..c359e10d --- /dev/null +++ b/third_party/local_config_cuda/BUILD @@ -0,0 +1,5 @@ +config_setting( + name = "is_cuda_enabled", + values = {"define": "never_match=true"}, + visibility = ["//visibility:public"], +) diff --git a/third_party/local_config_cuda/WORKSPACE b/third_party/local_config_cuda/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_cuda/cuda/BUILD b/third_party/local_config_cuda/cuda/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_cuda/cuda/build_defs.bzl b/third_party/local_config_cuda/cuda/build_defs.bzl new file mode 100644 index 00000000..fbc0db7a --- /dev/null +++ b/third_party/local_config_cuda/cuda/build_defs.bzl @@ -0,0 +1,20 @@ +def if_cuda_is_configured(x, no_cuda = []): + return no_cuda + +def is_cuda_configured(): + return False + +def if_cuda_newer_than(wanted_ver, if_true, if_false = []): + return if_false + +def if_cuda(if_true, if_false = []): + return if_false + +def cuda_library(**kwargs): + native.cc_library(**kwargs) + +def if_cuda_exec(if_true, if_false = []): + return if_false + +def cuda_gpu_architectures(): + return [] diff --git a/third_party/local_config_rocm/BUILD b/third_party/local_config_rocm/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_rocm/WORKSPACE b/third_party/local_config_rocm/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_rocm/rocm/BUILD b/third_party/local_config_rocm/rocm/BUILD new file mode 100644 index 00000000..ca5e267d --- /dev/null +++ b/third_party/local_config_rocm/rocm/BUILD @@ -0,0 +1,9 @@ +cc_library( + name = "hip", + visibility = ["//visibility:public"], +) + +cc_library( + name = "rocm_headers", + visibility = ["//visibility:public"], +) diff --git a/third_party/local_config_rocm/rocm/build_defs.bzl b/third_party/local_config_rocm/rocm/build_defs.bzl new file mode 100644 index 00000000..6612fa31 --- /dev/null +++ b/third_party/local_config_rocm/rocm/build_defs.bzl @@ -0,0 +1,26 @@ +def if_rocm(if_true, if_false = []): + return if_false + +def get_rbe_amdgpu_pool(**kwargs): + return "" + +def is_rocm_configured(): + return False + +def rocm_copts(**kwargs): + return [] + +def if_rocm_is_configured(x, no_rocm = []): + return no_rocm + +def if_cuda_or_rocm(if_true, if_false = []): + return if_false + +def if_gpu_is_configured(if_true, if_false = []): + return if_false + +def rocm_gpu_architectures(): + return [] + +def if_rocm_hipblaslt(if_true, if_false = []): + return if_false diff --git a/third_party/local_config_sycl/BUILD b/third_party/local_config_sycl/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_sycl/WORKSPACE b/third_party/local_config_sycl/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_sycl/sycl/BUILD b/third_party/local_config_sycl/sycl/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_sycl/sycl/build_defs.bzl b/third_party/local_config_sycl/sycl/build_defs.bzl new file mode 100644 index 00000000..283453e8 --- /dev/null +++ b/third_party/local_config_sycl/sycl/build_defs.bzl @@ -0,0 +1,7 @@ +load("@rules_cc//cc:cc_library.bzl", "cc_library") + +def if_sycl_is_configured(if_true, if_false = []): + return if_false + +def sycl_library(name, **kwargs): + cc_library(name = name) diff --git a/third_party/local_config_tensorrt/BUILD b/third_party/local_config_tensorrt/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_tensorrt/WORKSPACE b/third_party/local_config_tensorrt/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/local_config_tensorrt/build_defs.bzl b/third_party/local_config_tensorrt/build_defs.bzl new file mode 100644 index 00000000..c3339ad0 --- /dev/null +++ b/third_party/local_config_tensorrt/build_defs.bzl @@ -0,0 +1,5 @@ +def if_tensorrt(if_true, if_false = []): + return if_false + +def if_tensorrt_exec(if_true, if_false = []): + return if_false diff --git a/third_party/python_3_11_host/BUILD b/third_party/python_3_11_host/BUILD new file mode 100644 index 00000000..643ea08d --- /dev/null +++ b/third_party/python_3_11_host/BUILD @@ -0,0 +1 @@ +exports_files(["python"], visibility = ["//visibility:public"]) diff --git a/third_party/python_3_11_host/WORKSPACE b/third_party/python_3_11_host/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/python_3_11_host/python b/third_party/python_3_11_host/python new file mode 100755 index 00000000..06bd9865 --- /dev/null +++ b/third_party/python_3_11_host/python @@ -0,0 +1,2 @@ +#!/bin/bash +exit 0 diff --git a/third_party/python_version_repo/BUILD b/third_party/python_version_repo/BUILD new file mode 100644 index 00000000..580cae39 --- /dev/null +++ b/third_party/python_version_repo/BUILD @@ -0,0 +1 @@ +exports_files(["py_version.bzl"]) diff --git a/third_party/python_version_repo/WORKSPACE b/third_party/python_version_repo/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/python_version_repo/py_version.bzl b/third_party/python_version_repo/py_version.bzl new file mode 100644 index 00000000..eea44aca --- /dev/null +++ b/third_party/python_version_repo/py_version.bzl @@ -0,0 +1,2 @@ +HERMETIC_PYTHON_VERSION = "3.11" +USE_PYWRAP_RULES = False diff --git a/third_party/rules_java/BUILD b/third_party/rules_java/BUILD new file mode 100644 index 00000000..6423706c --- /dev/null +++ b/third_party/rules_java/BUILD @@ -0,0 +1 @@ +exports_files(["java/rules_java_deps.bzl"]) diff --git a/third_party/rules_java/WORKSPACE b/third_party/rules_java/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/rules_java/java/BUILD b/third_party/rules_java/java/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/rules_java/java/common/BUILD b/third_party/rules_java/java/common/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/rules_java/java/common/java_common.bzl b/third_party/rules_java/java/common/java_common.bzl new file mode 100644 index 00000000..ce1e536d --- /dev/null +++ b/third_party/rules_java/java/common/java_common.bzl @@ -0,0 +1 @@ +java_common = struct() diff --git a/third_party/rules_java/java/common/java_info.bzl b/third_party/rules_java/java/common/java_info.bzl new file mode 100644 index 00000000..1660a087 --- /dev/null +++ b/third_party/rules_java/java/common/java_info.bzl @@ -0,0 +1 @@ +JavaInfo = provider() diff --git a/third_party/rules_java/java/common/proguard_spec_info.bzl b/third_party/rules_java/java/common/proguard_spec_info.bzl new file mode 100644 index 00000000..a3b2446f --- /dev/null +++ b/third_party/rules_java/java/common/proguard_spec_info.bzl @@ -0,0 +1 @@ +ProguardSpecInfo = provider() diff --git a/third_party/rules_java/java/defs.bzl b/third_party/rules_java/java/defs.bzl new file mode 100644 index 00000000..581515ea --- /dev/null +++ b/third_party/rules_java/java/defs.bzl @@ -0,0 +1,21 @@ +def java_library(**kwargs): + pass + +def java_binary(**kwargs): + pass + +def java_test(**kwargs): + pass + +def java_plugin(**kwargs): + pass + +def java_import(**kwargs): + pass + +def java_runtime(**kwargs): + pass + +JavaInfo = provider() + +java_common = struct() diff --git a/third_party/rules_java/java/private/BUILD b/third_party/rules_java/java/private/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/rules_java/java/private/proto_support.bzl b/third_party/rules_java/java/private/proto_support.bzl new file mode 100644 index 00000000..3093befd --- /dev/null +++ b/third_party/rules_java/java/private/proto_support.bzl @@ -0,0 +1,5 @@ +def compile(**kwargs): + pass + +def merge(**kwargs): + pass diff --git a/third_party/rules_java/java/proto/BUILD b/third_party/rules_java/java/proto/BUILD new file mode 100644 index 00000000..efe394df --- /dev/null +++ b/third_party/rules_java/java/proto/BUILD @@ -0,0 +1,4 @@ +package(default_visibility = ["//visibility:public"]) + +toolchain_type(name = "toolchain_type") +toolchain_type(name = "lite_toolchain_type") diff --git a/third_party/rules_java/java/rules_java_deps.bzl b/third_party/rules_java/java/rules_java_deps.bzl new file mode 100644 index 00000000..a1539a3d --- /dev/null +++ b/third_party/rules_java/java/rules_java_deps.bzl @@ -0,0 +1,2 @@ +def rules_java_dependencies(): + pass diff --git a/third_party/tensorflow.patch b/third_party/tensorflow.patch index f13f6fbd..76a4a40d 100644 --- a/third_party/tensorflow.patch +++ b/third_party/tensorflow.patch @@ -7,7 +7,7 @@ index 868d05f09..4876f801c 100644 hdrs = ["flatrep.h"], deps = [ + "@com_google_absl//absl/base", - "@local_tsl//tsl/lib/gtl:flatrep", + "@xla//xla/tsl/lib/gtl:flatrep", ], ) diff --git a/tensorflow/core/util/BUILD b/tensorflow/core/util/BUILD @@ -111,413 +111,112 @@ index 2a03c511e..8d73d6f85 100644 #include "absl/numeric/int128.h" #include "tensorflow/core/framework/types.h" #include "tensorflow/core/platform/macros.h" -diff --git a/third_party/xla/third_party/tsl/tsl/lib/gtl/BUILD b/third_party/xla/third_party/tsl/tsl/lib/gtl/BUILD -index ed2d8656f..fd53055c2 100644 ---- a/third_party/xla/third_party/tsl/tsl/lib/gtl/BUILD -+++ b/third_party/xla/third_party/tsl/tsl/lib/gtl/BUILD -@@ -58,8 +58,8 @@ cc_library( - name = "flatrep", - hdrs = ["flatrep.h"], - deps = [ -+ "//tsl/platform:prefetch", - "//tsl/platform:types", -- "@com_google_absl//absl/base:prefetch", - ], +diff --git a/third_party/repo.bzl b/third_party/repo.bzl +index 20da5ab74..3fdb67b8e0383cd54f5502ec8902d1e5/external/org_tensorflow/third_party/repo.bzl +--- a/third_party/repo.bzl ++++ b/third_party/repo.bzl +@@ -146,10 +146,10 @@ + tf_vendored = repository_rule( + implementation = _tf_vendored_impl, + doc = "Similar to local_repository, but path is relative to the root of the " + + "repository, not the root of the workspace.", + attrs = { +- "_root": attr.label(default = "//:unused"), ++ "_root": attr.label(default = "//:WORKSPACE"), + "path": attr.string(), + }, + local = True, ) - -diff --git a/third_party/xla/third_party/tsl/tsl/lib/gtl/flatrep.h b/third_party/xla/third_party/tsl/tsl/lib/gtl/flatrep.h -index dfc65844e..e9be67ca6 100644 ---- a/third_party/xla/third_party/tsl/tsl/lib/gtl/flatrep.h -+++ b/third_party/xla/third_party/tsl/tsl/lib/gtl/flatrep.h -@@ -20,7 +20,7 @@ limitations under the License. - - #include - --#include "absl/base/prefetch.h" -+#include "tsl/platform/prefetch.h" - #include "tsl/platform/types.h" - - namespace tsl { -diff --git a/third_party/xla/third_party/tsl/tsl/lib/hash/BUILD b/third_party/xla/third_party/tsl/tsl/lib/hash/BUILD -index c497abfe1..fffee96fe 100644 ---- a/third_party/xla/third_party/tsl/tsl/lib/hash/BUILD -+++ b/third_party/xla/third_party/tsl/tsl/lib/hash/BUILD -@@ -39,7 +39,6 @@ cc_library( - "//tsl/platform:types", - "@com_google_absl//absl/crc:crc32c", - "@com_google_absl//absl/strings:cord", -- "@com_google_absl//absl/strings:string_view", - ], - ) - -diff --git a/third_party/xla/third_party/tsl/tsl/platform/BUILD b/third_party/xla/third_party/tsl/tsl/platform/BUILD -index 273fd5306..028c5db06 100644 ---- a/third_party/xla/third_party/tsl/tsl/platform/BUILD -+++ b/third_party/xla/third_party/tsl/tsl/platform/BUILD -@@ -1069,10 +1069,13 @@ cc_library( - - cc_library( - name = "prefetch", -- hdrs = ["prefetch.h"], -+ hdrs = [ -+ "prefetch.h", -+ "absl_base_prefetch.h", -+ ], - compatible_with = get_compatible_with_portable(), - deps = [ -- "@com_google_absl//absl/base:prefetch", -+ "@com_google_absl//absl/base", - ], - ) - -diff --git a/third_party/xla/third_party/tsl/tsl/platform/absl_base_prefetch.h b/third_party/xla/third_party/tsl/tsl/platform/absl_base_prefetch.h -new file mode 100644 -index 000000000..429a17315 ---- /dev/null -+++ b/third_party/xla/third_party/tsl/tsl/platform/absl_base_prefetch.h -@@ -0,0 +1,62 @@ -+/* Copyright 2026 The TensorFlow Authors. All Rights Reserved. -+ -+Licensed under the Apache License, Version 2.0 (the "License"); -+you may not use this file except in compliance with the License. -+You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+Unless required by applicable law or agreed to in writing, software -+distributed under the License is distributed on an "AS IS" BASIS, -+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+See the License for the specific language governing permissions and -+limitations under the License. -+==============================================================================*/ -+ -+#ifndef ABSL_BASE_PREFETCH_H_ -+#define ABSL_BASE_PREFETCH_H_ -+ -+// Minimal compatibility shim for absl/base/prefetch.h. Provides the prefetch -+// helpers used by TensorFlow when the corresponding Abseil header is absent. -+// This should be sufficient for builds that depend on an older Abseil release. -+ -+namespace absl { -+ -+// Hints the processor to prefetch the given address into the local cache for -+// read-mostly access. -+inline void PrefetchToLocalCache(const void* addr) { -+#if defined(__GNUC__) || defined(__clang__) -+ __builtin_prefetch(addr, 0 /* read */, 3 /* high temporal locality */); -+#else -+ (void)addr; -+#endif -+} -+ -+// Hints the processor to prefetch the given address into the local cache for -+// imminent writes. -+inline void PrefetchToLocalCacheForWrite(const void* addr) { -+#if defined(__GNUC__) || defined(__clang__) -+ __builtin_prefetch(addr, 1 /* write */, 3 /* high temporal locality */); -+#else -+ (void)addr; -+#endif -+} -+ -+// Non-temporal prefetch (prefer not to pollute caches). -+inline void PrefetchToLocalCacheNta(const void* addr) { -+#if defined(__GNUC__) || defined(__clang__) -+ __builtin_prefetch(addr, 0 /* read */, 0 /* no temporal locality */); -+#else -+ (void)addr; -+#endif -+} -+ -+// Convenience aliases mirroring Abseil's API. -+inline void Prefetch(const void* addr) { PrefetchToLocalCache(addr); } -+inline void PrefetchForWrite(const void* addr) { -+ PrefetchToLocalCacheForWrite(addr); -+} -+ -+} // namespace absl -+ -+#endif // ABSL_BASE_PREFETCH_H_ -diff --git a/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl b/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl -index 35cdcdc50..1920ec210 100644 ---- a/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl -+++ b/third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl -@@ -1,7 +1,6 @@ - # Platform-specific build configurations. - - load("@com_github_grpc_grpc//bazel:generate_cc.bzl", "generate_cc") --load("@com_google_protobuf//:protobuf.bzl", "proto_gen") - load( - "@local_xla//xla/tsl:tsl.bzl", - "clean_dep", -@@ -195,18 +194,13 @@ def cc_proto_library( - if protolib_name == None: - protolib_name = name - -- genproto_deps = ([s + "_genproto" for s in protolib_deps] + -- ["@com_google_protobuf//:cc_wkt_protos_genproto"]) - if internal_bootstrap_hack: - # For pre-checked-in generated files, we add the internal_bootstrap_hack - # which will skip the codegen action. -- proto_gen( -+ native.proto_library( - name = protolib_name + "_genproto", -- srcs = srcs, -- includes = includes, -- protoc = protoc, -+ deps = protolib_deps, - visibility = ["//visibility:public"], -- deps = genproto_deps, - ) - - # An empty cc_library to make rule dependency consistent. -@@ -227,18 +221,11 @@ def cc_proto_library( - gen_hdrs = _proto_cc_hdrs(srcs, use_grpc_plugin) - outs = gen_srcs + gen_hdrs - -- proto_gen( -- name = protolib_name + "_genproto", -- srcs = srcs, -- outs = outs, -- gen_cc = 1, -- includes = includes, -- plugin = grpc_cpp_plugin, -- plugin_language = "grpc", -- plugin_options = plugin_options, -- protoc = protoc, -- visibility = ["//visibility:public"], -- deps = genproto_deps, -+ # Don't create proto_library - it should already exist from tf_proto_library -+ # Just create cc_proto_library that depends on the existing proto_library -+ native.cc_proto_library( -+ name = protolib_name + "_cc_genproto", -+ deps = [":" + protolib_name], - ) - - if use_grpc_plugin: -@@ -263,11 +250,12 @@ def cc_proto_library( - visibility = kwargs["visibility"], - ) - -+ # Depend on generated cc_proto_library instead of declaring hdrs/srcs - native.cc_library( - name = impl_name, -- srcs = gen_srcs, -- hdrs = gen_hdrs, -- deps = cc_libs + deps, -+ srcs = [], -+ hdrs = [], -+ deps = cc_libs + deps + [":" + protolib_name + "_cc_genproto"], - includes = includes, - alwayslink = 1, - **kwargs -@@ -276,8 +264,9 @@ def cc_proto_library( - name = header_only_name, - deps = [ - "@com_google_protobuf//:protobuf_headers", -+ ":" + protolib_name + "_cc_genproto", - ] + header_only_deps + if_tsl_link_protobuf([impl_name]), -- hdrs = gen_hdrs, -+ hdrs = [], - **kwargs - ) - -@@ -348,6 +337,102 @@ def cc_grpc_library( - **kwargs - ) - -+# Custom implementation for py_proto_library to support Protobuf 4.x -+# which removed the built-in py_proto_library rule. -+def _tsl_py_proto_library_impl(ctx): -+ """Generate Python code from proto_library deps.""" -+ proto_deps = ctx.attr.deps -+ all_sources = [] -+ py_infos = [] -+ -+ for dep in proto_deps: -+ if ProtoInfo in dep: -+ all_sources.extend(dep[ProtoInfo].direct_sources) -+ elif PyInfo in dep: -+ py_infos.append(dep[PyInfo]) -+ -+ # Filter workspace sources only -+ workspace_sources = [] -+ for src in all_sources: -+ if not src.short_path.startswith("external/") and not src.short_path.startswith("../"): -+ workspace_sources.append(src) -+ -+ # Generate Python files -+ py_outputs = [] -+ for proto_src in workspace_sources: -+ basename = proto_src.basename[:-6] # Remove .proto -+ py_file = ctx.actions.declare_file(basename + "_pb2.py") -+ py_outputs.append(py_file) -+ -+ if py_outputs: -+ proto_path_args = ["--proto_path=."] -+ proto_paths = {".": True} -+ -+ for dep in proto_deps: -+ if ProtoInfo in dep: -+ for src in dep[ProtoInfo].transitive_sources.to_list(): -+ if src.path.startswith("external/com_google_protobuf/"): -+ proto_path = "external/com_google_protobuf/src" -+ if proto_path not in proto_paths: -+ proto_paths[proto_path] = True -+ proto_path_args.append("--proto_path=" + proto_path) -+ elif src.path.startswith("external/"): -+ parts = src.path.split("/") -+ if len(parts) >= 2: -+ proto_path = "/".join(parts[:2]) -+ if proto_path not in proto_paths: -+ proto_paths[proto_path] = True -+ proto_path_args.append("--proto_path=" + proto_path) -+ if src.root.path and src.root.path not in proto_paths: -+ proto_paths[src.root.path] = True -+ proto_path_args.append("--proto_path=" + src.root.path) -+ -+ proto_file_args = [src.short_path for src in workspace_sources] -+ output_root = ctx.bin_dir.path -+ -+ ctx.actions.run( -+ inputs = depset(direct = workspace_sources, transitive = [ -+ dep[ProtoInfo].transitive_sources for dep in proto_deps if ProtoInfo in dep -+ ]), -+ outputs = py_outputs, -+ executable = ctx.executable._protoc, -+ arguments = ["--python_out=" + output_root] + proto_path_args + proto_file_args, -+ mnemonic = "ProtocPython", -+ ) -+ -+ all_transitive_sources = [depset(py_outputs)] -+ all_imports = [depset([ctx.bin_dir.path])] if py_outputs else [] -+ -+ for py_info in py_infos: -+ all_transitive_sources.append(py_info.transitive_sources) -+ if hasattr(py_info, 'imports'): -+ all_imports.append(py_info.imports) -+ -+ return [ -+ DefaultInfo(files = depset(py_outputs)), -+ PyInfo( -+ transitive_sources = depset(transitive = all_transitive_sources), -+ imports = depset(transitive = all_imports), -+ has_py2_only_sources = False, -+ has_py3_only_sources = True, -+ ), -+ ] -+ -+_tsl_py_proto_library_rule = rule( -+ implementation = _tsl_py_proto_library_impl, -+ attrs = { -+ "deps": attr.label_list( -+ providers = [[ProtoInfo], [PyInfo]], -+ ), -+ "_protoc": attr.label( -+ default = "@com_google_protobuf//:protoc", -+ executable = True, -+ cfg = "exec", -+ ), -+ }, -+ provides = [PyInfo], +diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD +index 1234567..89abcdef 100644 +--- a/tensorflow/core/BUILD ++++ b/tensorflow/core/BUILD +@@ -64,5 +64,5 @@ +-load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library") +-load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda") +-load("@local_config_tensorrt//:build_defs.bzl", "if_tensorrt") ++# load("@com_google_protobuf//bazel:java_proto_library.bzl", "java_proto_library") ++# load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda") ++# load("@local_config_tensorrt//:build_defs.bzl", "if_tensorrt") + load("@rules_python//python:proto.bzl", "py_proto_library") +@@ -208,5 +208,5 @@ +-java_proto_library( +- name = "example_java_proto", +- visibility = ["//visibility:public"], +- deps = [":example_protos"], +-) ++# java_proto_library( ++# name = "example_java_proto", ++# visibility = ["//visibility:public"], ++# deps = [":example_protos"], ++# ) +@@ -535,8 +535,5 @@ + "//conditions:default": [ + "//tensorflow/core/tpu/ops", + "//tensorflow/dtensor/cc:dtensor_tpu_ops", + ], +- }) + if_tensorrt([ +- "//tensorflow/compiler/tf2tensorrt:trt_engine_resource_ops_op_lib", +- "//tensorflow/compiler/tf2tensorrt:trt_op_libs", +- ]) + if_libtpu( ++ }) + if_libtpu( +@@ -657,11 +657,5 @@ + ]) + if_cuda_or_rocm([ + "//tensorflow/core/kernels:cudnn_rnn_kernels", +- ]) + if_cuda([ +- "//tensorflow/core/grappler/optimizers:gpu_swapping_kernels", +- "//tensorflow/core/grappler/optimizers:gpu_swapping_ops", + ]) + if_nccl([ + "//tensorflow/core/kernels:nccl_kernels", +- ]) + if_tensorrt([ +- "//tensorflow/compiler/tf2tensorrt:trt_engine_resource_op_kernels", +- "//tensorflow/compiler/tf2tensorrt:trt_op_kernels", + ]) + tf_tpu_dependencies() + tf_dtensor_tpu_dependencies(), +@@ -1745,5 +1745,3 @@ + "@xla//xla/tsl/util:command_line_flags", + "@xla//xla/tsl/util:device_name_utils", +- ] + if_cuda([ +- "@local_config_cuda//cuda:cudnn_header", +- ]) + if_static( ++ ] + if_static( +diff --git a/tensorflow/core/platform/build_config.default.bzl b/tensorflow/core/platform/build_config.default.bzl +index 1234567..89abcdef 100644 +--- a/tensorflow/core/platform/build_config.default.bzl ++++ b/tensorflow/core/platform/build_config.default.bzl +@@ -3,2 +3,2 @@ +-load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda") +-load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm") ++# load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda") ++# load("@local_config_rocm//rocm:build_defs.bzl", "if_rocm") +@@ -31,6 +31,1 @@ +- ] + if_cuda([ +- Label("@xla//xla/stream_executor:cuda_platform"), +- ]) + if_rocm([ +- "@xla//xla/stream_executor:rocm_platform", +- "@local_config_rocm//rocm:rocm_rpath", +- ]) + if_mkl_ml([ ++ ] + if_mkl_ml([ +diff --git a/tensorflow/workspace2.bzl b/tensorflow/workspace2.bzl +index 1234567..89abcdef 100644 +--- a/tensorflow/workspace2.bzl ++++ b/tensorflow/workspace2.bzl +@@ -133,1 +133,1 @@ +- tensorrt_configure(name = "local_config_tensorrt") ++# tensorrt_configure(name = "local_config_tensorrt") +diff --git a/third_party/xla/xla/stream_executor/sycl/BUILD b/third_party/xla/xla/stream_executor/sycl/BUILD +index 1234567..89abcdef 100644 +--- a/third_party/xla/xla/stream_executor/sycl/BUILD ++++ b/third_party/xla/xla/stream_executor/sycl/BUILD +@@ -9,1 +9,2 @@ + load("//xla:xla.default.bzl", "xla_cc_test") ++load("@rules_proto//proto:defs.bzl", "proto_library") +@@ -114,5 +114,4 @@ +-tf_proto_library( +- name = "oneapi_compute_capability_proto", +- srcs = ["oneapi_compute_capability.proto"], +- make_default_target_header_only = True, +-) ++proto_library( ++ name = "oneapi_compute_capability_proto", ++ srcs = ["oneapi_compute_capability.proto"], +) -+ - # Re-defined protocol buffer rule to bring in the change introduced in commit - # https://github.com/google/protobuf/commit/294b5758c373cbab4b72f35f4cb62dc1d8332b68 - # which was not part of a stable protobuf release in 04/2018. -@@ -402,32 +487,19 @@ def py_proto_library( - genproto_deps = [] - for dep in deps: - if dep != "@com_google_protobuf//:protobuf_python": -- genproto_deps.append(dep + "_genproto") -- else: -- genproto_deps.append("@com_google_protobuf//:well_known_types_py_pb2_genproto") -+ genproto_deps.append(dep) - -- proto_gen( -+ native.proto_library( - name = name + "_genproto", - srcs = srcs, -- outs = outs, -- gen_py = 1, -- includes = includes, -- plugin = grpc_python_plugin, -- plugin_language = "grpc", -- protoc = protoc, -- visibility = ["//visibility:public"], - deps = genproto_deps, -+ visibility = ["//visibility:public"], - ) - -- if default_runtime and not default_runtime in py_libs + deps: -- py_libs = py_libs + [default_runtime] -- -- native.py_library( -+ # Use custom rule instead of removed native.py_proto_library -+ _tsl_py_proto_library_rule( - name = name, -- srcs = outs + py_extra_srcs, -- deps = py_libs + deps, -- imports = includes, -- **kwargs -+ deps = [":" + name + "_genproto"] + deps, - ) - - def tf_proto_library_cc( -@@ -467,11 +539,10 @@ def tf_proto_library_cc( - if not srcs: - # This is a collection of sub-libraries. Build header-only and impl - # libraries containing all the sources. -- proto_gen( -+ native.proto_library( - name = name + "_genproto", -- protoc = "@com_google_protobuf//:protoc", -- visibility = ["//visibility:public"], - deps = [s + "_genproto" for s in protolib_deps], -+ visibility = ["//visibility:public"], - ) - - native.alias( -@@ -538,11 +609,10 @@ def tf_proto_library_py( - if not srcs: - # This is a collection of sub-libraries. Build header-only and impl - # libraries containing all the sources. -- proto_gen( -+ native.proto_library( - name = py_name + "_genproto", -- protoc = "@com_google_protobuf//:protoc", -- visibility = ["//visibility:public"], - deps = [s + "_genproto" for s in py_deps], -+ visibility = ["//visibility:public"], - ) - native.py_library( - name = py_name, -diff --git a/third_party/xla/third_party/tsl/tsl/platform/prefetch.h b/third_party/xla/third_party/tsl/tsl/platform/prefetch.h -index d883529c6..05f3469a4 100644 ---- a/third_party/xla/third_party/tsl/tsl/platform/prefetch.h -+++ b/third_party/xla/third_party/tsl/tsl/platform/prefetch.h -@@ -16,7 +16,7 @@ limitations under the License. - #ifndef TENSORFLOW_TSL_PLATFORM_PREFETCH_H_ - #define TENSORFLOW_TSL_PLATFORM_PREFETCH_H_ - --#include "absl/base/prefetch.h" -+#include "absl_base_prefetch.h" - - namespace tsl { - namespace port { -diff --git a/third_party/xla/third_party/tsl/tsl/platform/status.h b/third_party/xla/third_party/tsl/tsl/platform/status.h -index 84954ff48..724ad934b 100644 ---- a/third_party/xla/third_party/tsl/tsl/platform/status.h -+++ b/third_party/xla/third_party/tsl/tsl/platform/status.h -@@ -126,7 +126,10 @@ const char* NullTerminatedMessage(const absl::Status& status); - #else - ABSL_DEPRECATE_AND_INLINE() - inline const char* NullTerminatedMessage(const absl::Status& status) { -- return absl::StatusMessageAsCStr(status); -+ // absl::StatusMessageAsCStr doesn't exist in older Abseil versions -+ // Inline implementation from newer Abseil -+ auto sv_message = status.message(); -+ return sv_message.empty() ? "" : sv_message.data(); - } - #endif - diff --git a/third_party/tf_wheel_version_suffix/BUILD b/third_party/tf_wheel_version_suffix/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/third_party/tf_wheel_version_suffix/WORKSPACE b/third_party/tf_wheel_version_suffix/WORKSPACE new file mode 100644 index 00000000..e69de29b diff --git a/third_party/tf_wheel_version_suffix/wheel_version_suffix.bzl b/third_party/tf_wheel_version_suffix/wheel_version_suffix.bzl new file mode 100644 index 00000000..29fd6a82 --- /dev/null +++ b/third_party/tf_wheel_version_suffix/wheel_version_suffix.bzl @@ -0,0 +1,2 @@ +SEMANTIC_WHEEL_VERSION_SUFFIX = "" +WHEEL_VERSION_SUFFIX = "" From 702570c9eba304466dbb40bb743f5ba5fbf013c3 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Fri, 10 Apr 2026 19:06:33 +0000 Subject: [PATCH 02/32] Remove local absolute paths from .bazelrc --- .bazelrc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index 82d6a8a1..7c70fcaa 100644 --- a/.bazelrc +++ b/.bazelrc @@ -51,6 +51,4 @@ build:linux --copt=-Wa,--gsframe=no build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 -build --action_env TF_HEADER_DIR="/usr/local/google/home/vkarampudi/anaconda3/lib/python3.12/site-packages/tensorflow/include" -build --action_env TF_SHARED_LIBRARY_DIR="/usr/local/google/home/vkarampudi/anaconda3/lib/python3.12/site-packages/tensorflow" -build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.so.2" + From 5fdc9b8dc11c9bbd67a165d5301bae45507ceda9 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Fri, 10 Apr 2026 21:25:53 +0000 Subject: [PATCH 03/32] Disable Bzlmod, upgrade Bazel to 7.7.0, and patch Protobuf to fix version mismatch. --- .bazelrc | 1 + .bazelversion | 3 ++- WORKSPACE | 4 +++- third_party/protobuf_retain_options.patch | 7 +++++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 third_party/protobuf_retain_options.patch diff --git a/.bazelrc b/.bazelrc index 7c70fcaa..ca0a2fb6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,3 +52,4 @@ build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 +common --noenable_bzlmod diff --git a/.bazelversion b/.bazelversion index f22d756d..56742b62 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1,2 @@ -6.5.0 +7.7.0 + diff --git a/WORKSPACE b/WORKSPACE index 1fd18802..c5ef0468 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -119,6 +119,8 @@ http_archive( urls = [ "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip", ], + patches = ["//third_party:protobuf_retain_options.patch"], + patch_args = ["-p1"], ) # ===== TensorFlow dependency ===== @@ -143,7 +145,7 @@ http_archive( name = "org_tensorflow", sha256 = _TENSORFLOW_ARCHIVE_SHA256, urls = [ - "https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, + "https://github.com/tensorflow/tensorflow/archive/v%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, ], strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT, patches = ["//third_party:tensorflow.patch"], diff --git a/third_party/protobuf_retain_options.patch b/third_party/protobuf_retain_options.patch new file mode 100644 index 00000000..fea9f1ad --- /dev/null +++ b/third_party/protobuf_retain_options.patch @@ -0,0 +1,7 @@ +--- a/bazel/private/proto_library_rule.bzl ++++ b/b/bazel/private/proto_library_rule.bzl +@@ -166,4 +166,3 @@ + if ctx.attr._experimental_proto_descriptor_sets_include_source_info[BuildSettingInfo].value: + args.add("--include_source_info") +- args.add("--retain_options") + From 1994d8aa469888fcb65dea588c593e9df8b84cca Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Fri, 10 Apr 2026 22:07:23 +0000 Subject: [PATCH 04/32] Remove --gsframe=no from .bazelrc to fix PR build failure. --- .bazelrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index ca0a2fb6..cd0db270 100644 --- a/.bazelrc +++ b/.bazelrc @@ -40,8 +40,7 @@ build --host_cxxopt=-std=c++17 build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 -# Disable sframe in assembler to avoid linker errors with gcc 15 -build:linux --copt=-Wa,--gsframe=no +# Disable sframe in assembler to avoid linker errors with gcc 15 (removed for PR compatibility) From 6e5587e0b01c0d3d3c4343f82fcfe1f538a6edf3 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 16:52:13 +0000 Subject: [PATCH 05/32] Remove Bazel version overwrite from configure.sh --- configure.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/configure.sh b/configure.sh index 170aa9b4..1ffcae7f 100755 --- a/configure.sh +++ b/configure.sh @@ -53,12 +53,7 @@ else fi fi -# Set Bazel version based on OS -if [[ "$(uname)" == "Darwin" ]]; then - echo "7.4.1" > .bazelversion -else - echo "6.5.0" > .bazelversion -fi +# Bazel version is controlled by .bazelversion file. ensure_tensorflow TF_CFLAGS=( $(${PYTHON_BIN_PATH} -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') ) From 8eac1538f0ad98f9481abc6db8d041ba136b1ce8 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 17:01:19 +0000 Subject: [PATCH 06/32] Update environment.yml for TF 2.21.0 --- environment.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index 3f617721..8fefea9e 100644 --- a/environment.yml +++ b/environment.yml @@ -30,15 +30,15 @@ dependencies: - numpy==1.26.4 - opt-einsum==3.4.0 - optree==0.19.0 - - protobuf==4.25.8 - - pyarrow==10.0.1 + - protobuf==6.31.1 + - pyarrow>=14 - pygments==2.19.2 - requests==2.32.5 - rich==14.3.3 - six==1.17.0 - tensorboard==2.17.1 - tensorboard-data-server==0.7.2 - - tensorflow==2.17.1 + - tensorflow==2.21.0 - tensorflow-io-gcs-filesystem==0.37.1 - tensorflow-metadata==1.17.3 - termcolor==3.3.0 From bb9f981871a23eda80ab911d56e9267cb17f9f77 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 17:06:53 +0000 Subject: [PATCH 07/32] Downgrade h5py in environment.yml to fix conflict --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 8fefea9e..6991f431 100644 --- a/environment.yml +++ b/environment.yml @@ -16,7 +16,7 @@ dependencies: - google-pasta==0.2.0 - googleapis-common-protos==1.72.0 - grpcio==1.78.0 - - h5py==3.16.0 + - h5py==3.14.0 - idna==3.11 - keras==3.13.2 - libclang==18.1.1 From 2c2bff20481a92618f1a8e89aa8c125d06817a79 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 17:15:39 +0000 Subject: [PATCH 08/32] Upgrade ml-dtypes in environment.yml to fix conflict --- environment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 6991f431..872079fe 100644 --- a/environment.yml +++ b/environment.yml @@ -5,6 +5,7 @@ dependencies: - python=3.11 - pip - pip: + - --index-url https://pypi.org/simple - absl-py==2.4.0 - altgraph==0.17.5 - astunparse==1.6.3 @@ -25,7 +26,7 @@ dependencies: - markdown-it-py==4.0.0 - markupsafe==3.0.3 - mdurl==0.1.2 - - ml-dtypes==0.4.1 + - ml-dtypes==0.5.1 - namex==0.1.0 - numpy==1.26.4 - opt-einsum==3.4.0 From 3a9bae545d30ba98c6f09ea6a1a7b66e4eac609b Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 17:18:02 +0000 Subject: [PATCH 09/32] Pin pyarrow to 23.0.1 in environment.yml --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 872079fe..d968ddb4 100644 --- a/environment.yml +++ b/environment.yml @@ -32,7 +32,7 @@ dependencies: - opt-einsum==3.4.0 - optree==0.19.0 - protobuf==6.31.1 - - pyarrow>=14 + - pyarrow==23.0.1 - pygments==2.19.2 - requests==2.32.5 - rich==14.3.3 From d3f3188e85d4e505eec10a27ad99132576efc5ef Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 17:25:50 +0000 Subject: [PATCH 10/32] Update RELEASE.md for version 0.49.0 --- RELEASE.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 5d694cbc..6ebe01c0 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,15 +1,29 @@ # `struct2tensor` release notes -## Current Version (not yet released; still in development) +## Version 0.49.0 (not yet released; still in development) ## Major Features and Improvements +* N/A + ## Bug Fixes and Other Changes +* Depends on `tensorflow 2.21.0`. +* Depends on `protobuf==6.31.1`. +* Depends on `pyarrow==23.0.1`. +* Enforced C++17 in `.bazelrc`. +* Disabled Bzlmod in `.bazelrc` to resolve protobuf conflicts. +* Added dummy repositories in `WORKSPACE` to bypass circular dependencies with TensorFlow. +* Fixed missing `#include ` in various files to support compilation with `gcc 15`. + ## Breaking Changes +* N/A + ## Deprecations +* N/A + # Version 0.48.1 ## Major Features and Improvements From feab8d97ae2a6cf69c39cf5ea0ef2e5438010074 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 17:28:10 +0000 Subject: [PATCH 11/32] Revert header in RELEASE.md to Current Version --- RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 6ebe01c0..54dcd5ad 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,6 @@ # `struct2tensor` release notes -## Version 0.49.0 (not yet released; still in development) +## Current Version (not yet released; still in development) ## Major Features and Improvements From 4f11c33aad2ea5a2248c748469d74c84772ac3fe Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 20:52:34 +0000 Subject: [PATCH 12/32] Add Python 3.12 support and drop Python 3.9 --- environment.yml | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/environment.yml b/environment.yml index d968ddb4..a2d79c8a 100644 --- a/environment.yml +++ b/environment.yml @@ -1,8 +1,8 @@ -name: s2t-env-py311 +name: s2t-env-py312 channels: - conda-forge dependencies: - - python=3.11 + - python=3.12 - pip - pip: - --index-url https://pypi.org/simple diff --git a/setup.py b/setup.py index 8d1bce6a..3a28846c 100644 --- a/setup.py +++ b/setup.py @@ -105,9 +105,9 @@ def select_constraint(default, nightly=None, git_master=None): 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3 :: Only', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Artificial Intelligence', From ac38f7dc7af8f279d1e1df6058c922571a3fac0d Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 21:19:03 +0000 Subject: [PATCH 13/32] Add Python 3.12 support to RELEASE.md and disable SFrame in .bazelrc --- .bazelrc | 6 +++++- RELEASE.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index cd0db270..31d7353d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -40,7 +40,8 @@ build --host_cxxopt=-std=c++17 build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 -# Disable sframe in assembler to avoid linker errors with gcc 15 (removed for PR compatibility) +# Disable sframe in assembler to avoid linker errors with gcc 15 +build:linux --copt=-Wa,--gsframe=no @@ -52,3 +53,6 @@ build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 common --noenable_bzlmod +build --action_env TF_HEADER_DIR="/usr/local/google/home/vkarampudi/anaconda3/envs/s2t-env-py312/lib/python3.12/site-packages/tensorflow/include" +build --action_env TF_SHARED_LIBRARY_DIR="/usr/local/google/home/vkarampudi/anaconda3/envs/s2t-env-py312/lib/python3.12/site-packages/tensorflow" +build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.so.2" diff --git a/RELEASE.md b/RELEASE.md index 54dcd5ad..83b58249 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -15,6 +15,8 @@ * Disabled Bzlmod in `.bazelrc` to resolve protobuf conflicts. * Added dummy repositories in `WORKSPACE` to bypass circular dependencies with TensorFlow. * Fixed missing `#include ` in various files to support compilation with `gcc 15`. +* Added support for Python 3.12. +* Dropped support for Python 3.9. ## Breaking Changes From efec268e849c30a626d2fecb1c16ecb5c409b543 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 21:20:22 +0000 Subject: [PATCH 14/32] Remove local environment lines from .bazelrc --- .bazelrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index 31d7353d..7c539e75 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,7 +52,4 @@ build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 -common --noenable_bzlmod -build --action_env TF_HEADER_DIR="/usr/local/google/home/vkarampudi/anaconda3/envs/s2t-env-py312/lib/python3.12/site-packages/tensorflow/include" -build --action_env TF_SHARED_LIBRARY_DIR="/usr/local/google/home/vkarampudi/anaconda3/envs/s2t-env-py312/lib/python3.12/site-packages/tensorflow" -build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.so.2" + From 8238e9dd5410d53401e52746bc308c7ae6d547eb Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 21:29:48 +0000 Subject: [PATCH 15/32] Add pre-commit workflow --- .github/workflows/pre-commit.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..dede434d --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,21 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [master] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.7 + with: + # Ensure the full history is fetched + # This is required to run pre-commit on a specific set of commits + # TODO: Remove this when all the pre-commit issues are fixed + fetch-depth: 0 + - uses: actions/setup-python@v5.1.1 + with: + python-version: 3.13 + - uses: pre-commit/action@v3.0.1 From 3673f1600c33aee7f15b83fff3d47f0288005ddb Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 21:32:52 +0000 Subject: [PATCH 16/32] Apply pre-commit auto-fixes --- .bazelrc | 2 -- .bazelversion | 1 - .pre-commit-config.yaml | 8 ++++++++ LICENSE | 2 +- g3doc/api_docs/python/expression_impl.md | 1 - g3doc/api_docs/python/expression_impl/all_symbols.md | 2 +- g3doc/api_docs/python/expression_impl/apply_schema.md | 1 - g3doc/api_docs/python/expression_impl/broadcast.md | 1 - g3doc/api_docs/python/expression_impl/depth_limit.md | 1 - .../python/expression_impl/filter_expression.md | 1 - .../filter_expression/filter_by_child.md | 1 - .../filter_expression/filter_by_sibling.md | 1 - g3doc/api_docs/python/expression_impl/index.md | 1 - .../python/expression_impl/index/get_index_from_end.md | 1 - .../expression_impl/index/get_positional_index.md | 1 - g3doc/api_docs/python/expression_impl/map_prensor.md | 1 - .../expression_impl/map_prensor/map_ragged_tensor.md | 1 - .../expression_impl/map_prensor/map_sparse_tensor.md | 1 - .../python/expression_impl/map_prensor_to_prensor.md | 1 - .../expression_impl/map_prensor_to_prensor/Schema.md | 6 ------ .../map_prensor_to_prensor/create_schema.md | 1 - .../map_prensor_to_prensor/map_prensor_to_prensor.md | 1 - g3doc/api_docs/python/expression_impl/map_values.md | 1 - .../expression_impl/map_values/map_many_values.md | 1 - .../python/expression_impl/map_values/map_values.md | 1 - .../expression_impl/map_values/map_values_anonymous.md | 1 - g3doc/api_docs/python/expression_impl/parquet.md | 1 - .../python/expression_impl/parquet/ParquetDataset.md | 6 ------ .../parquet/calculate_parquet_values.md | 1 - .../parquet/create_expression_from_parquet_file.md | 1 - g3doc/api_docs/python/expression_impl/placeholder.md | 1 - .../placeholder/create_expression_from_schema.md | 1 - .../placeholder/get_placeholder_paths_from_graph.md | 1 - g3doc/api_docs/python/expression_impl/project.md | 1 - .../api_docs/python/expression_impl/project/project.md | 1 - g3doc/api_docs/python/expression_impl/promote.md | 1 - .../expression_impl/promote/PromoteChildExpression.md | 5 ----- .../expression_impl/promote/PromoteExpression.md | 5 ----- .../python/expression_impl/promote_and_broadcast.md | 1 - .../promote_and_broadcast/promote_and_broadcast.md | 1 - g3doc/api_docs/python/expression_impl/proto.md | 1 - .../python/expression_impl/proto/DescriptorPool.md | 5 ----- .../python/expression_impl/proto/FileDescriptorSet.md | 3 --- .../create_expression_from_file_descriptor_set.md | 1 - .../proto/create_expression_from_proto.md | 1 - .../expression_impl/proto/create_transformed_field.md | 1 - g3doc/api_docs/python/expression_impl/reroot.md | 1 - g3doc/api_docs/python/expression_impl/reroot/reroot.md | 1 - g3doc/api_docs/python/expression_impl/size.md | 1 - .../python/expression_impl/size/SizeExpression.md | 5 ----- g3doc/api_docs/python/expression_impl/size/has.md | 1 - g3doc/api_docs/python/expression_impl/size/size.md | 1 - .../python/expression_impl/size/size_anonymous.md | 1 - .../python/expression_impl/slice_expression.md | 1 - .../slice_expression/slice_expression.md | 1 - g3doc/api_docs/python/s2t.md | 1 - g3doc/api_docs/python/s2t/ChildNodeTensor.md | 5 ----- g3doc/api_docs/python/s2t/Expression.md | 5 ----- g3doc/api_docs/python/s2t/LeafNodeTensor.md | 5 ----- g3doc/api_docs/python/s2t/Path.md | 4 ---- g3doc/api_docs/python/s2t/Prensor.md | 5 ----- g3doc/api_docs/python/s2t/RootNodeTensor.md | 5 ----- g3doc/api_docs/python/s2t/all_symbols.md | 2 +- g3doc/api_docs/python/s2t/calculate_prensors.md | 1 - .../python/s2t/calculate_prensors_with_graph.md | 1 - .../s2t/create_expression_from_file_descriptor_set.md | 1 - .../python/s2t/create_expression_from_prensor.md | 1 - .../python/s2t/create_expression_from_proto.md | 1 - g3doc/api_docs/python/s2t/create_path.md | 1 - .../python/s2t/create_prensor_from_descendant_nodes.md | 1 - g3doc/api_docs/python/s2t/get_ragged_tensor.md | 1 - g3doc/api_docs/python/s2t/get_ragged_tensors.md | 1 - g3doc/api_docs/python/s2t/get_sparse_tensor.md | 1 - g3doc/api_docs/python/s2t/get_sparse_tensors.md | 1 - third_party/llvm_configure.patch | 2 +- third_party/protobuf_retain_options.patch | 1 - third_party/tensorflow.patch | 2 +- third_party/tfmd.patch | 10 +++++----- 78 files changed, 18 insertions(+), 133 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.bazelrc b/.bazelrc index 7c539e75..f6143279 100644 --- a/.bazelrc +++ b/.bazelrc @@ -51,5 +51,3 @@ build:linux --copt=-Wa,--gsframe=no build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 - - diff --git a/.bazelversion b/.bazelversion index 56742b62..1985849f 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1,2 +1 @@ 7.7.0 - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..3a075a63 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files diff --git a/LICENSE b/LICENSE index f49a4e16..261eeb9e 100644 --- a/LICENSE +++ b/LICENSE @@ -198,4 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/g3doc/api_docs/python/expression_impl.md b/g3doc/api_docs/python/expression_impl.md index 40da37a2..dea6a98f 100644 --- a/g3doc/api_docs/python/expression_impl.md +++ b/g3doc/api_docs/python/expression_impl.md @@ -67,4 +67,3 @@ s2t.expression_impl.apply_schema [`size`](./expression_impl/size.md) module: Functions for creating new size or has expression. [`slice_expression`](./expression_impl/slice_expression.md) module: Implementation of slice. - diff --git a/g3doc/api_docs/python/expression_impl/all_symbols.md b/g3doc/api_docs/python/expression_impl/all_symbols.md index efd30516..5556d831 100644 --- a/g3doc/api_docs/python/expression_impl/all_symbols.md +++ b/g3doc/api_docs/python/expression_impl/all_symbols.md @@ -64,4 +64,4 @@ * expression_impl.size.size_anonymous * expression_impl.slice_expression * expression_impl.slice_expression.IndexValue -* expression_impl.slice_expression.slice_expression \ No newline at end of file +* expression_impl.slice_expression.slice_expression diff --git a/g3doc/api_docs/python/expression_impl/apply_schema.md b/g3doc/api_docs/python/expression_impl/apply_schema.md index 3ae89cd0..354ceead 100644 --- a/g3doc/api_docs/python/expression_impl/apply_schema.md +++ b/g3doc/api_docs/python/expression_impl/apply_schema.md @@ -57,4 +57,3 @@ my_new_schema has semantically identical information on the fields as my_schema. ## Functions [`apply_schema(...)`](../expression_impl/apply_schema/apply_schema.md) - diff --git a/g3doc/api_docs/python/expression_impl/broadcast.md b/g3doc/api_docs/python/expression_impl/broadcast.md index 5e7565c7..43b7351e 100644 --- a/g3doc/api_docs/python/expression_impl/broadcast.md +++ b/g3doc/api_docs/python/expression_impl/broadcast.md @@ -95,4 +95,3 @@ session: { [`broadcast(...)`](../expression_impl/broadcast/broadcast.md) [`broadcast_anonymous(...)`](../expression_impl/broadcast/broadcast_anonymous.md) - diff --git a/g3doc/api_docs/python/expression_impl/depth_limit.md b/g3doc/api_docs/python/expression_impl/depth_limit.md index 7ba27d20..22de1ba9 100644 --- a/g3doc/api_docs/python/expression_impl/depth_limit.md +++ b/g3doc/api_docs/python/expression_impl/depth_limit.md @@ -49,4 +49,3 @@ You get: ## Functions [`limit_depth(...)`](../expression_impl/depth_limit/limit_depth.md): Limit the depth to nodes k steps from expr. - diff --git a/g3doc/api_docs/python/expression_impl/filter_expression.md b/g3doc/api_docs/python/expression_impl/filter_expression.md index d9018a68..d16af364 100644 --- a/g3doc/api_docs/python/expression_impl/filter_expression.md +++ b/g3doc/api_docs/python/expression_impl/filter_expression.md @@ -73,4 +73,3 @@ root_2 = filter_expression.filter_by_child( [`filter_by_child(...)`](../expression_impl/filter_expression/filter_by_child.md): Filter an expression by an optional boolean child field. [`filter_by_sibling(...)`](../expression_impl/filter_expression/filter_by_sibling.md): Filter an expression by its sibling. - diff --git a/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_child.md b/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_child.md index 5427623b..1b3dc9ce 100644 --- a/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_child.md +++ b/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_child.md @@ -87,4 +87,3 @@ The new root expression. - diff --git a/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_sibling.md b/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_sibling.md index 1e3808dd..8303c90b 100644 --- a/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_sibling.md +++ b/g3doc/api_docs/python/expression_impl/filter_expression/filter_by_sibling.md @@ -89,4 +89,3 @@ a new root. - diff --git a/g3doc/api_docs/python/expression_impl/index.md b/g3doc/api_docs/python/expression_impl/index.md index 822383a8..67ba68e0 100644 --- a/g3doc/api_docs/python/expression_impl/index.md +++ b/g3doc/api_docs/python/expression_impl/index.md @@ -133,4 +133,3 @@ take little memory or CPU. [`get_index_from_end(...)`](../expression_impl/index/get_index_from_end.md): Gets the number of steps from the end of the array. [`get_positional_index(...)`](../expression_impl/index/get_positional_index.md): Gets the positional index. - diff --git a/g3doc/api_docs/python/expression_impl/index/get_index_from_end.md b/g3doc/api_docs/python/expression_impl/index/get_index_from_end.md index 6ab17db7..a70ae016 100644 --- a/g3doc/api_docs/python/expression_impl/index/get_index_from_end.md +++ b/g3doc/api_docs/python/expression_impl/index/get_index_from_end.md @@ -79,4 +79,3 @@ The new expression and the new path as a pair. - diff --git a/g3doc/api_docs/python/expression_impl/index/get_positional_index.md b/g3doc/api_docs/python/expression_impl/index/get_positional_index.md index 43b4e2b4..95d8486f 100644 --- a/g3doc/api_docs/python/expression_impl/index/get_positional_index.md +++ b/g3doc/api_docs/python/expression_impl/index/get_positional_index.md @@ -79,4 +79,3 @@ The new expression and the new path as a pair. - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor.md b/g3doc/api_docs/python/expression_impl/map_prensor.md index 9806d8ed..03e5ea1c 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor.md @@ -114,4 +114,3 @@ session: { [`map_ragged_tensor(...)`](../expression_impl/map_prensor/map_ragged_tensor.md): Map a ragged tensor. [`map_sparse_tensor(...)`](../expression_impl/map_prensor/map_sparse_tensor.md): Maps a sparse tensor. - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor/map_ragged_tensor.md b/g3doc/api_docs/python/expression_impl/map_prensor/map_ragged_tensor.md index 9b122257..8bb79e9e 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor/map_ragged_tensor.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor/map_ragged_tensor.md @@ -112,4 +112,3 @@ root_path.get_child(new_field_name), with the result of the operation. - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor/map_sparse_tensor.md b/g3doc/api_docs/python/expression_impl/map_prensor/map_sparse_tensor.md index 2f32e890..efe541b9 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor/map_sparse_tensor.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor/map_sparse_tensor.md @@ -112,4 +112,3 @@ root_path.get_child(new_field_name), with the result of the operation. - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor.md b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor.md index ce3164f3..f1c5d065 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor.md @@ -86,4 +86,3 @@ foo bar foo2 bar2 [`create_schema(...)`](../expression_impl/map_prensor_to_prensor/create_schema.md): Create a schema recursively. [`map_prensor_to_prensor(...)`](../expression_impl/map_prensor_to_prensor/map_prensor_to_prensor.md): Maps an expression to a prensor, and merges that prensor. - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/Schema.md b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/Schema.md index 065306bc..43802703 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/Schema.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/Schema.md @@ -145,9 +145,3 @@ child schemas. - - - - - - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/create_schema.md b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/create_schema.md index d249def9..81217e5b 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/create_schema.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/create_schema.md @@ -95,4 +95,3 @@ a new Schema represented by the inputs. - diff --git a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/map_prensor_to_prensor.md b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/map_prensor_to_prensor.md index 9d6f5c5b..caf69b45 100644 --- a/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/map_prensor_to_prensor.md +++ b/g3doc/api_docs/python/expression_impl/map_prensor_to_prensor/map_prensor_to_prensor.md @@ -126,4 +126,3 @@ A new expression where the prensor is merged. - diff --git a/g3doc/api_docs/python/expression_impl/map_values.md b/g3doc/api_docs/python/expression_impl/map_values.md index 75532668..176b1132 100644 --- a/g3doc/api_docs/python/expression_impl/map_values.md +++ b/g3doc/api_docs/python/expression_impl/map_values.md @@ -36,4 +36,3 @@ Note that the operations are on 1-D tensors (as opposed to scalars). [`map_values(...)`](../expression_impl/map_values/map_values.md): Map field into a new sibling. [`map_values_anonymous(...)`](../expression_impl/map_values/map_values_anonymous.md): Map field into a new sibling. - diff --git a/g3doc/api_docs/python/expression_impl/map_values/map_many_values.md b/g3doc/api_docs/python/expression_impl/map_values/map_many_values.md index 5ab7f1f0..5a295a6a 100644 --- a/g3doc/api_docs/python/expression_impl/map_values/map_many_values.md +++ b/g3doc/api_docs/python/expression_impl/map_values/map_many_values.md @@ -103,4 +103,3 @@ The new expression and the new path as a pair. - diff --git a/g3doc/api_docs/python/expression_impl/map_values/map_values.md b/g3doc/api_docs/python/expression_impl/map_values/map_values.md index 7b2f2c14..03d528c3 100644 --- a/g3doc/api_docs/python/expression_impl/map_values/map_values.md +++ b/g3doc/api_docs/python/expression_impl/map_values/map_values.md @@ -94,4 +94,3 @@ The new expression. - diff --git a/g3doc/api_docs/python/expression_impl/map_values/map_values_anonymous.md b/g3doc/api_docs/python/expression_impl/map_values/map_values_anonymous.md index 6a8e7123..f3a18406 100644 --- a/g3doc/api_docs/python/expression_impl/map_values/map_values_anonymous.md +++ b/g3doc/api_docs/python/expression_impl/map_values/map_values_anonymous.md @@ -86,4 +86,3 @@ The new expression and the new path as a pair. - diff --git a/g3doc/api_docs/python/expression_impl/parquet.md b/g3doc/api_docs/python/expression_impl/parquet.md index 2a3cf405..51cc719f 100644 --- a/g3doc/api_docs/python/expression_impl/parquet.md +++ b/g3doc/api_docs/python/expression_impl/parquet.md @@ -47,4 +47,3 @@ Apache Parquet Dataset. [`calculate_parquet_values(...)`](../expression_impl/parquet/calculate_parquet_values.md): Calculates expressions and returns a parquet dataset. [`create_expression_from_parquet_file(...)`](../expression_impl/parquet/create_expression_from_parquet_file.md): Creates a placeholder expression from a parquet file. - diff --git a/g3doc/api_docs/python/expression_impl/parquet/ParquetDataset.md b/g3doc/api_docs/python/expression_impl/parquet/ParquetDataset.md index b8261b6f..e3c95f47 100644 --- a/g3doc/api_docs/python/expression_impl/parquet/ParquetDataset.md +++ b/g3doc/api_docs/python/expression_impl/parquet/ParquetDataset.md @@ -3447,9 +3447,3 @@ execution is not enabled. - - - - - - diff --git a/g3doc/api_docs/python/expression_impl/parquet/calculate_parquet_values.md b/g3doc/api_docs/python/expression_impl/parquet/calculate_parquet_values.md index 393b3b94..620b6cd6 100644 --- a/g3doc/api_docs/python/expression_impl/parquet/calculate_parquet_values.md +++ b/g3doc/api_docs/python/expression_impl/parquet/calculate_parquet_values.md @@ -93,4 +93,3 @@ A parquet dataset. - diff --git a/g3doc/api_docs/python/expression_impl/parquet/create_expression_from_parquet_file.md b/g3doc/api_docs/python/expression_impl/parquet/create_expression_from_parquet_file.md index d8f3f9e0..d3405d8f 100644 --- a/g3doc/api_docs/python/expression_impl/parquet/create_expression_from_parquet_file.md +++ b/g3doc/api_docs/python/expression_impl/parquet/create_expression_from_parquet_file.md @@ -62,4 +62,3 @@ graph. - diff --git a/g3doc/api_docs/python/expression_impl/placeholder.md b/g3doc/api_docs/python/expression_impl/placeholder.md index a39e5242..4ddf5fb9 100644 --- a/g3doc/api_docs/python/expression_impl/placeholder.md +++ b/g3doc/api_docs/python/expression_impl/placeholder.md @@ -47,4 +47,3 @@ result = calculate.calculate_values([new_exp], [`create_expression_from_schema(...)`](../expression_impl/placeholder/create_expression_from_schema.md): Creates a placeholder expression from a parquet schema. [`get_placeholder_paths_from_graph(...)`](../expression_impl/placeholder/get_placeholder_paths_from_graph.md): Gets all placeholder paths from an expression graph. - diff --git a/g3doc/api_docs/python/expression_impl/placeholder/create_expression_from_schema.md b/g3doc/api_docs/python/expression_impl/placeholder/create_expression_from_schema.md index bf03a422..42b6c5dc 100644 --- a/g3doc/api_docs/python/expression_impl/placeholder/create_expression_from_schema.md +++ b/g3doc/api_docs/python/expression_impl/placeholder/create_expression_from_schema.md @@ -63,4 +63,3 @@ graph. - diff --git a/g3doc/api_docs/python/expression_impl/placeholder/get_placeholder_paths_from_graph.md b/g3doc/api_docs/python/expression_impl/placeholder/get_placeholder_paths_from_graph.md index a7f008e4..bfd7a79d 100644 --- a/g3doc/api_docs/python/expression_impl/placeholder/get_placeholder_paths_from_graph.md +++ b/g3doc/api_docs/python/expression_impl/placeholder/get_placeholder_paths_from_graph.md @@ -63,4 +63,3 @@ a list of paths of placeholder expressions - diff --git a/g3doc/api_docs/python/expression_impl/project.md b/g3doc/api_docs/python/expression_impl/project.md index 8fe4c1a2..be38db82 100644 --- a/g3doc/api_docs/python/expression_impl/project.md +++ b/g3doc/api_docs/python/expression_impl/project.md @@ -41,4 +41,3 @@ prensor_result now has two paths, "foo.bar" and "x.y". ## Functions [`project(...)`](../expression_impl/project/project.md): select a subtree. - diff --git a/g3doc/api_docs/python/expression_impl/project/project.md b/g3doc/api_docs/python/expression_impl/project/project.md index f8ac3e26..18f51585 100644 --- a/g3doc/api_docs/python/expression_impl/project/project.md +++ b/g3doc/api_docs/python/expression_impl/project/project.md @@ -72,4 +72,3 @@ A projected expression. - diff --git a/g3doc/api_docs/python/expression_impl/promote.md b/g3doc/api_docs/python/expression_impl/promote.md index 7053010d..a6083240 100644 --- a/g3doc/api_docs/python/expression_impl/promote.md +++ b/g3doc/api_docs/python/expression_impl/promote.md @@ -115,4 +115,3 @@ session: { [`promote(...)`](../expression_impl/promote/promote.md): Promote a path to be a child of its grandparent, and give it a name. [`promote_anonymous(...)`](../expression_impl/promote/promote_anonymous.md): Promote a path to be a new anonymous child of its grandparent. - diff --git a/g3doc/api_docs/python/expression_impl/promote/PromoteChildExpression.md b/g3doc/api_docs/python/expression_impl/promote/PromoteChildExpression.md index 540f2900..677e26df 100644 --- a/g3doc/api_docs/python/expression_impl/promote/PromoteChildExpression.md +++ b/g3doc/api_docs/python/expression_impl/promote/PromoteChildExpression.md @@ -1037,8 +1037,3 @@ Boolean of equality of two expressions - - - - - diff --git a/g3doc/api_docs/python/expression_impl/promote/PromoteExpression.md b/g3doc/api_docs/python/expression_impl/promote/PromoteExpression.md index b1f8e32a..69e476c7 100644 --- a/g3doc/api_docs/python/expression_impl/promote/PromoteExpression.md +++ b/g3doc/api_docs/python/expression_impl/promote/PromoteExpression.md @@ -1034,8 +1034,3 @@ Boolean of equality of two expressions - - - - - diff --git a/g3doc/api_docs/python/expression_impl/promote_and_broadcast.md b/g3doc/api_docs/python/expression_impl/promote_and_broadcast.md index ec7c211d..8e6ee469 100644 --- a/g3doc/api_docs/python/expression_impl/promote_and_broadcast.md +++ b/g3doc/api_docs/python/expression_impl/promote_and_broadcast.md @@ -123,4 +123,3 @@ session: { [`promote_and_broadcast(...)`](../expression_impl/promote_and_broadcast/promote_and_broadcast.md): Promote and broadcast a set of paths to a particular location. [`promote_and_broadcast_anonymous(...)`](../expression_impl/promote_and_broadcast/promote_and_broadcast_anonymous.md): Promotes then broadcasts the origin until its parent is new_parent. - diff --git a/g3doc/api_docs/python/expression_impl/promote_and_broadcast/promote_and_broadcast.md b/g3doc/api_docs/python/expression_impl/promote_and_broadcast/promote_and_broadcast.md index 212fe1f4..2626e1a9 100644 --- a/g3doc/api_docs/python/expression_impl/promote_and_broadcast/promote_and_broadcast.md +++ b/g3doc/api_docs/python/expression_impl/promote_and_broadcast/promote_and_broadcast.md @@ -78,4 +78,3 @@ until they are children of dest_path_parent. - diff --git a/g3doc/api_docs/python/expression_impl/proto.md b/g3doc/api_docs/python/expression_impl/proto.md index 9d0016bc..b09418d2 100644 --- a/g3doc/api_docs/python/expression_impl/proto.md +++ b/g3doc/api_docs/python/expression_impl/proto.md @@ -48,4 +48,3 @@ for its children. [`ProtoExpression`](../expression_impl/proto/ProtoExpression.md) [`TransformFn`](../expression_impl/proto/TransformFn.md) - diff --git a/g3doc/api_docs/python/expression_impl/proto/DescriptorPool.md b/g3doc/api_docs/python/expression_impl/proto/DescriptorPool.md index f5e36b61..e04a0884 100644 --- a/g3doc/api_docs/python/expression_impl/proto/DescriptorPool.md +++ b/g3doc/api_docs/python/expression_impl/proto/DescriptorPool.md @@ -806,8 +806,3 @@ if the service cannot be found in the pool. - - - - - diff --git a/g3doc/api_docs/python/expression_impl/proto/FileDescriptorSet.md b/g3doc/api_docs/python/expression_impl/proto/FileDescriptorSet.md index 373d76c0..d96631e2 100644 --- a/g3doc/api_docs/python/expression_impl/proto/FileDescriptorSet.md +++ b/g3doc/api_docs/python/expression_impl/proto/FileDescriptorSet.md @@ -36,6 +36,3 @@ A ProtocolMessage - - - diff --git a/g3doc/api_docs/python/expression_impl/proto/create_expression_from_file_descriptor_set.md b/g3doc/api_docs/python/expression_impl/proto/create_expression_from_file_descriptor_set.md index f0c24133..05744af1 100644 --- a/g3doc/api_docs/python/expression_impl/proto/create_expression_from_file_descriptor_set.md +++ b/g3doc/api_docs/python/expression_impl/proto/create_expression_from_file_descriptor_set.md @@ -90,4 +90,3 @@ An expression. - diff --git a/g3doc/api_docs/python/expression_impl/proto/create_expression_from_proto.md b/g3doc/api_docs/python/expression_impl/proto/create_expression_from_proto.md index 4a2744c3..02e5c1ae 100644 --- a/g3doc/api_docs/python/expression_impl/proto/create_expression_from_proto.md +++ b/g3doc/api_docs/python/expression_impl/proto/create_expression_from_proto.md @@ -78,4 +78,3 @@ An expression. - diff --git a/g3doc/api_docs/python/expression_impl/proto/create_transformed_field.md b/g3doc/api_docs/python/expression_impl/proto/create_transformed_field.md index 7555fb92..820ada00 100644 --- a/g3doc/api_docs/python/expression_impl/proto/create_transformed_field.md +++ b/g3doc/api_docs/python/expression_impl/proto/create_transformed_field.md @@ -123,4 +123,3 @@ if the source path is not a proto message field. - diff --git a/g3doc/api_docs/python/expression_impl/reroot.md b/g3doc/api_docs/python/expression_impl/reroot.md index e1bf6456..318fc738 100644 --- a/g3doc/api_docs/python/expression_impl/reroot.md +++ b/g3doc/api_docs/python/expression_impl/reroot.md @@ -32,4 +32,3 @@ original proto. [`create_proto_index_field(...)`](../expression_impl/reroot/create_proto_index_field.md) [`reroot(...)`](../expression_impl/reroot/reroot.md): Reroot to a new path, maintaining a input proto index. - diff --git a/g3doc/api_docs/python/expression_impl/reroot/reroot.md b/g3doc/api_docs/python/expression_impl/reroot/reroot.md index 7b99d937..098c356f 100644 --- a/g3doc/api_docs/python/expression_impl/reroot/reroot.md +++ b/g3doc/api_docs/python/expression_impl/reroot/reroot.md @@ -71,4 +71,3 @@ the new root. - diff --git a/g3doc/api_docs/python/expression_impl/size.md b/g3doc/api_docs/python/expression_impl/size.md index 94ec2dac..77c413db 100644 --- a/g3doc/api_docs/python/expression_impl/size.md +++ b/g3doc/api_docs/python/expression_impl/size.md @@ -50,4 +50,3 @@ is always present, and is true if there are one or more bar in foo. [`size(...)`](../expression_impl/size/size.md): Get the size of a field as a new sibling field. [`size_anonymous(...)`](../expression_impl/size/size_anonymous.md): Calculate the size of a field, and store it as an anonymous sibling. - diff --git a/g3doc/api_docs/python/expression_impl/size/SizeExpression.md b/g3doc/api_docs/python/expression_impl/size/SizeExpression.md index 3adb5e0d..f8e720d6 100644 --- a/g3doc/api_docs/python/expression_impl/size/SizeExpression.md +++ b/g3doc/api_docs/python/expression_impl/size/SizeExpression.md @@ -1036,8 +1036,3 @@ Boolean of equality of two expressions - - - - - diff --git a/g3doc/api_docs/python/expression_impl/size/has.md b/g3doc/api_docs/python/expression_impl/size/has.md index 3dc9d639..584ccb56 100644 --- a/g3doc/api_docs/python/expression_impl/size/has.md +++ b/g3doc/api_docs/python/expression_impl/size/has.md @@ -77,4 +77,3 @@ The new expression. - diff --git a/g3doc/api_docs/python/expression_impl/size/size.md b/g3doc/api_docs/python/expression_impl/size/size.md index 819c9e38..7034f513 100644 --- a/g3doc/api_docs/python/expression_impl/size/size.md +++ b/g3doc/api_docs/python/expression_impl/size/size.md @@ -77,4 +77,3 @@ The new expression. - diff --git a/g3doc/api_docs/python/expression_impl/size/size_anonymous.md b/g3doc/api_docs/python/expression_impl/size/size_anonymous.md index 792d3712..7f6189cc 100644 --- a/g3doc/api_docs/python/expression_impl/size/size_anonymous.md +++ b/g3doc/api_docs/python/expression_impl/size/size_anonymous.md @@ -69,4 +69,3 @@ The new expression and the new field as a pair. - diff --git a/g3doc/api_docs/python/expression_impl/slice_expression.md b/g3doc/api_docs/python/expression_impl/slice_expression.md index 9ba697da..67f6f8d5 100644 --- a/g3doc/api_docs/python/expression_impl/slice_expression.md +++ b/g3doc/api_docs/python/expression_impl/slice_expression.md @@ -132,4 +132,3 @@ result_2 = [{ ## Type Aliases [`IndexValue`](../expression_impl/slice_expression/IndexValue.md) - diff --git a/g3doc/api_docs/python/expression_impl/slice_expression/slice_expression.md b/g3doc/api_docs/python/expression_impl/slice_expression/slice_expression.md index 9de0d23a..7e6a205c 100644 --- a/g3doc/api_docs/python/expression_impl/slice_expression/slice_expression.md +++ b/g3doc/api_docs/python/expression_impl/slice_expression/slice_expression.md @@ -95,4 +95,3 @@ A new root expression. - diff --git a/g3doc/api_docs/python/s2t.md b/g3doc/api_docs/python/s2t.md index 6f5e8c61..547f8724 100644 --- a/g3doc/api_docs/python/s2t.md +++ b/g3doc/api_docs/python/s2t.md @@ -75,4 +75,3 @@ Import core names for struct2tensor. [`NodeTensor`](./s2t/NodeTensor.md) [`Step`](./s2t/Step.md) - diff --git a/g3doc/api_docs/python/s2t/ChildNodeTensor.md b/g3doc/api_docs/python/s2t/ChildNodeTensor.md index cc3d3c14..4c6ac42d 100644 --- a/g3doc/api_docs/python/s2t/ChildNodeTensor.md +++ b/g3doc/api_docs/python/s2t/ChildNodeTensor.md @@ -132,8 +132,3 @@ A tensor of positional indices. - - - - - diff --git a/g3doc/api_docs/python/s2t/Expression.md b/g3doc/api_docs/python/s2t/Expression.md index dd32541d..e2e5036a 100644 --- a/g3doc/api_docs/python/s2t/Expression.md +++ b/g3doc/api_docs/python/s2t/Expression.md @@ -1095,8 +1095,3 @@ Boolean of equality of two expressions - - - - - diff --git a/g3doc/api_docs/python/s2t/LeafNodeTensor.md b/g3doc/api_docs/python/s2t/LeafNodeTensor.md index eb7bbb04..077465cf 100644 --- a/g3doc/api_docs/python/s2t/LeafNodeTensor.md +++ b/g3doc/api_docs/python/s2t/LeafNodeTensor.md @@ -140,8 +140,3 @@ A tensor of positional indices. - - - - - diff --git a/g3doc/api_docs/python/s2t/Path.md b/g3doc/api_docs/python/s2t/Path.md index 6fa08b7c..1b03ff5c 100644 --- a/g3doc/api_docs/python/s2t/Path.md +++ b/g3doc/api_docs/python/s2t/Path.md @@ -334,7 +334,3 @@ Return self Return self!=value. - - - - diff --git a/g3doc/api_docs/python/s2t/Prensor.md b/g3doc/api_docs/python/s2t/Prensor.md index e26a3689..948309fa 100644 --- a/g3doc/api_docs/python/s2t/Prensor.md +++ b/g3doc/api_docs/python/s2t/Prensor.md @@ -377,8 +377,3 @@ A map from paths to sparse tensors. - - - - - diff --git a/g3doc/api_docs/python/s2t/RootNodeTensor.md b/g3doc/api_docs/python/s2t/RootNodeTensor.md index c38c9292..6cfce4a0 100644 --- a/g3doc/api_docs/python/s2t/RootNodeTensor.md +++ b/g3doc/api_docs/python/s2t/RootNodeTensor.md @@ -104,8 +104,3 @@ A tensor of positional indices. - - - - - diff --git a/g3doc/api_docs/python/s2t/all_symbols.md b/g3doc/api_docs/python/s2t/all_symbols.md index bd052bbb..5ae44300 100644 --- a/g3doc/api_docs/python/s2t/all_symbols.md +++ b/g3doc/api_docs/python/s2t/all_symbols.md @@ -26,4 +26,4 @@ * s2t.get_ragged_tensor * s2t.get_ragged_tensors * s2t.get_sparse_tensor -* s2t.get_sparse_tensors \ No newline at end of file +* s2t.get_sparse_tensors diff --git a/g3doc/api_docs/python/s2t/calculate_prensors.md b/g3doc/api_docs/python/s2t/calculate_prensors.md index ee30dea9..83375a70 100644 --- a/g3doc/api_docs/python/s2t/calculate_prensors.md +++ b/g3doc/api_docs/python/s2t/calculate_prensors.md @@ -78,4 +78,3 @@ a list of prensors. - diff --git a/g3doc/api_docs/python/s2t/calculate_prensors_with_graph.md b/g3doc/api_docs/python/s2t/calculate_prensors_with_graph.md index e1a05b30..1a327f9b 100644 --- a/g3doc/api_docs/python/s2t/calculate_prensors_with_graph.md +++ b/g3doc/api_docs/python/s2t/calculate_prensors_with_graph.md @@ -80,4 +80,3 @@ a list of prensors, and the graph used to calculate them. - diff --git a/g3doc/api_docs/python/s2t/create_expression_from_file_descriptor_set.md b/g3doc/api_docs/python/s2t/create_expression_from_file_descriptor_set.md index 77c80eba..f8f9e0d1 100644 --- a/g3doc/api_docs/python/s2t/create_expression_from_file_descriptor_set.md +++ b/g3doc/api_docs/python/s2t/create_expression_from_file_descriptor_set.md @@ -90,4 +90,3 @@ An expression. - diff --git a/g3doc/api_docs/python/s2t/create_expression_from_prensor.md b/g3doc/api_docs/python/s2t/create_expression_from_prensor.md index f72995e6..582cd0ff 100644 --- a/g3doc/api_docs/python/s2t/create_expression_from_prensor.md +++ b/g3doc/api_docs/python/s2t/create_expression_from_prensor.md @@ -61,4 +61,3 @@ An expression representing the prensor. - diff --git a/g3doc/api_docs/python/s2t/create_expression_from_proto.md b/g3doc/api_docs/python/s2t/create_expression_from_proto.md index 4a720e8b..104735ee 100644 --- a/g3doc/api_docs/python/s2t/create_expression_from_proto.md +++ b/g3doc/api_docs/python/s2t/create_expression_from_proto.md @@ -78,4 +78,3 @@ An expression. - diff --git a/g3doc/api_docs/python/s2t/create_path.md b/g3doc/api_docs/python/s2t/create_path.md index 65ba8416..af9bc123 100644 --- a/g3doc/api_docs/python/s2t/create_path.md +++ b/g3doc/api_docs/python/s2t/create_path.md @@ -91,4 +91,3 @@ if this is not a valid path. - diff --git a/g3doc/api_docs/python/s2t/create_prensor_from_descendant_nodes.md b/g3doc/api_docs/python/s2t/create_prensor_from_descendant_nodes.md index 4222a521..79e0ae2e 100644 --- a/g3doc/api_docs/python/s2t/create_prensor_from_descendant_nodes.md +++ b/g3doc/api_docs/python/s2t/create_prensor_from_descendant_nodes.md @@ -79,4 +79,3 @@ if there is a prefix of a path missing. - diff --git a/g3doc/api_docs/python/s2t/get_ragged_tensor.md b/g3doc/api_docs/python/s2t/get_ragged_tensor.md index 04eaeaf5..2d849dbf 100644 --- a/g3doc/api_docs/python/s2t/get_ragged_tensor.md +++ b/g3doc/api_docs/python/s2t/get_ragged_tensor.md @@ -83,4 +83,3 @@ structure along the path. Raises an error if the path is not found. - diff --git a/g3doc/api_docs/python/s2t/get_ragged_tensors.md b/g3doc/api_docs/python/s2t/get_ragged_tensors.md index 3bf21712..2d9569ca 100644 --- a/g3doc/api_docs/python/s2t/get_ragged_tensors.md +++ b/g3doc/api_docs/python/s2t/get_ragged_tensors.md @@ -72,4 +72,3 @@ A map from paths to ragged tensors. - diff --git a/g3doc/api_docs/python/s2t/get_sparse_tensor.md b/g3doc/api_docs/python/s2t/get_sparse_tensor.md index b6ec8ab2..9ab43550 100644 --- a/g3doc/api_docs/python/s2t/get_sparse_tensor.md +++ b/g3doc/api_docs/python/s2t/get_sparse_tensor.md @@ -84,4 +84,3 @@ structure along the path. Raises an error if the path is not found. - diff --git a/g3doc/api_docs/python/s2t/get_sparse_tensors.md b/g3doc/api_docs/python/s2t/get_sparse_tensors.md index 4c50fb75..baff2108 100644 --- a/g3doc/api_docs/python/s2t/get_sparse_tensors.md +++ b/g3doc/api_docs/python/s2t/get_sparse_tensors.md @@ -72,4 +72,3 @@ A map from paths to sparse tensors. - diff --git a/third_party/llvm_configure.patch b/third_party/llvm_configure.patch index adf3c3e7..2dd8a458 100644 --- a/third_party/llvm_configure.patch +++ b/third_party/llvm_configure.patch @@ -3,7 +3,7 @@ @@ -53,7 +53,7 @@ name = entry.basename full_rel_path = rel_dir + "/" + name - + - if entry.is_dir: + if repository_ctx.execute(["test", "-d", str(entry)]).return_code == 0: stack.append(full_rel_path) diff --git a/third_party/protobuf_retain_options.patch b/third_party/protobuf_retain_options.patch index fea9f1ad..40366edc 100644 --- a/third_party/protobuf_retain_options.patch +++ b/third_party/protobuf_retain_options.patch @@ -4,4 +4,3 @@ if ctx.attr._experimental_proto_descriptor_sets_include_source_info[BuildSettingInfo].value: args.add("--include_source_info") - args.add("--retain_options") - diff --git a/third_party/tensorflow.patch b/third_party/tensorflow.patch index 76a4a40d..0f2f58df 100644 --- a/third_party/tensorflow.patch +++ b/third_party/tensorflow.patch @@ -105,7 +105,7 @@ index 2a03c511e..8d73d6f85 100644 @@ -19,7 +19,7 @@ limitations under the License. #include #include - + -#include "absl/base/prefetch.h" +#include "absl_base_prefetch.h" #include "absl/numeric/int128.h" diff --git a/third_party/tfmd.patch b/third_party/tfmd.patch index c509daf6..9c1f95a6 100644 --- a/third_party/tfmd.patch +++ b/third_party/tfmd.patch @@ -4,12 +4,12 @@ index 24cf416..9e426aa 100644 +++ b/tensorflow_metadata/proto/v0/BUILD @@ -14,8 +14,6 @@ # ============================================================================== - - + + -load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") - licenses(["notice"]) # Apache 2.0 - + package(default_visibility = ["//visibility:public"]) @@ -24,26 +22,20 @@ proto_library( name = "metadata_v0_proto", @@ -42,7 +42,7 @@ index 24cf416..9e426aa 100644 @@ -60,10 +52,12 @@ cc_library( deps = [":cc_metadata_v0_proto_cc"], ) - + -py_proto_library( +alias( name = "metadata_v0_proto_py_pb2", @@ -51,7 +51,7 @@ index 24cf416..9e426aa 100644 - ], + actual = ":metadata_v0_proto", ) - + +alias( + name = "metadata_v0_proto_py_pb2_genproto", + actual = ":metadata_v0_proto", From 3d4acde08164199c2caf848105b67802d889b554 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 23:48:07 +0000 Subject: [PATCH 17/32] Fix Protobuf version mismatch by disabling Bzlmod and moving toolchain registration --- .bazelrc | 9 +- WORKSPACE | 6 +- third_party/protobuf_retain_options.patch | 6 +- third_party/protobuf_tensorflow.patch | 231 ++++++++++++++++++++++ 4 files changed, 245 insertions(+), 7 deletions(-) create mode 100644 third_party/protobuf_tensorflow.patch diff --git a/.bazelrc b/.bazelrc index f6143279..1451ba35 100644 --- a/.bazelrc +++ b/.bazelrc @@ -43,11 +43,12 @@ build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 # Disable sframe in assembler to avoid linker errors with gcc 15 build:linux --copt=-Wa,--gsframe=no - - - - # Suppress all warning messages. build:short_logs --output_filter=DONT_MATCH_ANYTHING build:macos --macos_minimum_os=10.12 + +common --noenable_bzlmod + +test --noincompatible_check_sharding_support + diff --git a/WORKSPACE b/WORKSPACE index c5ef0468..d2108102 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -119,10 +119,14 @@ http_archive( urls = [ "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip", ], - patches = ["//third_party:protobuf_retain_options.patch"], + patches = ["//third_party:protobuf_tensorflow.patch"], patch_args = ["-p1"], ) +register_toolchains( + "@com_google_protobuf//bazel/private/toolchains:cc_source_toolchain_bazel7", +) + # ===== TensorFlow dependency ===== # # TensorFlow is imported here instead of in tf_serving_workspace() because diff --git a/third_party/protobuf_retain_options.patch b/third_party/protobuf_retain_options.patch index 40366edc..31a1e07a 100644 --- a/third_party/protobuf_retain_options.patch +++ b/third_party/protobuf_retain_options.patch @@ -1,6 +1,8 @@ --- a/bazel/private/proto_library_rule.bzl -+++ b/b/bazel/private/proto_library_rule.bzl -@@ -166,4 +166,3 @@ ++++ b/bazel/private/proto_library_rule.bzl +@@ -165,5 +165,4 @@ + args = ctx.actions.args() + if ctx.attr._experimental_proto_descriptor_sets_include_source_info[BuildSettingInfo].value: args.add("--include_source_info") - args.add("--retain_options") diff --git a/third_party/protobuf_tensorflow.patch b/third_party/protobuf_tensorflow.patch new file mode 100644 index 00000000..0aa73359 --- /dev/null +++ b/third_party/protobuf_tensorflow.patch @@ -0,0 +1,231 @@ +diff --git a/BUILD.bazel b/BUILD.bazel +--- a/BUILD.bazel ++++ b/BUILD.bazel +@@ -555,7 +555,8 @@ proto_lang_toolchain( + "//:cpp_features_proto", + "//:descriptor_proto", + ], +- command_line = "--cpp_out=$(OUT)", ++ command_line = "--cpp_out=dllexport_decl=PROTOBUF_EXPORT:$(OUT)", ++ protoc_minimal_do_not_use = "//:protoc", + runtime = "//src/google/protobuf", + visibility = ["//visibility:public"], + ) +diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel +--- a/build_defs/BUILD.bazel ++++ b/build_defs/BUILD.bazel +@@ -1,6 +1,7 @@ + # Internal Starlark definitions for Protobuf. + + load("@bazel_skylib//lib:selects.bzl", "selects") ++load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") + load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") + load("//bazel:cc_proto_library.bzl", starlark_cc_proto_library = "cc_proto_library") + load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test") +@@ -13,6 +14,20 @@ package( + ], + ) + ++bool_flag( ++ name = "use_dlls", ++ build_setting_default = False, ++ visibility = ["//visibility:public"], ++) ++ ++config_setting( ++ name = "config_use_dlls", ++ flag_values = { ++ ":use_dlls": "True", ++ }, ++ visibility = ["//visibility:public"], ++) ++ + create_compiler_config_setting( + name = "config_msvc_cl", + value = "msvc-cl", +diff --git a/python/dist/system_python.bzl b/python/dist/system_python.bzl +--- a/python/dist/system_python.bzl ++++ b/python/dist/system_python.bzl +@@ -73,11 +73,10 @@ load("@bazel_skylib//lib:selects.bzl", "selects") + load("@bazel_skylib//rules:common_settings.bzl", "string_flag") + load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair") + +-cc_library( +- name = "python_headers", +- hdrs = glob(["python/**/*.h"], allow_empty = True), +- includes = ["python"], +- visibility = ["//visibility:public"], ++alias( ++ name = "python_headers", ++ actual = "@rules_python//python/cc:current_py_cc_headers", ++ visibility = ["//visibility:public"], + ) + + string_flag( +@@ -219,7 +218,7 @@ def _system_python_impl(repository_ctx): + python3 = repository_ctx.which("python3") + python_version = _get_python_version(repository_ctx) + +- if path and python_version[0] == "3": ++ if False: + _populate_package(repository_ctx, path, python3, python_version) + else: + # buildifier: disable=print +diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py +--- a/python/google/protobuf/__init__.py ++++ b/python/google/protobuf/__init__.py +@@ -8,3 +8,9 @@ + # Copyright 2007 Google Inc. All Rights Reserved. + + __version__ = '6.31.1' ++ ++if __name__ != '__main__': ++ try: ++ __import__('pkg_resources').declare_namespace(__name__) ++ except ImportError: ++ __path__ = __import__('pkgutil').extend_path(__path__, __name__) +diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel +--- a/src/google/protobuf/BUILD.bazel ++++ b/src/google/protobuf/BUILD.bazel +@@ -525,6 +525,13 @@ cc_library( + "serial_arena.h", + "thread_safe_arena.h", + ], ++ local_defines = select({ ++ "//build_defs:config_use_dlls": [ ++ "PROTOBUF_USE_DLLS", ++ "LIBPROTOBUF_EXPORTS", ++ ], ++ "//conditions:default": [], ++ }), + strip_include_prefix = "/src", + visibility = [ + "//:__subpackages__", +@@ -657,7 +664,15 @@ cc_library( + "serial_arena.h", + "thread_safe_arena.h", + "wire_format_lite.h", ++ "port.h", + ], ++ local_defines = select({ ++ "//build_defs:config_use_dlls": [ ++ "PROTOBUF_USE_DLLS", ++ "LIBPROTOBUF_EXPORTS", ++ ], ++ "//conditions:default": [], ++ }), + copts = COPTS + select({ + "//build_defs:config_msvc": [], + "//conditions:default": [ +@@ -767,6 +782,13 @@ cc_library( + ], + hdrs = PROTOBUF_HEADERS, + copts = COPTS, ++ local_defines = select({ ++ "//build_defs:config_use_dlls": [ ++ "PROTOBUF_USE_DLLS", ++ "LIBPROTOBUF_EXPORTS", ++ ], ++ "//conditions:default": [], ++ }), + linkopts = LINK_OPTS, + strip_include_prefix = "/src", + visibility = [ +diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc +--- a/src/google/protobuf/arena.cc ++++ b/src/google/protobuf/arena.cc +@@ -547,7 +547,7 @@ ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() { + new internal::ThreadLocalStorage(); + return *thread_cache_->Get(); + } +-#elif defined(PROTOBUF_USE_DLLS) && defined(_WIN32) ++#elif defined(_WIN32) + ThreadSafeArena::ThreadCache& ThreadSafeArena::thread_cache() { + static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache; + return thread_cache; +diff --git a/src/google/protobuf/io/BUILD.bazel b/src/google/protobuf/io/BUILD.bazel +--- a/src/google/protobuf/io/BUILD.bazel ++++ b/src/google/protobuf/io/BUILD.bazel +@@ -22,6 +22,13 @@ cc_library( + "zero_copy_stream_impl.h", + "zero_copy_stream_impl_lite.h", + ], ++ local_defines = select({ ++ "//build_defs:config_use_dlls": [ ++ "PROTOBUF_USE_DLLS", ++ "LIBPROTOBUF_EXPORTS", ++ ], ++ "//conditions:default": [], ++ }), + copts = COPTS, + strip_include_prefix = "/src", + deps = [ +diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc +--- a/src/google/protobuf/port_def.inc ++++ b/src/google/protobuf/port_def.inc +@@ -421,7 +421,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), + #endif + + // Lexan sets both MSV_VER and clang, so handle it with the clang path. +-#if defined(_MSC_VER) && !defined(__clang__) ++#if defined(_MSC_VER) + // MSVC 17 currently seems to raise an error about constant-initialized pointers. + # if PROTOBUF_MSC_VER_MIN(1930) + # define PROTOBUF_CONSTINIT +diff --git a/src/google/protobuf/thread_safe_arena.h b/src/google/protobuf/thread_safe_arena.h +--- a/src/google/protobuf/thread_safe_arena.h ++++ b/src/google/protobuf/thread_safe_arena.h +@@ -249,7 +249,7 @@ class PROTOBUF_EXPORT ThreadSafeArena { + // iOS does not support __thread keyword so we use a custom thread local + // storage class we implemented. + static ThreadCache& thread_cache(); +-#elif defined(PROTOBUF_USE_DLLS) && defined(_WIN32) ++#elif defined(_WIN32) + // Thread local variables cannot be exposed through MSVC DLL interface but we + // can wrap them in static functions. + static ThreadCache& thread_cache(); +diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc +--- a/src/google/protobuf/port_def.inc ++++ b/src/google/protobuf/port_def.inc +@@ -196,5 +196,14 @@ + #else + #define PROTOBUF_ALWAYS_INLINE_CALL + #endif ++ ++#define PROTOBUF_NAMESPACE "google::protobuf" ++#define PROTOBUF_NAMESPACE_ID google::protobuf ++#define PROTOBUF_NAMESPACE_OPEN \ ++ namespace google { \ ++ namespace protobuf { ++#define PROTOBUF_NAMESPACE_CLOSE \ ++ } /* namespace protobuf */ \ ++ } /* namespace google */ + + #ifdef PROTOBUF_NDEBUG_INLINE + +diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel +--- a/src/google/protobuf/BUILD.bazel ++++ b/src/google/protobuf/BUILD.bazel +@@ -295,7 +295,7 @@ cc_library( + includes = ["wkt"], + linkopts = LINK_OPTS, + strip_include_prefix = "/src", +- visibility = ["//pkg:__pkg__"], ++ visibility = ["//visibility:public"], + deps = [ + ":port", + ":protobuf", +diff --git a/src/google/protobuf/util/BUILD.bazel b/src/google/protobuf/util/BUILD.bazel +--- a/src/google/protobuf/util/BUILD.bazel ++++ b/src/google/protobuf/util/BUILD.bazel +@@ -170,9 +170,8 @@ cc_library( + ], + deps = [ + "//src/google/protobuf", +- "//src/google/protobuf:duration_cc_proto", ++ "//src/google/protobuf:cmake_wkt_cc_proto", + "//src/google/protobuf:port", +- "//src/google/protobuf:timestamp_cc_proto", + "//src/google/protobuf/stubs", + "@abseil-cpp//absl/log:absl_check", + "@abseil-cpp//absl/numeric:int128", From 801b36b5329678f3943c2b1152e747fdd7870a00 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 23:49:35 +0000 Subject: [PATCH 18/32] Fix trailing whitespace and end-of-file issues identified by pre-commit --- .bazelrc | 1 - third_party/protobuf_retain_options.patch | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index 1451ba35..83868316 100644 --- a/.bazelrc +++ b/.bazelrc @@ -51,4 +51,3 @@ build:macos --macos_minimum_os=10.12 common --noenable_bzlmod test --noincompatible_check_sharding_support - diff --git a/third_party/protobuf_retain_options.patch b/third_party/protobuf_retain_options.patch index 31a1e07a..c7a19b3f 100644 --- a/third_party/protobuf_retain_options.patch +++ b/third_party/protobuf_retain_options.patch @@ -2,7 +2,7 @@ +++ b/bazel/private/proto_library_rule.bzl @@ -165,5 +165,4 @@ args = ctx.actions.args() - + if ctx.attr._experimental_proto_descriptor_sets_include_source_info[BuildSettingInfo].value: args.add("--include_source_info") - args.add("--retain_options") From 235d30bcbbc8681a85e9a13ebb9db4805fa4fdce Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Sun, 12 Apr 2026 23:51:55 +0000 Subject: [PATCH 19/32] Delete unused protobuf_retain_options.patch --- third_party/protobuf_retain_options.patch | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 third_party/protobuf_retain_options.patch diff --git a/third_party/protobuf_retain_options.patch b/third_party/protobuf_retain_options.patch deleted file mode 100644 index c7a19b3f..00000000 --- a/third_party/protobuf_retain_options.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- a/bazel/private/proto_library_rule.bzl -+++ b/bazel/private/proto_library_rule.bzl -@@ -165,5 +165,4 @@ - args = ctx.actions.args() - - if ctx.attr._experimental_proto_descriptor_sets_include_source_info[BuildSettingInfo].value: - args.add("--include_source_info") -- args.add("--retain_options") From 3337585743b95e1bbb7d03be02b4bb18745133f8 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 00:12:55 +0000 Subject: [PATCH 20/32] Move --gsframe=no to a separate sframe_fix config in .bazelrc to fix CI failure --- .bazelrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index 83868316..bad3acde 100644 --- a/.bazelrc +++ b/.bazelrc @@ -40,12 +40,14 @@ build --host_cxxopt=-std=c++17 build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 -# Disable sframe in assembler to avoid linker errors with gcc 15 -build:linux --copt=-Wa,--gsframe=no # Suppress all warning messages. + build:short_logs --output_filter=DONT_MATCH_ANYTHING +# Config to disable sframe in assembler to avoid linker errors with gcc 15 +build:sframe_fix --copt=-Wa,--gsframe=no + build:macos --macos_minimum_os=10.12 common --noenable_bzlmod From fad675143731870a3d36c37552a511638e50d762 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 22:32:31 +0000 Subject: [PATCH 21/32] Simplify protobuf dependency in setup.py to a single line --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3a28846c..8e392bda 100644 --- a/setup.py +++ b/setup.py @@ -79,8 +79,8 @@ def select_constraint(default, nightly=None, git_master=None): # TODO(b/263060885): Remove the explicit numpy dependency once TF works # with numpy>=1.24. 'numpy>=1.22', - 'protobuf>=4.25.2,<7.0.0;python_version>="3.11"', - 'protobuf>=4.21.6,<7.0.0;python_version<"3.11"', + 'protobuf>=4.25.2,<7.0.0', + 'tensorflow>=2.21,<2.22', 'tensorflow-metadata' + select_constraint( From 282602814ebc9e234548c0d91f7aee6591bd1c1f Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 22:36:28 +0000 Subject: [PATCH 22/32] Add python-version matrix to build.yml to test on 3.10, 3.11, 3.12 --- .github/workflows/build.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f9bee83..d6d71ca1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,21 +8,24 @@ on: jobs: build: - name: Build (${{ matrix.os }}) + name: Build (${{ matrix.os }}, Python ${{ matrix.python-version }}) runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest] + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up conda environment + uses: conda-incubator/setup-miniconda@v3 + with: + auto-activate-base: false + activate-environment: s2t-env + environment-file: environment.yml + python-version: ${{ matrix.python-version }} - steps: - - uses: actions/checkout@v4 - - - name: Set up conda environment - uses: conda-incubator/setup-miniconda@v3 - with: - auto-activate-base: false - activate-environment: s2t-env - environment-file: environment.yml - name: Install Bazel shell: bash -l {0} From bf3cb99d0107af812cef09d0125249f639a95c06 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 22:37:50 +0000 Subject: [PATCH 23/32] Fix YAML indentation in build.yml --- .github/workflows/build.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6d71ca1..dc0964eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,18 +14,17 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] python-version: ["3.10", "3.11", "3.12"] - - steps: - - uses: actions/checkout@v4 - - - name: Set up conda environment - uses: conda-incubator/setup-miniconda@v3 - with: - auto-activate-base: false - activate-environment: s2t-env - environment-file: environment.yml - python-version: ${{ matrix.python-version }} + steps: + - uses: actions/checkout@v4 + + - name: Set up conda environment + uses: conda-incubator/setup-miniconda@v3 + with: + auto-activate-base: false + activate-environment: s2t-env + environment-file: environment.yml + python-version: ${{ matrix.python-version }} - name: Install Bazel shell: bash -l {0} From 77ff03e8e62861e0797a12378f7a078c223b781d Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 22:39:22 +0000 Subject: [PATCH 24/32] Remove fixed python version from environment.yml in CI before setup-miniconda --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc0964eb..7f798975 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Remove fixed python version from environment.yml + run: python -c "with open('environment.yml') as f: lines = f.readlines(); with open('environment.yml', 'w') as f: [f.write(l) for l in lines if '- python=' not in l]" + - name: Set up conda environment uses: conda-incubator/setup-miniconda@v3 with: From d65f52f543f5ace2228ebe0ae4d57c094688209a Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 22:40:36 +0000 Subject: [PATCH 25/32] Use python version range in environment.yml and remove CI removal step --- .github/workflows/build.yml | 3 --- environment.yml | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f798975..dc0964eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,9 +18,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Remove fixed python version from environment.yml - run: python -c "with open('environment.yml') as f: lines = f.readlines(); with open('environment.yml', 'w') as f: [f.write(l) for l in lines if '- python=' not in l]" - - name: Set up conda environment uses: conda-incubator/setup-miniconda@v3 with: diff --git a/environment.yml b/environment.yml index a2d79c8a..8bc8f6f7 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,8 @@ name: s2t-env-py312 channels: - conda-forge dependencies: - - python=3.12 + - python>=3.10,<3.13 + - pip - pip: - --index-url https://pypi.org/simple From fa31c0d80cd2270337ad5d59981284f307342a7a Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Mon, 13 Apr 2026 23:43:53 +0000 Subject: [PATCH 26/32] Relax Keras constraint in environment.yml to >=3.0.0 --- environment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 8bc8f6f7..4e6e7334 100644 --- a/environment.yml +++ b/environment.yml @@ -20,7 +20,8 @@ dependencies: - grpcio==1.78.0 - h5py==3.14.0 - idna==3.11 - - keras==3.13.2 + - keras>=3.0.0 + - libclang==18.1.1 - macholib==1.16.4 - markdown==3.10.2 From 471c5b45b7b5835204096491c8858359e41f10cf Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Tue, 14 Apr 2026 03:04:41 +0000 Subject: [PATCH 27/32] Point TFMD to user's fork on branch align-tf-2.21 --- struct2tensor/workspace.bzl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/struct2tensor/workspace.bzl b/struct2tensor/workspace.bzl index 14302e0a..8d2427b9 100644 --- a/struct2tensor/workspace.bzl +++ b/struct2tensor/workspace.bzl @@ -71,14 +71,9 @@ def struct2tensor_workspace(): urls = ["https://github.com/apache/arrow/archive/%s.zip" % ARROW_COMMIT], ) - _TFMD_COMMIT_HASH = "404805761e614561cceedc429e67c357c62be26d" # 1.17.1 - http_archive( + git_repository( name = "com_github_tensorflow_metadata", - sha256 = "9abfe4019f33ff067438ce69053fe63fc2e8dde5192aa7cf30d501809e45c18c", - strip_prefix = "metadata-%s" % _TFMD_COMMIT_HASH, - urls = [ - "https://github.com/tensorflow/metadata/archive/%s.tar.gz" % _TFMD_COMMIT_HASH, - ], - patches = ["//third_party:tfmd.patch"], - patch_args = ["-p1"], + remote = "https://github.com/vkarampudi/metadata.git", + branch = "align-tf-2.21", ) + From 7a4936861626a19f4d367f9a0be0f0c5173fde52 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Tue, 14 Apr 2026 03:12:11 +0000 Subject: [PATCH 28/32] Add tfmd_fork.patch and update workspace.bzl to use it with -p0 --- struct2tensor/workspace.bzl | 5 +++++ third_party/tfmd_fork.patch | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 third_party/tfmd_fork.patch diff --git a/struct2tensor/workspace.bzl b/struct2tensor/workspace.bzl index 8d2427b9..c7e1e10b 100644 --- a/struct2tensor/workspace.bzl +++ b/struct2tensor/workspace.bzl @@ -75,5 +75,10 @@ def struct2tensor_workspace(): name = "com_github_tensorflow_metadata", remote = "https://github.com/vkarampudi/metadata.git", branch = "align-tf-2.21", + patches = ["//third_party:tfmd_fork.patch"], + + patch_args = ["-p0"], + ) + diff --git a/third_party/tfmd_fork.patch b/third_party/tfmd_fork.patch new file mode 100644 index 00000000..db72696b --- /dev/null +++ b/third_party/tfmd_fork.patch @@ -0,0 +1,15 @@ +--- tensorflow_metadata/proto/v0/BUILD ++++ tensorflow_metadata/proto/v0/BUILD +@@ -17,1 +17,0 @@ +-load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") +@@ -63,6 +62,4 @@ +-py_proto_library( +- name = "metadata_v0_proto_py_pb2", +- deps = [ +- ":metadata_v0_proto", +- ], +-) ++alias( ++ name = "metadata_v0_proto_py_pb2", ++ actual = ":metadata_v0_proto", ++) From a157f705118a3f100f2284761bf57752d76fba46 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Tue, 14 Apr 2026 03:13:16 +0000 Subject: [PATCH 29/32] Apply pre-commit fixes and update .bazelrc from configure --- .bazelrc | 3 +++ struct2tensor/workspace.bzl | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index bad3acde..15ce75f0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -53,3 +53,6 @@ build:macos --macos_minimum_os=10.12 common --noenable_bzlmod test --noincompatible_check_sharding_support +build --action_env TF_HEADER_DIR="/usr/local/google/home/vkarampudi/anaconda3/envs/s2t-env-py312/lib/python3.12/site-packages/tensorflow/include" +build --action_env TF_SHARED_LIBRARY_DIR="/usr/local/google/home/vkarampudi/anaconda3/envs/s2t-env-py312/lib/python3.12/site-packages/tensorflow" +build --action_env TF_SHARED_LIBRARY_NAME="libtensorflow_framework.so.2" diff --git a/struct2tensor/workspace.bzl b/struct2tensor/workspace.bzl index c7e1e10b..9b3fbad7 100644 --- a/struct2tensor/workspace.bzl +++ b/struct2tensor/workspace.bzl @@ -80,5 +80,3 @@ def struct2tensor_workspace(): patch_args = ["-p0"], ) - - From ac147b1ce7f80b835846d6bd15a486a6cdf70226 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Tue, 14 Apr 2026 03:20:24 +0000 Subject: [PATCH 30/32] Remove sha256 from llvm-raw to avoid checksum conflicts --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index d2108102..927ea533 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -161,7 +161,7 @@ http_archive( http_archive( name = "llvm-raw", - sha256 = "3f986184ee126677dbd77edb16d6b82c057ec869fefd7a9871979941e52e837a", + strip_prefix = "llvm-project-909041e4802c4b9a2223ca04099f35bf1dbbd460", urls = [ "https://storage.googleapis.com/mirror.tensorflow.org/github.com/llvm/llvm-project/archive/909041e4802c4b9a2223ca04099f35bf1dbbd460.tar.gz", From 8836b93a650af910518f64794eab61a4bea58f66 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Tue, 14 Apr 2026 16:56:20 +0000 Subject: [PATCH 31/32] Update Protobuf constraint in setup.py to >=6.0.0,<7.0.0 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8e392bda..d5573c24 100644 --- a/setup.py +++ b/setup.py @@ -79,7 +79,8 @@ def select_constraint(default, nightly=None, git_master=None): # TODO(b/263060885): Remove the explicit numpy dependency once TF works # with numpy>=1.24. 'numpy>=1.22', - 'protobuf>=4.25.2,<7.0.0', + 'protobuf>=6.0.0,<7.0.0', + 'tensorflow>=2.21,<2.22', 'tensorflow-metadata' From a5e080542f6a868f20c746bd34434b681fe08ca8 Mon Sep 17 00:00:00 2001 From: Venkata Sai Madhur Karampudi Date: Tue, 14 Apr 2026 17:31:47 +0000 Subject: [PATCH 32/32] Update requests to 2.33 and pygments to 2.20 to fix vulnerabilities --- environment.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 4e6e7334..033ba113 100644 --- a/environment.yml +++ b/environment.yml @@ -35,8 +35,9 @@ dependencies: - optree==0.19.0 - protobuf==6.31.1 - pyarrow==23.0.1 - - pygments==2.19.2 - - requests==2.32.5 + - pygments==2.20 + - requests==2.33 + - rich==14.3.3 - six==1.17.0 - tensorboard==2.17.1