forked from openxla/xla
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODULE.bazel
More file actions
312 lines (269 loc) · 10.9 KB
/
Copy pathMODULE.bazel
File metadata and controls
312 lines (269 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
module(name = "xla")
##############################################################
# Bazel module dependencies
# go/keep-sorted start
bazel_dep(name = "abseil-cpp", version = "20260526.0", repo_name = "com_google_absl")
bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "absl_py")
bazel_dep(name = "bazel_features", version = "1.36.0")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "boringssl", version = "0.20250818.0")
bazel_dep(name = "curl", version = "8.12.0.bcr.1")
bazel_dep(name = "google_benchmark", version = "1.8.5", repo_name = "com_google_benchmark")
bazel_dep(name = "googletest", version = "1.17.0", repo_name = "com_google_googletest")
bazel_dep(name = "grpc", version = "1.81.0", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "gutil", version = "20260309.0.bcr.1", repo_name = "com_google_gutil")
bazel_dep(name = "highway", version = "1.3.0", repo_name = "com_google_highway")
bazel_dep(name = "jsoncpp", version = "1.9.6", repo_name = "jsoncpp_git")
bazel_dep(name = "or-tools", version = "9.12", repo_name = "com_google_ortools")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "protobuf", version = "32.1", repo_name = "com_google_protobuf")
bazel_dep(name = "pybind11_abseil", version = "202402.0")
bazel_dep(name = "pybind11_bazel", version = "3.0.0")
bazel_dep(name = "pybind11_protobuf", version = "0.0.0-20250210-f02a2b7")
bazel_dep(name = "re2", version = "2025-11-05.bcr.1", repo_name = "com_googlesource_code_re2")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_java", version = "8.16.1")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_python", version = "1.8.5")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "snappy", version = "1.2.1")
bazel_dep(name = "zlib", version = "1.3.2")
# go/keep-sorted end
# Only for compatibility, not directly used, change repo_name to None after upgrading Bazel to latest 7.x
bazel_dep(name = "eigen", version = "4.0.0-20241125.bcr.3", repo_name = "DO_NOT_USE_eigen")
bazel_dep(name = "grpc-java", version = "1.75.0", repo_name = "DO_NOT_USE_grpc_java")
# TODO: publish an official version of rules_ml_toolchain to BCR
bazel_dep(name = "rules_ml_toolchain")
# To calculate integrity:
# wget -O temp_module_archive.tar.gz <archive URL>
# HASH=$(openssl dgst -sha256 -binary temp_module_archive.tar.gz | openssl base64 -A)
# echo "sha256-${HASH}"
archive_override(
module_name = "rules_ml_toolchain",
integrity = "sha256-axspTL7LmKCLz+WWQUYfcuET2zD6kbRPzEnZgJm1umU=",
strip_prefix = "rules_ml_toolchain-b11745590f513ec55b32e2d126073576fde18c71",
urls = ["https://github.com/google-ml-infra/rules_ml_toolchain/archive/b11745590f513ec55b32e2d126073576fde18c71.tar.gz"],
)
# TODO: Upstream the patch?
single_version_override(
module_name = "grpc",
patch_strip = 1,
patches = [
"//third_party/grpc:grpc.patch",
],
version = "1.81.0",
)
# TODO: Upstream those patch?
single_version_override(
module_name = "abseil-cpp",
version = "20260526.0",
patch_strip = 1,
patches = [
"//third_party/absl:btree.patch",
"//third_party/absl:build_dll.patch",
"//third_party/absl:endian.patch",
],
)
single_version_override(
module_name = "protobuf",
patch_strip = 1,
patches = [
"//third_party/protobuf:protobuf_arena.patch",
"//third_party/protobuf:fix_message_lite_incomplete_type.patch",
# The following patch is needed to fix package loading for `bazel query "deps(//xla/...)"`.
"//third_party/protobuf:fix_python_dist_package.patch",
],
version = "32.1",
)
# Use an unreleased version of googletest
archive_override(
module_name = "googletest",
patch_strip = 1,
patches = [
"//third_party/googletest:0001-Add-ASSERT_OK-EXPECT_OK-ASSERT_OK_AND_ASSIGN-macros.patch",
],
strip_prefix = "googletest-28e9d1f26771c6517c3b4be10254887673c94018",
urls = ["https://github.com/google/googletest/archive/28e9d1f26771c6517c3b4be10254887673c94018.zip"],
)
##############################################################
# C++ dependencies
# TODO: most of them can be Bazel modules, but we need a release strategy for them
third_party = use_extension("//third_party/extensions:third_party.bzl", "third_party_ext")
use_repo(
third_party,
"FXdiv",
"XNNPACK",
"cpuinfo",
"cudnn_frontend_archive",
"cutlass_archive",
"dlpack",
"ducc",
"eigen_archive",
"farmhash_archive",
"farmhash_gpu_archive",
"fmt",
"gloo",
"highwayhash",
"hwloc",
"implib_so",
"llvm-raw",
"llvm_openmp",
"mkl_dnn_acl_compatible",
"ml_dtypes_py",
"mpitrampoline",
"nanobind",
"nccl_archive",
"net_zstd",
"nvshmem",
"nvtx_archive",
"onednn",
"onednn_async",
"org_sqlite",
"pthreadpool",
"raft",
"rapids_logger",
"riegeli",
"rmm",
"robin_map",
"rocm_device_libs",
"shardy",
"slinky",
"spdlog",
"stablehlo",
"transformer_engine",
"triton",
"uv",
)
##############################################################
# Python toolchain and pypi dependencies
single_version_override(
module_name = "rules_python",
patch_strip = 1,
patches = [
"//third_party/py:rules_python_pip_version.patch",
"//third_party/py:rules_python_freethreaded.patch",
"//third_party/py:rules_python_versions.patch",
"//third_party/py:rules_python_scope.patch",
],
version = "1.8.5",
)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.defaults(python_version = "3.11")
python.toolchain(python_version = "3.11")
use_repo(python, "pythons_hub")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.whl_mods(
additive_build_content = """
load("@rules_cc//cc:cc_library.bzl", "cc_library")
cc_library(
name = "numpy_headers_2",
hdrs = glob(["site-packages/numpy/_core/include/**/*.h"]),
strip_include_prefix="site-packages/numpy/_core/include/",
)
cc_library(
name = "numpy_headers_1",
hdrs = glob(["site-packages/numpy/core/include/**/*.h"]),
strip_include_prefix="site-packages/numpy/core/include/",
)
cc_library(
name = "numpy_headers",
deps = [":numpy_headers_2", ":numpy_headers_1"],
)
""",
hub_name = "pypi_mods",
whl_name = "numpy",
)
pip.parse(
extra_hub_aliases = {
"numpy": ["numpy_headers"],
},
hub_name = "xla_pypi",
python_version = "3.11",
requirements_lock = "//:requirements_lock_3_11.txt",
whl_modifications = {
"@pypi_mods//:numpy.json": "numpy",
},
)
use_repo(pip, "pypi_mods", pypi = "xla_pypi")
python_version_ext = use_extension("@rules_ml_toolchain//extensions:python_version.bzl", "python_version_ext")
use_repo(python_version_ext, "python_version_repo")
##############################################################
# Other dependencies via module extensions
### TSL
tsl_extension = use_extension("//third_party/extensions:tsl.bzl", "tsl_extension")
use_repo(tsl_extension, "tsl")
### LLVM
llvm = use_extension("//third_party/extensions:llvm.bzl", "llvm_extension")
use_repo(llvm, "llvm-project")
### pybind
pybind11_internal_configure = use_extension(
"@pybind11_bazel//:internal_configure.bzl",
"internal_configure_extension",
)
use_repo(pybind11_internal_configure, "pybind11")
### RBE
rbe_config = use_extension("//third_party/extensions:rbe_config.bzl", "rbe_config_ext")
use_repo(rbe_config, "ml_build_config_platform")
remote_execution_configure = use_extension("//third_party/extensions:remote_execution_configure.bzl", "remote_execution_configure_ext")
use_repo(remote_execution_configure, "local_config_remote_execution")
### From @rules_ml_toolchain
cuda_configure = use_extension("@rules_ml_toolchain//extensions:cuda_configure.bzl", "cuda_configure_ext")
use_repo(cuda_configure, "local_config_cuda")
nccl_configure = use_extension("@rules_ml_toolchain//extensions:nccl_configure.bzl", "nccl_configure_ext")
use_repo(nccl_configure, "local_config_nccl")
nccl_redist = use_extension("@rules_ml_toolchain//extensions:nccl_redist.bzl", "nccl_redist_ext")
use_repo(nccl_redist, "cuda_nccl")
sycl_configure = use_extension("@rules_ml_toolchain//extensions:sycl_configure.bzl", "sycl_configure_ext")
use_repo(sycl_configure, "level_zero", "local_config_sycl", "oneapi", "zero_loader")
local_sysroot = use_extension("@rules_ml_toolchain//extensions:local_sysroot_configure.bzl", "local_sysroot_ext")
use_repo(local_sysroot, "local_sysroot_config")
cuda_redist_init_ext = use_extension("@rules_ml_toolchain//extensions:cuda_redist_init.bzl", "cuda_redist_init_ext")
use_repo(
cuda_redist_init_ext,
"cuda_cublas",
"cuda_cudart",
"cuda_cudnn",
"cuda_cufft",
"cuda_cupti",
"cuda_curand",
"cuda_cusolver",
"cuda_cusparse",
"cuda_driver",
"cuda_nvcc",
"cuda_nvdisasm",
"cuda_nvjitlink",
"cuda_nvml",
"cuda_nvrtc",
"cuda_nvtx",
"cuda_nvvm",
)
# Override cuda_cccl to use a newer version defined in the cccl_extension.
cccl_extension = use_extension("//third_party/cccl:cccl_extension.bzl", "cccl_extension")
use_repo(cccl_extension, "cuda_cccl")
override_repo(
cuda_redist_init_ext,
cuda_cccl = "cuda_cccl",
)
nvshmem_redist = use_extension("@rules_ml_toolchain//extensions:nvshmem_redist.bzl", "nvshmem_redist_ext")
use_repo(nvshmem_redist, "nvidia_nvshmem")
toolchain_ext = use_extension("@rules_ml_toolchain//extensions:toolchain.bzl", "toolchain_ext")
use_repo(toolchain_ext, "llvm18_linux_x86_64", "llvm_linux_x86_64")
register_toolchains("@rules_ml_toolchain//cc:linux_x86_64_linux_x86_64")
register_toolchains("@rules_ml_toolchain//cc:linux_x86_64_linux_x86_64_cuda")
register_toolchains("@rules_ml_toolchain//cc:linux_x86_64_linux_x86_64_sycl")
register_toolchains("@rules_ml_toolchain//cc:linux_aarch64_linux_aarch64")
register_toolchains("@rules_ml_toolchain//cc:linux_aarch64_linux_aarch64_cuda")
### Other local config repos
local_clang_configure = use_extension("@rules_ml_toolchain//extensions:local_clang_configure.bzl", "local_clang_configure_ext")
use_repo(local_clang_configure, "local_config_clang")
rocm_configure = use_extension("//third_party/extensions:rocm_configure.bzl", "rocm_configure_ext")
use_repo(rocm_configure, "config_rocm_hipcc", "local_config_rocm")
tensorrt_configure = use_extension("//third_party/extensions:tensorrt_configure.bzl", "tensorrt_configure_ext")
use_repo(tensorrt_configure, "local_config_tensorrt")
pjrt_nightly_timestamp = use_extension("//build_tools/pjrt_wheels:nightly.bzl", "nightly_timestamp_repo_bzlmod")
use_repo(pjrt_nightly_timestamp, "nightly_timestamp")
pjrt_rc_number = use_extension("//build_tools/pjrt_wheels:release_candidate.bzl", "rc_number_repo_bzlmod")
use_repo(pjrt_rc_number, "rc_number")
### libdrm (dedicated extension to avoid Bzlmod merging issues)
libdrm_ext = use_extension("//third_party/libdrm:extension.bzl", "libdrm_ext")
use_repo(libdrm_ext, "libdrm")