Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
27 changes: 23 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ 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 = "cb64295ec7308f770b22db6047a1e755b35b7bee" # tf 2.18.1
_TENSORFLOW_ARCHIVE_SHA256 = "5fcca4ec0732e146547fc26f6966cf92236c2f85a9e086b85c83d303e2c38980"


http_archive(
name = "org_tensorflow",
Expand All @@ -70,8 +71,14 @@ http_archive(
"https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT,
],
strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT,
patches = ["//third_party:tensorflow.patch"],
patch_args = ["-p1"],
patch_args = ["-p0"],
patches = [
"//third_party:proto_gen.patch",
],
)
local_repository(
name = "local_config_cuda",
path = "third_party/cuda_stub",
)

load("//third_party:python_configure.bzl", "local_python_configure")
Expand All @@ -83,6 +90,18 @@ local_python_configure(name = "local_execution_config_python")
load("//struct2tensor:workspace.bzl", "struct2tensor_workspace")
struct2tensor_workspace()

# Overriding com_google_absl to apply local patch for GCC 15 compatibility
http_archive(
name = "com_google_absl",
patch_args = ["-p1"],
patches = ["//third_party:absl.patch"],
sha256 = "aa768256d0567f626334fcbe722f564c40b281518fc8423e2708a308e5f983ea",
strip_prefix = "abseil-cpp-fb3621f4f897824c0dbe0615fa94543df6192f30",
urls = [
"https://github.com/abseil/abseil-cpp/archive/fb3621f4f897824c0dbe0615fa94543df6192f30.zip",
],
)

# Load Protobuf dependencies
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
Expand Down
2 changes: 2 additions & 0 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function write_action_env_to_bazelrc() {
write_to_bazelrc "build --action_env $1=\"$2\""
}



function has_tensorflow() {
${PYTHON_BIN_PATH} -c "import tensorflow" > /dev/null
}
Expand Down
8 changes: 5 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ dependencies:
- opt-einsum==3.4.0
- optree==0.19.0
- protobuf==4.25.8
- pyarrow==10.0.1
- pyarrow==15.0.0

- pygments==2.19.2
- requests==2.32.5
- rich==14.3.3
- six==1.17.0
- tensorboard==2.17.1
- tensorboard==2.18.0

- tensorboard-data-server==0.7.2
- tensorflow==2.17.1
- tensorflow==2.18.1
- tensorflow-io-gcs-filesystem==0.37.1
- tensorflow-metadata==1.17.3
- termcolor==3.3.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def select_constraint(default, nightly=None, git_master=None):
'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',
'tensorflow>=2.18,<2.19',
'tensorflow-metadata'
+ select_constraint(
default='>=1.17.0,<1.18.0',
Expand Down
11 changes: 11 additions & 0 deletions third_party/absl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/absl/container/internal/container_memory.h b/absl/container/internal/container_memory.h
--- a/absl/container/internal/container_memory.h
+++ b/absl/container/internal/container_memory.h
@@ -15,5 +15,6 @@
#ifndef ABSL_CONTAINER_INTERNAL_CONTAINER_MEMORY_H_
#define ABSL_CONTAINER_INTERNAL_CONTAINER_MEMORY_H_

#include <cassert>
+#include <cstdint>
#include <cstddef>
#include <cstring>
Empty file added third_party/cuda_stub/WORKSPACE
Empty file.
23 changes: 23 additions & 0 deletions third_party/cuda_stub/cuda/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "cuda_headers",
srcs = [],
visibility = ["//visibility:public"],
)

config_setting(
name = "using_nvcc",
values = {"define": "using_nvcc=true"},
visibility = ["//visibility:public"],
)

config_setting(
name = "using_clang",
values = {"define": "using_clang=true"},
visibility = ["//visibility:public"],
)

cc_library(
name = "cuda",
)
21 changes: 21 additions & 0 deletions third_party/cuda_stub/cuda/build_defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def cuda_library(name, **kwargs):
native.cc_library(name = name, **kwargs)

def if_cuda_exec(if_true, if_false = []):
return if_false

def if_cuda(if_true, if_false = []):
return if_false

def if_cuda_is_configured(if_true, if_false = []):
return if_false

def if_cuda_newer_than(wanted_ver, if_true, if_false = []):
return if_false

def cuda_gpu_architectures():
return []

def cuda_default_copts():
return []

51 changes: 51 additions & 0 deletions third_party/proto_gen.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
--- third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl
+++ third_party/xla/third_party/tsl/tsl/platform/default/build_config.bzl
@@ -4,1 +4,1 @@
-load("@com_google_protobuf//:protobuf.bzl", "proto_gen")
+# Removed load of missing proto_gen
@@ -848,2 +848,45 @@
def tf_cuda_libdevice_path_deps():
return tf_platform_deps("cuda_libdevice_path")
+def proto_gen_disabled(name, srcs = [], outs = [], gen_cc = 0, includes = [], **kwargs):
+ pass
+def proto_gen(name, srcs = [], outs = [], gen_cc = 0, includes = [], **kwargs):
+ if not srcs:
+ native.filegroup(name = name, srcs = kwargs.get("deps", []))
+ return
+ protoc = "@com_google_protobuf//:protoc"
+ pkg = native.package_name()
+ cmd = ""
+ for s in srcs:
+ if type(s) == "string" and s.startswith(":"):
+ loc = "$(location " + s + ")"
+ else:
+ loc = "$(locations " + s + ")"
+ cmd += "for f in " + loc + "; do "
+ cmd += "rel=\"$$f\"; "
+ cmd += "if [[ \"$$f\" == external/org_tensorflow/third_party/xla/* ]]; then rel=\"$${f#external/org_tensorflow/third_party/xla/}\"; repo=\"external/org_tensorflow/third_party/xla\"; "
+ cmd += "elif [[ \"$$f\" == external/org_tensorflow/* ]]; then rel=\"$${f#external/org_tensorflow/}\"; repo=\"external/org_tensorflow\"; "
+ cmd += "elif [[ \"$$f\" == external/local_tsl/* ]]; then rel=\"$${f#external/local_tsl/}\"; repo=\"external/local_tsl\"; "
+ cmd += "elif [[ \"$$f\" == external/local_xla/* ]]; then rel=\"$${f#external/local_xla/}\"; repo=\"external/local_xla\"; "
+ cmd += "else rel=\"$$f\"; repo=\".\"; fi; "
+ cmd += "h_file=\"$${rel%.proto}.pb.h\"; "
+ cmd += "cc_file=\"$${rel%.proto}.pb.cc\"; "
+ cmd += "mkdir -p \"$(RULEDIR)/$$(dirname \"$$rel\")\"; "
+ cmd += "$(location " + protoc + ") -I$$repo -I. -Iexternal/org_tensorflow -Iexternal/local_tsl -Iexternal/local_xla -Iexternal/org_tensorflow/third_party/xla -Iexternal/com_google_protobuf/src --cpp_out=$(RULEDIR) $$rel; "
+ cmd += "if [[ -n \"" + pkg + "\" ]]; then "
+ cmd += " if [[ \"$(RULEDIR)/$$h_file\" != \"$(RULEDIR)/$${h_file#\"" + pkg + "\"/}\" ]]; then mv \"$(RULEDIR)/$$h_file\" \"$(RULEDIR)/$${h_file#\"" + pkg + "\"/}\"; fi; "
+ cmd += " if [[ \"$(RULEDIR)/$$cc_file\" != \"$(RULEDIR)/$${cc_file#\"" + pkg + "\"/}\" ]]; then mv \"$(RULEDIR)/$$cc_file\" \"$(RULEDIR)/$${cc_file#\"" + pkg + "\"/}\"; fi; "
+ cmd += "fi; done; "
+ stripped_outs = []
+ for o in outs:
+ if pkg and o.startswith(pkg + "/"):
+ stripped_outs.append(o[len(pkg)+1:])
+ else:
+ stripped_outs.append(o)
+ native.genrule(
+ name = name,
+ srcs = srcs,
+ outs = stripped_outs,
+ cmd = cmd,
+ tools = [protoc],
+ tags = ["no-sandbox"],
+ )
Loading
Loading