Skip to content

Commit

Permalink
Support tf tf repo macros in external repos. (pytorch#4730)
Browse files Browse the repository at this point in the history
* Support tf tf repo macros in external repos.

* Add patch to tf

* Remove patches to TF and implement macro locally.

TF references local repo rather than using `clean_dep` that would
make it usable externally; prefer local impl rather than patching.

* Remove binary

* Copy bazel directory into docker.

* Remove unused torch bzl library
  • Loading branch information
stgpetrovic authored Mar 8, 2023
1 parent 2a0b9df commit ef45ce2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
1 change: 0 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ http_archive(
],
patch_tool = "patch",
patches = [
"//tf_patches:bazel.diff",
"//tf_patches:cache_urls.diff",
"//tf_patches:cudnn_int8x32.diff",
"//tf_patches:f16_abi_clang.diff",
Expand Down
Empty file added bazel/BUILD
Empty file.
8 changes: 8 additions & 0 deletions bazel/tensorflow.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Macros for working with tensorflow deps."""

def if_with_tpu_support(if_true, if_false = []):
"""Shorthand for select()ing whether to build API support for TPUs when building TensorFlow"""
return select({
"@org_tensorflow//tensorflow:with_tpu_support": if_true,
"//conditions:default": if_false,
})
1 change: 1 addition & 0 deletions docker/experimental/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ COPY tf_patches/ tf_patches/
COPY .bazelrc .
COPY .bazelversion .
COPY WORKSPACE .
COPY bazel/ bazel/
COPY build_torch_xla_libs.sh .

COPY torch_xla/ torch_xla/
Expand Down
13 changes: 0 additions & 13 deletions tf_patches/bazel.diff

This file was deleted.

5 changes: 4 additions & 1 deletion third_party/xla_client/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load(
"@org_tensorflow//tensorflow:tensorflow.bzl",
"if_with_tpu_support",
"tf_cc_shared_object",
)
load(
Expand All @@ -11,6 +10,10 @@ load(
"@org_tensorflow//tensorflow/tsl/platform/default:cuda_build_defs.bzl",
"if_cuda_is_configured",
)
load(
"//bazel:tensorflow.bzl",
"if_with_tpu_support",
)

licenses(["notice"]) # Apache 2.0

Expand Down

0 comments on commit ef45ce2

Please sign in to comment.