blob: b3a9fa14d39b192d6705c6d8dd4679d8062133ff [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")
Stella Laurenzoe7d9e882019-10-10 14:32:38 -070021load(":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 = [
30 "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",
32 ],
Stella Laurenzo196ad742019-10-09 10:33:08 -070033)
34
Geoffrey Martin-Noble86029972020-01-28 18:27:03 -080035http_archive(
36 name = "rules_python",
37 url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
38 sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070039)
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070040load("@rules_python//python:repositories.bzl", "py_repositories")
41py_repositories()
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080042
43###############################################################################
44
45###############################################################################
46# bazel toolchains rules for remote execution (https://releases.bazel.build/bazel-toolchains.html).
47http_archive(
48 name = "bazel_toolchains",
Scott Todd4da193c2020-02-25 14:39:50 -080049 sha256 = "4d348abfaddbcee0c077fc51bb1177065c3663191588ab3d958f027cbfe1818b",
50 strip_prefix = "bazel-toolchains-2.1.0",
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080051 urls = [
Scott Todd4da193c2020-02-25 14:39:50 -080052 "https://github.com/bazelbuild/bazel-toolchains/releases/download/2.1.0/bazel-toolchains-2.1.0.tar.gz",
53 "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/2.1.0.tar.gz",
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080054 ],
55)
56
Scott Toddb5331d22020-02-25 17:22:00 -080057# Disable RBE until compatibility issues with the experimental_repo_remote_exec
58# flag are fixed.
59# load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
60# rbe_autoconfig(name = "rbe_default")
Geoffrey Martin-Noble2c8b5a42019-12-11 11:30:39 -080061
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -070062###############################################################################
63
Stella Laurenzoe7d9e882019-10-10 14:32:38 -070064###############################################################################
65# io_bazel_rules_closure
66# This is copied from https://github.com/tensorflow/tensorflow/blob/v2.0.0-alpha0/WORKSPACE.
67# Dependency of:
68# TensorFlow (boilerplate for tf_workspace(), apparently)
69http_archive(
70 name = "io_bazel_rules_closure",
71 sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
72 strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
73 urls = [
74 "https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
75 "https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
76 ],
77)
78###############################################################################
79
80###############################################################################
81# Skylib
82# Dependency of:
83# TensorFlow
84http_archive(
85 name = "bazel_skylib",
86 urls = [
87 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
88 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
89 ],
90 sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
91)
92load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
93bazel_skylib_workspace()
94###############################################################################
95
96###############################################################################
Stella Laurenzo15d8ae42020-01-03 13:52:12 -080097# llvm-project
98load("@iree_core//build_tools/bazel/third_party_import/llvm-project:configure.bzl", "llvm_configure")
99maybe(llvm_configure,
100 name = "llvm-project",
101 workspace = "@iree_core//:WORKSPACE",
102 path = "third_party/llvm-project",
103)
104###############################################################################
105
106###############################################################################
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700107# Bootstrap TensorFlow.
108# Note that we ultimately would like to avoid doing this at the top level like
Scott Todd13aeb4b2020-01-24 15:14:54 -0800109# this but need to unbundle some of the deps from the tensorflow repo first.
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700110# In the mean-time: we're sorry.
111# TODO(laurenzo): Come up with a way to make this optional. Also, see if we can
112# get the TensorFlow tf_repositories() rule to use maybe() so we can provide
113# local overrides safely.
114maybe(local_repository,
115 name = "org_tensorflow",
116 path = "third_party/tensorflow",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700117)
118
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700119# Import all of the tensorflow dependencies.
120load("@org_tensorflow//tensorflow:workspace.bzl", "tf_repositories")
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700121###############################################################################
122
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700123###############################################################################
124# Autoconfigure native build repo for python.
Marius Brehlerb18c3882020-01-14 17:06:28 -0800125load("//bindings/python/build_tools/python:configure.bzl", "python_configure")
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700126
127# TODO(laurenzo): Scoping to "iree" to avoid conflicts with other things that
128# take an opinion until we can isolate.
129maybe(python_configure,
130 name = "iree_native_python",
131)
132###############################################################################
133
Scott Todd0d416202019-11-12 16:22:05 -0800134###############################################################################
135# Find and configure the Vulkan SDK, if installed.
136load("//build_tools/third_party/vulkan_sdk:repo.bzl", "vulkan_sdk_setup")
137maybe(vulkan_sdk_setup,
138 name = "vulkan_sdk",
139)
140###############################################################################
141
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700142maybe(local_repository,
143 name = "com_google_absl",
144 path = "third_party/abseil-cpp",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700145)
146
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700147maybe(local_repository,
148 name = "com_google_googletest",
149 path = "third_party/googletest",
150)
151
152# Note that TensorFlow provides this as "flatbuffers" which is wrong.
153# It is only used for TFLite and may cause ODR issues if not fixed.
154maybe(local_repository,
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700155 name = "com_github_google_flatbuffers",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700156 path = "third_party/flatbuffers",
157)
158
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700159maybe(new_local_repository,
Stella Laurenzo196ad742019-10-09 10:33:08 -0700160 name = "com_google_tracing_framework_cpp",
161 path = "third_party/google_tracing_framework/bindings/cpp",
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700162 build_file = "build_tools/third_party/google_tracing_framework_cpp/BUILD.overlay",
163)
164
Scott Todd6152a702020-03-23 16:47:25 -0700165# TODO(scotttodd): TensorFlow is squatting on the vulkan_headers repo name, so
166# we use a temporary one until resolved. Theirs is set to an outdated version.
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700167maybe(new_local_repository,
Scott Todd6152a702020-03-23 16:47:25 -0700168 name = "iree_vulkan_headers",
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700169 path = "third_party/vulkan_headers",
170 build_file = "build_tools/third_party/vulkan_headers/BUILD.overlay",
171)
172
Stella Laurenzoe7d9e882019-10-10 14:32:38 -0700173maybe(new_local_repository,
Stella Laurenzo7f6af202019-10-09 16:33:24 -0700174 name = "vulkan_memory_allocator",
175 path = "third_party/vulkan_memory_allocator",
176 build_file = "build_tools/third_party/vulkan_memory_allocator/BUILD.overlay",
Stella Laurenzo196ad742019-10-09 10:33:08 -0700177)
Stella Laurenzo5e8573b2019-10-10 15:31:51 -0700178
179maybe(new_local_repository,
180 name = "glslang",
181 path = "third_party/glslang",
182 build_file = "build_tools/third_party/glslang/BUILD.overlay",
183)
184
185maybe(local_repository,
186 name = "spirv_tools",
187 path = "third_party/spirv_tools",
188)
189
190maybe(local_repository,
191 name = "spirv_headers",
192 path = "third_party/spirv_headers",
193)
Stella Laurenzoc4a6edf2019-10-17 16:59:08 -0700194
195# TODO(laurenzo): TensorFlow is squatting on the pybind11 repo name, so
196# we use a temporary one until resolved. Theirs pulls in a bunch of stuff.
197maybe(new_local_repository,
198 name = "iree_pybind11",
199 path = "third_party/pybind11",
200 build_file = "build_tools/third_party/pybind11/BUILD.overlay",
201)
Stella Laurenzo0da4af52019-10-23 12:54:53 -0700202
203maybe(local_repository,
204 name = "com_google_benchmark",
205 path = "third_party/benchmark")
Scott Toddf7003552019-11-11 09:14:19 -0800206
207maybe(new_local_repository,
208 name = "sdl2",
209 path = "third_party/sdl2",
210 build_file = "build_tools/third_party/sdl2/BUILD.overlay",
211)
212
213maybe(new_local_repository,
214 name = "sdl2_config",
215 path = "build_tools/third_party/sdl2",
216 build_file_content = """
217package(default_visibility = ["//visibility:public"])
218cc_library(name = "headers", srcs = glob(["*.h"]))
219""",
220)
Scott Todd0d416202019-11-12 16:22:05 -0800221
222maybe(new_local_repository,
223 name = "dear_imgui",
224 path = "third_party/dear_imgui",
225 build_file = "build_tools/third_party/dear_imgui/BUILD.overlay",
226)
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800227
Scott Toddd6248152020-02-07 09:57:05 -0800228maybe(new_local_repository,
229 name = "renderdoc_api",
230 path = "third_party/renderdoc_api",
231 build_file = "build_tools/third_party/renderdoc_api/BUILD.overlay",
232)
233
Stella Laurenzo15d8ae42020-01-03 13:52:12 -0800234# Bootstrap TensorFlow deps last so that ours can take precedence.
235tf_repositories()