Skip to content

Commit cdb664c

Browse files
Hermetic CUDA was moved from XLA to rules_ml_toolchain open sourced repository.
PiperOrigin-RevId: 792849266
1 parent b74a866 commit cdb664c

File tree

1 file changed

+59
-28
lines changed

1 file changed

+59
-28
lines changed

WORKSPACE

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

55
http_archive(
66
name = "icu",
7-
strip_prefix = "icu-release-64-2",
7+
build_file = "//third_party/icu:BUILD.bzl",
8+
patch_args = ["-p1"],
9+
patches = ["//third_party/icu:udata.patch"],
810
sha256 = "dfc62618aa4bd3ca14a3df548cd65fe393155edd213e49c39f3a30ccd618fc27",
11+
strip_prefix = "icu-release-64-2",
912
urls = [
1013
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/unicode-org/icu/archive/release-64-2.zip",
1114
"https://github.com/unicode-org/icu/archive/release-64-2.zip",
1215
],
13-
build_file = "//third_party/icu:BUILD.bzl",
14-
patches = ["//third_party/icu:udata.patch"],
15-
patch_args = ["-p1"],
1616
)
1717

1818
http_archive(
1919
name = "com_google_sentencepiece",
20-
strip_prefix = "sentencepiece-0.1.96",
20+
build_file = "//third_party/sentencepiece:BUILD",
21+
patch_args = ["-p1"],
22+
patches = ["//third_party/sentencepiece:sp.patch"],
2123
sha256 = "8409b0126ebd62b256c685d5757150cf7fcb2b92a2f2b98efb3f38fc36719754",
24+
strip_prefix = "sentencepiece-0.1.96",
2225
urls = [
23-
"https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip"
26+
"https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip",
2427
],
25-
build_file = "//third_party/sentencepiece:BUILD",
26-
patches = ["//third_party/sentencepiece:sp.patch"],
27-
patch_args = ["-p1"],
2828
)
2929

3030
http_archive(
3131
name = "cppitertools",
32-
urls = ["https://github.com/ryanhaining/cppitertools/archive/refs/tags/v2.0.zip"],
3332
sha256 = "e56741b108d6baced98c4ccd83fd0d5a545937f2845978799c28d0312c0dee3d",
3433
strip_prefix = "cppitertools-2.0",
34+
urls = ["https://github.com/ryanhaining/cppitertools/archive/refs/tags/v2.0.zip"],
3535
)
3636

3737
http_archive(
@@ -56,10 +56,10 @@ http_archive(
5656

5757
http_archive(
5858
name = "org_tensorflow",
59-
strip_prefix = "tensorflow-40998f44c0c500ce0f6e3b1658dfbc54f838a82a",
6059
sha256 = "5a5bc4599964c71277dcac0d687435291e5810d2ac2f6283cc96736febf73aaf",
60+
strip_prefix = "tensorflow-40998f44c0c500ce0f6e3b1658dfbc54f838a82a",
6161
urls = [
62-
"https://github.com/tensorflow/tensorflow/archive/40998f44c0c500ce0f6e3b1658dfbc54f838a82a.zip"
62+
"https://github.com/tensorflow/tensorflow/archive/40998f44c0c500ce0f6e3b1658dfbc54f838a82a.zip",
6363
],
6464
)
6565

@@ -74,13 +74,13 @@ http_archive(
7474

7575
http_archive(
7676
name = "pybind11",
77+
build_file = "//third_party/pybind11:BUILD.bzl",
78+
sha256 = "efc901aa0aab439a3fea6efeaf930b5a349fb06394bf845c64ce15a9cf8f0240",
79+
strip_prefix = "pybind11-2.13.4",
7780
urls = [
7881
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/pybind/pybind11/archive/v2.13.4.tar.gz",
7982
"https://github.com/pybind/pybind11/archive/v2.13.4.tar.gz",
8083
],
81-
sha256 = "efc901aa0aab439a3fea6efeaf930b5a349fb06394bf845c64ce15a9cf8f0240",
82-
strip_prefix = "pybind11-2.13.4",
83-
build_file = "//third_party/pybind11:BUILD.bzl",
8484
)
8585

8686
http_archive(
@@ -90,6 +90,23 @@ http_archive(
9090
url = "https://github.com/bazelbuild/rules_shell/releases/download/v0.4.1/rules_shell-v0.4.1.tar.gz",
9191
)
9292

93+
# Initialize Rules ML Toolchain
94+
http_archive(
95+
name = "rules_ml_toolchain",
96+
sha256 = "874a69ad71ed76ca425fb2ce4906cb38da0f624b7fd678807858e010f4f3eff3",
97+
strip_prefix = "rules_ml_toolchain-extra-download-clang-fix",
98+
urls = [
99+
"https://github.com/google-ml-infra/rules_ml_toolchain/archive/refs/heads/extra-download-clang-fix.tar.gz",
100+
],
101+
)
102+
103+
load(
104+
"@rules_ml_toolchain//cc/deps:cc_toolchain_deps.bzl",
105+
"cc_toolchain_deps",
106+
)
107+
108+
cc_toolchain_deps()
109+
93110
# Initialize hermetic Python
94111
load("@org_tensorflow//third_party/py:python_init_rules.bzl", "python_init_rules")
95112

@@ -99,27 +116,31 @@ load("//tensorflow_text:tftext.bzl", "py_deps_profile")
99116

100117
py_deps_profile(
101118
name = "release_or_nightly",
102-
requirements_in = "//oss_scripts/pip_package:requirements.in",
103-
pip_repo_name = "pypi",
104119
deps_map = {
105-
"tensorflow": ["tf-nightly", "tf_header_lib", "libtensorflow_framework"],
106-
"tf-keras": ["tf-keras-nightly"]
120+
"tensorflow": [
121+
"tf-nightly",
122+
"tf_header_lib",
123+
"libtensorflow_framework",
124+
],
125+
"tf-keras": ["tf-keras-nightly"],
107126
},
127+
pip_repo_name = "pypi",
128+
requirements_in = "//oss_scripts/pip_package:requirements.in",
108129
switch = {
109-
"IS_NIGHTLY": "nightly"
110-
}
130+
"IS_NIGHTLY": "nightly",
131+
},
111132
)
112133

113134
load("@org_tensorflow//third_party/py:python_init_repositories.bzl", "python_init_repositories")
114135

115136
python_init_repositories(
137+
default_python_version = "system",
116138
requirements = {
117139
"3.9": "//oss_scripts/pip_package:requirements_lock_3_9.txt",
118140
"3.10": "//oss_scripts/pip_package:requirements_lock_3_10.txt",
119141
"3.11": "//oss_scripts/pip_package:requirements_lock_3_11.txt",
120142
"3.12": "//oss_scripts/pip_package:requirements_lock_3_12.txt",
121143
},
122-
default_python_version = "system",
123144
)
124145

125146
load("@org_tensorflow//third_party/py:python_init_toolchains.bzl", "python_init_toolchains")
@@ -136,18 +157,28 @@ install_deps()
136157

137158
# Initialize TensorFlow dependencies.
138159
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
160+
139161
tf_workspace3()
162+
140163
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
164+
141165
tf_workspace2()
166+
142167
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
168+
143169
tf_workspace1()
170+
144171
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
172+
145173
tf_workspace0()
146174

147175
# Set up Android.
148176
load("@org_tensorflow//third_party/android:android_configure.bzl", "android_configure")
149-
android_configure(name="local_config_android")
177+
178+
android_configure(name = "local_config_android")
179+
150180
load("@local_config_android//:android.bzl", "android_workspace")
181+
151182
android_workspace()
152183

153184
load(
@@ -158,7 +189,7 @@ load(
158189
python_wheel_version_suffix_repository(name = "tf_wheel_version_suffix")
159190

160191
load(
161-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_json_init_repository.bzl",
192+
"@rules_ml_toolchain//gpu/cuda:cuda_json_init_repository.bzl",
162193
"cuda_json_init_repository",
163194
)
164195

@@ -170,7 +201,7 @@ load(
170201
"CUDNN_REDISTRIBUTIONS",
171202
)
172203
load(
173-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_redist_init_repositories.bzl",
204+
"@rules_ml_toolchain//gpu/cuda:cuda_redist_init_repositories.bzl",
174205
"cuda_redist_init_repositories",
175206
"cudnn_redist_init_repository",
176207
)
@@ -184,21 +215,21 @@ cudnn_redist_init_repository(
184215
)
185216

186217
load(
187-
"@local_xla//third_party/gpus/cuda/hermetic:cuda_configure.bzl",
218+
"@rules_ml_toolchain//gpu/cuda:cuda_configure.bzl",
188219
"cuda_configure",
189220
)
190221

191222
cuda_configure(name = "local_config_cuda")
192223

193224
load(
194-
"@local_xla//third_party/nccl/hermetic:nccl_redist_init_repository.bzl",
225+
"@rules_ml_toolchain//gpu/nccl:nccl_redist_init_repository.bzl",
195226
"nccl_redist_init_repository",
196227
)
197228

198229
nccl_redist_init_repository()
199230

200231
load(
201-
"@local_xla//third_party/nccl/hermetic:nccl_configure.bzl",
232+
"@rules_ml_toolchain//gpu/nccl:nccl_configure.bzl",
202233
"nccl_configure",
203234
)
204235

0 commit comments

Comments
 (0)