blob: 24147620e42703448149d27b9872b2469389e800 [file] [log] [blame]
George Gensure447bcd32020-04-06 22:48:33 -07001workspace(name = "pytorch")
2
3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Thuyen Ngoe35bf562021-12-17 13:41:24 -08004load("//tools/rules:workspace.bzl", "new_patched_local_repository")
5
6http_archive(
Sergei Vorobev447f5b52023-02-28 03:51:08 +00007 name = "rules_cc",
Sergei Vorobev447f5b52023-02-28 03:51:08 +00008 patches = [
9 "//:tools/rules_cc/cuda_support.patch",
10 ],
mikey dagitses47d31362023-05-16 14:53:23 +000011 strip_prefix = "rules_cc-40548a2974f1aea06215272d9c2b47a14a24e556",
Sergei Vorobev447f5b52023-02-28 03:51:08 +000012 urls = [
13 "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/40548a2974f1aea06215272d9c2b47a14a24e556.tar.gz",
14 "https://github.com/bazelbuild/rules_cc/archive/40548a2974f1aea06215272d9c2b47a14a24e556.tar.gz",
15 ],
16)
17
18http_archive(
Thuyen Ngoe35bf562021-12-17 13:41:24 -080019 name = "rules_cuda",
Thuyen Ngoe35bf562021-12-17 13:41:24 -080020 strip_prefix = "runtime-b1c7cce21ba4661c17ac72421c6a0e2015e7bef3/third_party/rules_cuda",
21 urls = ["https://github.com/tensorflow/runtime/archive/b1c7cce21ba4661c17ac72421c6a0e2015e7bef3.tar.gz"],
22)
23
24load("@rules_cuda//cuda:dependencies.bzl", "rules_cuda_dependencies")
25
Sergei Vorobev447f5b52023-02-28 03:51:08 +000026rules_cuda_dependencies(with_rules_cc = False)
Thuyen Ngoe35bf562021-12-17 13:41:24 -080027
28load("@rules_cc//cc:repositories.bzl", "rules_cc_toolchains")
29
30rules_cc_toolchains()
George Gensure447bcd32020-04-06 22:48:33 -070031
32http_archive(
33 name = "bazel_skylib",
34 urls = [
35 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
36 ],
37)
38
39http_archive(
mikey dagitses47d31362023-05-16 14:53:23 +000040 name = "pybind11_bazel",
mikey dagitses9bbee242023-05-23 06:20:33 +000041 strip_prefix = "pybind11_bazel-b162c7c88a253e3f6b673df0c621aca27596ce6b",
42 urls = ["https://github.com/pybind/pybind11_bazel/archive/b162c7c88a253e3f6b673df0c621aca27596ce6b.zip"],
George Gensure447bcd32020-04-06 22:48:33 -070043)
44
45new_local_repository(
46 name = "pybind11",
47 build_file = "@pybind11_bazel//:pybind11.BUILD",
48 path = "third_party/pybind11",
49)
50
51http_archive(
52 name = "com_github_glog",
Sergei Vorobev630593d2023-05-12 19:43:56 +000053 build_file_content = """
54licenses(['notice'])
55
56load(':bazel/glog.bzl', 'glog_library')
57# TODO: figure out why enabling gflags leads to SIGSEV on the logging init
58glog_library(with_gflags=0)
mikey dagitses47d31362023-05-16 14:53:23 +000059 """,
60 strip_prefix = "glog-0.4.0",
61 urls = [
62 "https://github.com/google/glog/archive/v0.4.0.tar.gz",
63 ],
George Gensure447bcd32020-04-06 22:48:33 -070064)
65
66http_archive(
67 name = "com_github_gflags_gflags",
68 strip_prefix = "gflags-2.2.2",
69 urls = [
70 "https://github.com/gflags/gflags/archive/v2.2.2.tar.gz",
71 ],
George Gensure447bcd32020-04-06 22:48:33 -070072)
73
Chirag Pandyafd909912024-04-21 15:20:21 +000074http_archive(
75 name = "com_github_opentelemetry-cpp",
76 urls = [
77 "https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.14.2.tar.gz",
78 ],
79)
80
George Gensure447bcd32020-04-06 22:48:33 -070081new_local_repository(
82 name = "gloo",
83 build_file = "//third_party:gloo.BUILD",
84 path = "third_party/gloo",
85)
86
87new_local_repository(
88 name = "onnx",
89 build_file = "//third_party:onnx.BUILD",
90 path = "third_party/onnx",
91)
92
George Gensure447bcd32020-04-06 22:48:33 -070093local_repository(
94 name = "com_google_protobuf",
95 path = "third_party/protobuf",
96)
97
98new_local_repository(
99 name = "eigen",
100 build_file = "//third_party:eigen.BUILD",
101 path = "third_party/eigen",
102)
103
104new_local_repository(
Christian Puhrschf6c60482022-10-18 23:11:47 +0000105 name = "cutlass",
106 build_file = "//third_party:cutlass.BUILD",
107 path = "third_party/cutlass",
108)
109
110new_local_repository(
George Gensure447bcd32020-04-06 22:48:33 -0700111 name = "fbgemm",
Nikita Shulga5a7f8892020-04-13 15:59:48 -0700112 build_file = "//third_party:fbgemm/BUILD.bazel",
George Gensure447bcd32020-04-06 22:48:33 -0700113 path = "third_party/fbgemm",
mikey dagitses47d31362023-05-16 14:53:23 +0000114 repo_mapping = {"@cpuinfo": "@org_pytorch_cpuinfo"},
George Gensure447bcd32020-04-06 22:48:33 -0700115)
116
117new_local_repository(
118 name = "ideep",
119 build_file = "//third_party:ideep.BUILD",
120 path = "third_party/ideep",
121)
122
123new_local_repository(
124 name = "mkl_dnn",
125 build_file = "//third_party:mkl-dnn.BUILD",
126 path = "third_party/ideep/mkl-dnn",
127)
128
129new_local_repository(
Huy Dof0ee21f2022-08-20 06:16:54 +0000130 name = "org_pytorch_cpuinfo",
131 build_file = "//third_party:cpuinfo/BUILD.bazel",
George Gensure447bcd32020-04-06 22:48:33 -0700132 path = "third_party/cpuinfo",
133)
134
135new_local_repository(
136 name = "asmjit",
Nikita Shulga5a7f8892020-04-13 15:59:48 -0700137 build_file = "//third_party:fbgemm/third_party/asmjit.BUILD",
George Gensure447bcd32020-04-06 22:48:33 -0700138 path = "third_party/fbgemm/third_party/asmjit",
139)
140
141new_local_repository(
142 name = "sleef",
143 build_file = "//third_party:sleef.BUILD",
144 path = "third_party/sleef",
145)
146
Michael Suo68895ed2020-04-29 09:03:31 -0700147new_local_repository(
148 name = "fmt",
149 build_file = "//third_party:fmt.BUILD",
150 path = "third_party/fmt",
151)
152
Taylor Robie9d3c35d2022-07-14 18:35:53 -0700153new_local_repository(
154 name = "kineto",
155 build_file = "//third_party:kineto.BUILD",
156 path = "third_party/kineto",
157)
158
Chirag Pandyafd909912024-04-21 15:20:21 +0000159new_local_repository(
160 name = "opentelemetry-cpp",
161 build_file = "//third_party::opentelemetry-cpp.BUILD",
162 path = "third_party/opentelemetry-cpp",
163)
164
Luca Wehrstedt5baa6b62020-05-02 01:22:18 -0700165new_local_repository(
Tristan Rice597922b2024-06-04 19:44:30 +0000166 name = "cpp-httplib",
167 build_file = "//third_party:cpp-httplib.BUILD",
168 path = "third_party/cpp-httplib",
169)
170
171new_local_repository(
Chirag Pandya64f11112024-06-26 21:59:23 +0000172 name = "nlohmann",
173 build_file = "//third_party:nlohmann.BUILD",
174 path = "third_party/nlohmann",
175)
176
177new_local_repository(
Luca Wehrstedt5baa6b62020-05-02 01:22:18 -0700178 name = "tensorpipe",
179 build_file = "//third_party:tensorpipe.BUILD",
180 path = "third_party/tensorpipe",
181)
182
George Gensure447bcd32020-04-06 22:48:33 -0700183http_archive(
184 name = "mkl",
185 build_file = "//third_party:mkl.BUILD",
George Gensure447bcd32020-04-06 22:48:33 -0700186 sha256 = "59154b30dd74561e90d547f9a3af26c75b6f4546210888f09c9d4db8f4bf9d4c",
mikey dagitses47d31362023-05-16 14:53:23 +0000187 strip_prefix = "lib",
George Gensure447bcd32020-04-06 22:48:33 -0700188 urls = [
189 "https://anaconda.org/anaconda/mkl/2020.0/download/linux-64/mkl-2020.0-166.tar.bz2",
190 ],
191)
192
193http_archive(
194 name = "mkl_headers",
195 build_file = "//third_party:mkl_headers.BUILD",
196 sha256 = "2af3494a4bebe5ddccfdc43bacc80fcd78d14c1954b81d2c8e3d73b55527af90",
197 urls = [
198 "https://anaconda.org/anaconda/mkl-include/2020.0/download/linux-64/mkl-include-2020.0-166.tar.bz2",
199 ],
200)
201
202http_archive(
203 name = "rules_python",
mikey dagitses9bbee242023-05-23 06:20:33 +0000204 # TODO Fix bazel linter to support hashes for release tarballs.
205 #
206 # sha256 = "94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f",
207 strip_prefix = "rules_python-0.21.0",
208 url = "https://github.com/bazelbuild/rules_python/releases/download/0.21.0/rules_python-0.21.0.tar.gz",
George Gensure447bcd32020-04-06 22:48:33 -0700209)
210
mikey dagitses9bbee242023-05-23 06:20:33 +0000211load("@rules_python//python:repositories.bzl", "py_repositories")
212
213py_repositories()
214
215load("@rules_python//python:repositories.bzl", "python_register_toolchains")
216
217python_register_toolchains(
Nikita Shulga95a090f2024-04-15 20:39:50 +0000218 name = "python3_10",
219 python_version = "3.10",
mikey dagitses9bbee242023-05-23 06:20:33 +0000220)
221
Nikita Shulga95a090f2024-04-15 20:39:50 +0000222load("@python3_10//:defs.bzl", "interpreter")
mikey dagitses9bbee242023-05-23 06:20:33 +0000223load("@rules_python//python:pip.bzl", "pip_parse")
224
225pip_parse(
226 name = "pip_deps",
227 python_interpreter_target = interpreter,
228 requirements_lock = "//:tools/build/bazel/requirements.txt",
229)
230
231load("@pip_deps//:requirements.bzl", "install_deps")
232
233install_deps()
234
George Gensure447bcd32020-04-06 22:48:33 -0700235load("@pybind11_bazel//:python_configure.bzl", "python_configure")
mikey dagitses47d31362023-05-16 14:53:23 +0000236
237python_configure(
238 name = "local_config_python",
mikey dagitses9bbee242023-05-23 06:20:33 +0000239 python_interpreter_target = interpreter,
mikey dagitses47d31362023-05-16 14:53:23 +0000240)
George Gensure447bcd32020-04-06 22:48:33 -0700241
242load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
243
244protobuf_deps()
245
Thuyen Ngoe35bf562021-12-17 13:41:24 -0800246new_local_repository(
247 name = "cuda",
248 build_file = "@//third_party:cuda.BUILD",
249 path = "/usr/local/cuda",
Sergei Vorobevf922b582021-08-27 09:31:36 -0700250)
251
Thuyen Ngoe35bf562021-12-17 13:41:24 -0800252new_local_repository(
253 name = "cudnn",
254 build_file = "@//third_party:cudnn.BUILD",
Nikita Shulga4ea74302023-12-15 09:47:10 +0000255 path = "/usr/local/cuda",
Sergei Vorobevf922b582021-08-27 09:31:36 -0700256)
Han Qi1bc35712022-01-12 16:27:21 -0800257
Eddie Yanba069512024-01-03 15:41:28 +0000258new_local_repository(
259 name = "cudnn_frontend",
260 build_file = "@//third_party:cudnn_frontend.BUILD",
261 path = "third_party/cudnn_frontend/",
262)
263
Han Qi1bc35712022-01-12 16:27:21 -0800264local_repository(
265 name = "com_github_google_flatbuffers",
266 path = "third_party/flatbuffers",
267)
Sergei Vorobeva0a23c62022-06-06 21:58:47 +0000268
269local_repository(
270 name = "google_benchmark",
271 path = "third_party/benchmark",
272)
273
274local_repository(
275 name = "com_google_googletest",
276 path = "third_party/googletest",
277)
278
279local_repository(
280 name = "pthreadpool",
281 path = "third_party/pthreadpool",
mikey dagitses47d31362023-05-16 14:53:23 +0000282 repo_mapping = {"@com_google_benchmark": "@google_benchmark"},
Sergei Vorobeva0a23c62022-06-06 21:58:47 +0000283)
284
285local_repository(
286 name = "FXdiv",
287 path = "third_party/FXdiv",
mikey dagitses47d31362023-05-16 14:53:23 +0000288 repo_mapping = {"@com_google_benchmark": "@google_benchmark"},
Sergei Vorobeva0a23c62022-06-06 21:58:47 +0000289)
290
291local_repository(
292 name = "XNNPACK",
293 path = "third_party/XNNPACK",
mikey dagitses47d31362023-05-16 14:53:23 +0000294 repo_mapping = {"@com_google_benchmark": "@google_benchmark"},
Sergei Vorobeva0a23c62022-06-06 21:58:47 +0000295)
296
297local_repository(
298 name = "gemmlowp",
299 path = "third_party/gemmlowp/gemmlowp",
300)
301
302### Unused repos start
303
304# `unused` repos are defined to hide bazel files from submodules of submodules.
305# This allows us to run `bazel build //...` and not worry about the submodules madness.
306# Otherwise everything traverses recursively and a lot of submodules of submodules have
307# they own bazel build files.
308
309local_repository(
310 name = "unused_tensorpipe_googletest",
311 path = "third_party/tensorpipe/third_party/googletest",
312)
313
314local_repository(
315 name = "unused_fbgemm",
316 path = "third_party/fbgemm",
317)
318
319local_repository(
cyya405c692023-02-08 17:21:35 +0000320 name = "unused_ftm_bazel",
321 path = "third_party/fmt/support/bazel",
322)
323
324local_repository(
Aaron Enye Shia5304462023-02-25 19:26:08 +0000325 name = "unused_kineto_fmt_bazel",
326 path = "third_party/kineto/libkineto/third_party/fmt/support/bazel",
327)
328
329local_repository(
bcoutinho42d4eca2023-01-28 02:26:28 +0000330 name = "unused_kineto_dynolog_googletest",
331 path = "third_party/kineto/libkineto/third_party/dynolog/third_party/googletest",
332)
333
334local_repository(
335 name = "unused_kineto_dynolog_gflags",
336 path = "third_party/kineto/libkineto/third_party/dynolog/third_party/gflags",
337)
338
339local_repository(
340 name = "unused_kineto_dynolog_glog",
341 path = "third_party/kineto/libkineto/third_party/dynolog/third_party/glog",
342)
343
344local_repository(
Sergei Vorobeva0a23c62022-06-06 21:58:47 +0000345 name = "unused_kineto_googletest",
346 path = "third_party/kineto/libkineto/third_party/googletest",
347)
348
349local_repository(
350 name = "unused_onnx_benchmark",
351 path = "third_party/onnx/third_party/benchmark",
352)
353
Sergei Vorobeva0a23c62022-06-06 21:58:47 +0000354### Unused repos end