Skip to content

Commit 80ecb35

Browse files
Matt-Hurdcopybara-github
authored andcommitted
Remove Tensorflow Dependency from XProf
PiperOrigin-RevId: 751518904
1 parent 4a3f672 commit 80ecb35

File tree

10 files changed

+583
-627
lines changed

10 files changed

+583
-627
lines changed

WORKSPACE

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,52 +177,57 @@ load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
177177
sass_repositories()
178178

179179
http_archive(
180-
name = "org_tensorflow",
180+
name = "xla",
181181
patch_args = ["-p1"],
182182
patches = [
183-
"//third_party:tensorflow.patch",
184-
"//third_party:tensorflow_add_grpc_cares_darwin_arm64_support.patch",
185-
"//third_party:tensorflow_rules_closure.patch",
183+
"//third_party:xla.patch",
186184
],
187-
strip_prefix = "tensorflow-2495c486e8711a0e69e8e232a1e9f25c6d78f152",
185+
sha256 = "722ef9af3e9084c3c6c549162734cc2343434a27323a8430478a04e6aa7df8e9",
186+
strip_prefix = "xla-d1887c9bf970d864ceba39472dc0f3aec2be3612",
188187
urls = [
189-
"https://github.com/tensorflow/tensorflow/archive/2495c486e8711a0e69e8e232a1e9f25c6d78f152.zip",
188+
"https://github.com/openxla/xla/archive/d1887c9bf970d864ceba39472dc0f3aec2be3612.zip",
190189
],
191190
)
192191

193-
load(
194-
"@org_tensorflow//tensorflow/tools/toolchains/python:python_repo.bzl",
195-
"python_repository",
192+
http_archive(
193+
name = "tsl",
194+
sha256 = "8cf1e1285c7b1843a7f5f787465c1ef80304b3400ed837870bc76d74ce04f5af",
195+
strip_prefix = "tsl-d71df2f7612583617d359c36243695097dd63726",
196+
urls = [
197+
"https://github.com/google/tsl/archive/d71df2f7612583617d359c36243695097dd63726.zip",
198+
],
196199
)
197200

201+
load("@xla//tools/toolchains/python:python_repo.bzl", "python_repository")
202+
198203
python_repository(name = "python_version_repo")
199204

200-
# Initialize TensorFlow's external dependencies.
201-
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
205+
# Initialize XLA's external dependencies.
206+
load("@xla//:workspace3.bzl", "xla_workspace3")
202207

203-
tf_workspace3()
208+
xla_workspace3()
204209

205-
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
210+
load("@xla//:workspace2.bzl", "xla_workspace2")
206211

207-
tf_workspace2()
212+
xla_workspace2()
208213

209-
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
214+
load("@xla//:workspace1.bzl", "xla_workspace1")
210215

211-
tf_workspace1()
216+
xla_workspace1()
212217

213-
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
218+
load("@xla//:workspace0.bzl", "xla_workspace0")
214219

215-
tf_workspace0()
220+
xla_workspace0()
216221

217222
load(
218-
"@local_xla//third_party/py:python_wheel.bzl",
223+
"@xla//third_party/py:python_wheel.bzl",
219224
"python_wheel_version_suffix_repository",
220225
)
221226

222227
python_wheel_version_suffix_repository(name = "tf_wheel_version_suffix")
223228

224229
load(
225-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
230+
"@xla//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
226231
"cuda_json_init_repository",
227232
)
228233

@@ -234,7 +239,7 @@ load(
234239
"CUDNN_REDISTRIBUTIONS",
235240
)
236241
load(
237-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
242+
"@xla//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
238243
"cuda_redist_init_repositories",
239244
"cudnn_redist_init_repository",
240245
)
@@ -248,21 +253,21 @@ cudnn_redist_init_repository(
248253
)
249254

250255
load(
251-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
256+
"@xla//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
252257
"cuda_configure",
253258
)
254259

255260
cuda_configure(name = "local_config_cuda")
256261

257262
load(
258-
"@local_xla//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
263+
"@xla//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
259264
"nccl_redist_init_repository",
260265
)
261266

262267
nccl_redist_init_repository()
263268

264269
load(
265-
"@local_xla//third_party/nccl/hermetic:nccl_configure.bzl",
270+
"@xla//third_party/nccl/hermetic:nccl_configure.bzl",
266271
"nccl_configure",
267272
)
268273

plugin/tensorboard_plugin_profile/protobuf/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Description:
22
# Protobufs used by TensorBoard profile plugin.
33

4-
load("@local_xla//xla/tsl/platform:build_config.bzl", xprof_proto_library = "tf_proto_library")
4+
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
5+
load("@xla//xla/tsl/platform:build_config.bzl", xprof_proto_library = "tf_proto_library")
56

67
package(
78
default_visibility = ["//visibility:public"],

third_party/tensorflow.patch

Lines changed: 0 additions & 12 deletions
This file was deleted.

third_party/tensorflow_add_grpc_cares_darwin_arm64_support.patch

Lines changed: 0 additions & 72 deletions
This file was deleted.

third_party/tensorflow_rules_closure.patch

Lines changed: 0 additions & 35 deletions
This file was deleted.

third_party/xla.patch

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
diff --git a/tsl_workspace1.bzl b/tsl_workspace1.bzl
2+
index aead122980..66b8eef868 100644
3+
--- a/tsl_workspace1.bzl
4+
+++ b/tsl_workspace1.bzl
5+
@@ -3,7 +3,7 @@
6+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
7+
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
8+
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
9+
-load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
10+
+load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies")
11+
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
12+
13+
# buildifier: disable=unnamed-macro
14+
@@ -16,7 +16,7 @@ def workspace(with_rules_cc = True):
15+
native.register_toolchains("@local_config_python//:py_toolchain")
16+
rules_pkg_dependencies()
17+
18+
- closure_repositories()
19+
+ rules_closure_dependencies()
20+
21+
boost_deps()
22+
23+
diff --git a/workspace1.bzl b/workspace1.bzl
24+
index b4c4461958..b73cfcd5e1 100644
25+
--- a/workspace1.bzl
26+
+++ b/workspace1.bzl
27+
@@ -3,7 +3,7 @@
28+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
29+
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
30+
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
31+
-load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
32+
+load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies")
33+
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
34+
load("//:tsl_workspace1.bzl", "tsl_workspace1")
35+
36+
@@ -15,7 +15,7 @@ def workspace():
37+
native.register_toolchains("@local_config_python//:py_toolchain")
38+
rules_pkg_dependencies()
39+
40+
- closure_repositories()
41+
+ rules_closure_dependencies()
42+
43+
boost_deps()
44+
45+
diff --git a/tools/toolchains/python/python_repo.bzl b/tools/toolchains/python/python_repo.bzl
46+
index 47fe64d7b7b..a01a1f19c8b 100644
47+
--- a/tools/toolchains/python/python_repo.bzl
48+
+++ b/tools/toolchains/python/python_repo.bzl
49+
@@ -21,6 +21,7 @@ TF_PYTHON_VERSION = "{}"
50+
HERMETIC_PYTHON_VERSION = "{}"
51+
WHEEL_NAME = "{}"
52+
WHEEL_COLLAB = "{}"
53+
+USE_PYWRAP_RULES = "False"
54+
"""
55+
56+
def _python_repository_impl(repository_ctx):
57+
diff --git a/xla/tsl/platform/default/build_config.bzl b/xla/tsl/platform/default/build_config.bzl
58+
index 196af9fb686..9302861c6aa 100644
59+
--- a/xla/tsl/platform/default/build_config.bzl
60+
+++ b/xla/tsl/platform/default/build_config.bzl
61+
@@ -432,7 +432,7 @@ def py_proto_library(
62+
63+
genproto_deps = []
64+
for dep in deps:
65+
- if dep != "@com_google_protobuf//:protobuf_python":
66+
+ if dep != "@com_google_protobuf//:protobuf_python" and not dep.endswith(":protobuf_python"):
67+
genproto_deps.append(dep + "_genproto")
68+
else:
69+
genproto_deps.append("@com_google_protobuf//:well_known_types_py_pb2_genproto")

0 commit comments

Comments
 (0)