blob: 75505a5fe1778e9041828c8327ff8b5a9a3947f1 [file] [log] [blame]
Geoffrey Martin-Noble15545b42019-11-09 16:40:38 -08001# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Stella Laurenzo1128d502019-10-07 14:34:41 -070015# Workspace file for the IREE project.
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070016# buildozer: disable=positional-args
17
18workspace(name = "iree_core")
Stella Laurenzo196ad742019-10-09 10:33:08 -070019
20load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Scott Todd69655bc2020-11-30 16:28:52 -080021load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
Stella Laurenzo196ad742019-10-09 10:33:08 -070022
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070023###############################################################################
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080024# Bazel rules.
Stella Laurenzo196ad742019-10-09 10:33:08 -070025http_archive(
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080026 name = "rules_cc",
27 sha256 = "cf3b76a90c86c0554c5b10f4b160f05af71d252026b71362c4674e2fb9936cf9",
28 strip_prefix = "rules_cc-01d4a48911d5e7591ecb1c06d3b8af47fe872371",
29 urls = [
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070030 "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
31 "https://github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080032 ],
Stella Laurenzo196ad742019-10-09 10:33:08 -070033)
34
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080035http_archive(
36 name = "rules_python",
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080037 sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070038 url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070039)
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070040
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070041load("@rules_python//python:repositories.bzl", "py_repositories")
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070042
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070043py_repositories()
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080044
45###############################################################################
46
47###############################################################################
48# bazel toolchains rules for remote execution (https://releases.bazel.build/bazel-toolchains.html).
49http_archive(
50 name = "bazel_toolchains",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070051 # Workaround for b/150158570. This patch needs to be updated if the bazel_toolchains version is updated.
52 patches = ["//build_tools/bazel:bazel_toolchains.patch"],
Geoffrey Martin-Noble7d503572020-07-13 16:29:47 -070053 sha256 = "6d54b26a58457f9fca2e54f053402061ffe73e3b909b8f6bf6dedb2a3db093ea",
54 strip_prefix = "bazel-toolchains-3.3.2",
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080055 urls = [
Geoffrey Martin-Noble7d503572020-07-13 16:29:47 -070056 "https://github.com/bazelbuild/bazel-toolchains/releases/download/3.3.2/bazel-toolchains-3.3.2.tar.gz",
57 "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/3.3.2/bazel-toolchains-3.3.2.tar.gz",
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080058 ],
59)
60
Jakob Buchgraberff42ec32020-03-30 15:32:29 -070061load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
phoenix-meadowlarkcc633742020-05-14 16:17:39 -070062
63rbe_autoconfig(
64 name = "rbe_default",
Geoffrey Martin-Noble7d503572020-07-13 16:29:47 -070065 base_container_digest = "sha256:1a8ed713f40267bb51fe17de012fa631a20c52df818ccb317aaed2ee068dfc61",
Phoenix Meadowlark539c0f12020-11-17 09:37:34 -080066 digest = "sha256:d6d895294076b5289e81489f664656211c41656cffe7c448ecb5c6f54f045974",
phoenix-meadowlarkcc633742020-05-14 16:17:39 -070067 registry = "gcr.io",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070068 repository = "iree-oss/rbe-toolchain",
Geoffrey Martin-Noble7d503572020-07-13 16:29:47 -070069 use_checked_in_confs = "Force",
phoenix-meadowlarkcc633742020-05-14 16:17:39 -070070)
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080071
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070072###############################################################################
73
Stella Laurenzoe7d9e882019-10-10 14:32:38 -070074###############################################################################
75# io_bazel_rules_closure
76# This is copied from https://github.com/tensorflow/tensorflow/blob/v2.0.0-alpha0/WORKSPACE.
77# Dependency of:
78# TensorFlow (boilerplate for tf_workspace(), apparently)
79http_archive(
80 name = "io_bazel_rules_closure",
81 sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
82 strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
83 urls = [
84 "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
85 "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
86 ],
87)
88###############################################################################
89
90###############################################################################
91# Skylib
92# Dependency of:
93# TensorFlow
94http_archive(
95 name = "bazel_skylib",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -070096 sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
Stella Laurenzoe7d9e882019-10-10 14:32:38 -070097 urls = [
98 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
99 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
100 ],
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700101)
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700102
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700103load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700104
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700105bazel_skylib_workspace()
106###############################################################################
107
108###############################################################################
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800109# llvm-project
Geoffrey Martin-Noble10b3e1e2020-10-27 10:04:35 -0700110
111maybe(
112 local_repository,
113 name = "llvm_bazel",
114 path = "third_party/llvm-bazel/llvm-bazel",
115)
116
117load("@llvm_bazel//:zlib.bzl", "llvm_zlib_disable")
118
119maybe(
120 llvm_zlib_disable,
121 name = "llvm_zlib",
122)
123
124load("@llvm_bazel//:terminfo.bzl", "llvm_terminfo_disable")
125
126maybe(
127 llvm_terminfo_disable,
128 name = "llvm_terminfo",
129)
130
131load("@llvm_bazel//:configure.bzl", "llvm_configure")
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700132
133maybe(
134 llvm_configure,
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800135 name = "llvm-project",
Geoffrey Martin-Noble10b3e1e2020-10-27 10:04:35 -0700136 src_path = "third_party/llvm-project",
137 src_workspace = "@iree_core//:WORKSPACE",
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800138)
139###############################################################################
140
141###############################################################################
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700142# Bootstrap TensorFlow.
143# Note that we ultimately would like to avoid doing this at the top level like
Scott Todd13aeb4b2020-01-24 15:14:54 -0800144# this but need to unbundle some of the deps from the tensorflow repo first.
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700145# In the mean-time: we're sorry.
146# TODO(laurenzo): Come up with a way to make this optional. Also, see if we can
147# get the TensorFlow tf_repositories() rule to use maybe() so we can provide
148# local overrides safely.
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700149maybe(
150 local_repository,
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700151 name = "org_tensorflow",
152 path = "third_party/tensorflow",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700153)
154
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700155# Import all of the tensorflow dependencies.
156load("@org_tensorflow//tensorflow:workspace.bzl", "tf_repositories")
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700157###############################################################################
158
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700159###############################################################################
160# Autoconfigure native build repo for python.
Marius Brehlerb18c3882020-01-14 17:06:28 -0800161load("//bindings/python/build_tools/python:configure.bzl", "python_configure")
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700162
163# TODO(laurenzo): Scoping to "iree" to avoid conflicts with other things that
164# take an opinion until we can isolate.
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700165maybe(
166 python_configure,
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700167 name = "iree_native_python",
168)
169###############################################################################
170
Scott Todd0d416202019-11-12 16:22:05 -0800171###############################################################################
172# Find and configure the Vulkan SDK, if installed.
173load("//build_tools/third_party/vulkan_sdk:repo.bzl", "vulkan_sdk_setup")
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700174
175maybe(
176 vulkan_sdk_setup,
Scott Todd0d416202019-11-12 16:22:05 -0800177 name = "vulkan_sdk",
178)
179###############################################################################
180
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700181maybe(
182 local_repository,
183 name = "com_google_absl",
184 path = "third_party/abseil-cpp",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700185)
186
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700187maybe(
188 local_repository,
189 name = "com_google_ruy",
190 path = "third_party/ruy",
Geoffrey Martin-Noble16046472020-03-27 14:03:37 -0700191)
192
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700193maybe(
194 local_repository,
195 name = "com_google_googletest",
196 path = "third_party/googletest",
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700197)
198
Ben Vanik71527c22020-07-17 13:09:57 -0700199maybe(
200 new_local_repository,
201 name = "com_github_dvidelabs_flatcc",
202 build_file = "build_tools/third_party/flatcc/BUILD.overlay",
203 path = "third_party/flatcc",
204)
205
Scott Todd6152a702020-03-23 16:47:25 -0700206# TODO(scotttodd): TensorFlow is squatting on the vulkan_headers repo name, so
207# we use a temporary one until resolved. Theirs is set to an outdated version.
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700208maybe(
209 new_local_repository,
Scott Todd6152a702020-03-23 16:47:25 -0700210 name = "iree_vulkan_headers",
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700211 build_file = "build_tools/third_party/vulkan_headers/BUILD.overlay",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700212 path = "third_party/vulkan_headers",
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700213)
214
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700215maybe(
216 new_local_repository,
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700217 name = "vulkan_memory_allocator",
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700218 build_file = "build_tools/third_party/vulkan_memory_allocator/BUILD.overlay",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700219 path = "third_party/vulkan_memory_allocator",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700220)
Stella Laurenzo5e8573b2019-10-10 15:31:51 -0700221
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700222maybe(
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700223 local_repository,
Stella Laurenzo5e8573b2019-10-10 15:31:51 -0700224 name = "spirv_headers",
225 path = "third_party/spirv_headers",
226)
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700227
228# TODO(laurenzo): TensorFlow is squatting on the pybind11 repo name, so
229# we use a temporary one until resolved. Theirs pulls in a bunch of stuff.
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700230maybe(
231 new_local_repository,
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700232 name = "iree_pybind11",
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700233 build_file = "build_tools/third_party/pybind11/BUILD.overlay",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700234 path = "third_party/pybind11",
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700235)
Stella Laurenzo0da4af52019-10-23 12:54:53 -0700236
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700237maybe(
238 local_repository,
Stella Laurenzo0da4af52019-10-23 12:54:53 -0700239 name = "com_google_benchmark",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700240 path = "third_party/benchmark",
Scott Toddf7003552019-11-11 09:14:19 -0800241)
242
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700243maybe(
244 new_local_repository,
245 name = "sdl2",
246 build_file = "build_tools/third_party/sdl2/BUILD.overlay",
247 path = "third_party/sdl2",
248)
249
250maybe(
251 new_local_repository,
Scott Toddf7003552019-11-11 09:14:19 -0800252 name = "sdl2_config",
Scott Toddf7003552019-11-11 09:14:19 -0800253 build_file_content = """
254package(default_visibility = ["//visibility:public"])
255cc_library(name = "headers", srcs = glob(["*.h"]))
256""",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700257 path = "build_tools/third_party/sdl2",
Scott Toddf7003552019-11-11 09:14:19 -0800258)
Scott Todd0d416202019-11-12 16:22:05 -0800259
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700260maybe(
261 new_local_repository,
Scott Todd0d416202019-11-12 16:22:05 -0800262 name = "dear_imgui",
Scott Todd0d416202019-11-12 16:22:05 -0800263 build_file = "build_tools/third_party/dear_imgui/BUILD.overlay",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700264 path = "third_party/dear_imgui",
Scott Todd0d416202019-11-12 16:22:05 -0800265)
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800266
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700267maybe(
268 new_local_repository,
Scott Toddd6248152020-02-07 09:57:05 -0800269 name = "renderdoc_api",
Scott Toddd6248152020-02-07 09:57:05 -0800270 build_file = "build_tools/third_party/renderdoc_api/BUILD.overlay",
Geoffrey Martin-Noble645a88b2020-07-13 09:40:59 -0700271 path = "third_party/renderdoc_api",
Scott Toddd6248152020-02-07 09:57:05 -0800272)
273
Ben Vanikda79d9b2020-10-01 09:52:54 -0700274maybe(
275 new_local_repository,
276 name = "com_github_pytorch_cpuinfo",
277 build_file = "build_tools/third_party/cpuinfo/BUILD.overlay",
278 path = "third_party/cpuinfo",
279)
280
NatashaKnk0d7e00f2020-11-10 19:16:31 -0800281maybe(
282 new_local_repository,
283 name = "pffft",
284 build_file = "build_tools/third_party/pffft/BUILD.overlay",
285 path = "third_party/pffft",
286)
287
Thomas6456bfb2020-11-18 15:05:13 -0800288maybe(
289 new_local_repository,
290 name = "half",
291 build_file = "build_tools/third_party/half/BUILD.overlay",
292 path = "third_party/half",
293)
294
Phoenix Meadowlarkfef7eda2020-11-03 16:06:27 -0800295GOOGLE_RESEARCH_COMMIT = "a5213e2c92c3e87849fe417ba42786d0324e7c75"
Phoenix Meadowlark4e0dfff2020-10-28 10:47:08 -0700296
297http_archive(
298 name = "kws_streaming",
299 build_file = "@//:build_tools/third_party/kws_streaming/BUILD.overlay",
Phoenix Meadowlarkfef7eda2020-11-03 16:06:27 -0800300 sha256 = "1e3260536491840a011ee12cae4f55878ed6a0dd8fdf7d15cd768836d55cb89c",
Phoenix Meadowlark4e0dfff2020-10-28 10:47:08 -0700301 strip_prefix = "google-research-{}/kws_streaming".format(GOOGLE_RESEARCH_COMMIT),
302 url = "https://github.com/google-research/google-research/archive/{}.tar.gz".format(GOOGLE_RESEARCH_COMMIT),
303)
304
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800305# Bootstrap TensorFlow deps last so that ours can take precedence.
306tf_repositories()