blob: e33295b2b724cb6cfebab5b096185298cd9ade3f [file] [log] [blame]
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Configures a separate workspace for IREE's TF integrations.
This is siloed to limit TF complexity from leaking into the main project. It
adds the core IREE project and its submodules as repo aliases based on relative
directory paths."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
IREE_PATH = "../.."
#################################### Skylib ####################################
http_archive(
name = "bazel_skylib",
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
],
)
load("@bazel_skylib//lib:paths.bzl", "paths")
################################################################################
################################## TensorFlow ##################################
maybe(
local_repository,
name = "org_tensorflow",
path = paths.join(IREE_PATH, "third_party/tensorflow"),
)
# Import all of the tensorflow dependencies. Note that we are deliberately
# letting TensorFlow take control of all the dependencies it sets up, whereas
# ours are initialized with `maybe`. Actually tracking this with Bazel is PITA
# and for now this gets TF stuff building. This includes, for instance,
# @llvm-project and @com_google_absl.
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
tf_workspace3()
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")
tf_workspace2()
load("@org_tensorflow//tensorflow:workspace1.bzl", "tf_workspace1")
tf_workspace1()
load("@org_tensorflow//tensorflow:workspace0.bzl", "tf_workspace0")
tf_workspace0()
################################################################################
##################################### IREE #####################################
# We need a shim here to make this use the version of mlir-hlo present in
# TensorFlow. This shim is just alias rules that forward to the TF rule. Note
# that because configure_iree_submodule_deps uses `maybe` and we define this
# first we will use this definition instead of the one there.
maybe(
local_repository,
name = "mlir-hlo",
path = "build_tools/overlay/mlir-hlo",
)
maybe(
local_repository,
name = "iree",
path = IREE_PATH,
)
load("@iree//build_tools/bazel:workspace.bzl", "configure_iree_submodule_deps")
configure_iree_submodule_deps(
iree_path = IREE_PATH,
iree_repo_alias = "@iree",
)
################################################################################