Skip to content

Commit

Permalink
Move Bazel code from iree/ into build_tools/bazel/. (iree-org#9149)
Browse files Browse the repository at this point in the history
Progress on iree-org#8955. After this, the `iree/` directory will only contain the `test/` subdirectory, with minimal supporting build/test system files.

* Move iree/build_defs.oss.bzl to build_tools/bazel/. 
  Also alphabetized load() statements and added copyright headers to files that were missing them.
* Move config_settings from iree/BUILD.bazel to build_tools/bazel/. 
  Also cleaned up some related Bazel files.
* Set Bazel's default lit.cfg.py from //iree to //iree/test. 
  Compiler/ overrides it as needed. Only iree/test/ relies on the default.
  • Loading branch information
ScottTodd authored May 23, 2022
1 parent 74cc6bc commit e32cc76
Show file tree
Hide file tree
Showing 125 changed files with 161 additions and 178 deletions.
18 changes: 0 additions & 18 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Note that project-wide, bazel repo aliases are used. Various scripts and helpers operate on the
# following prefixes textually, so avoid doing any systematic construction that would break the
# matching.
#
# "@absl_py//absl/"
# "@bazel_skylib//"
# "@com_google_benchmark//"
# "@cpuinfo//"
# "@cuda//"
# "@com_github_dvidelabs_flatcc//"
# "@com_google_googletest//"
# "@llvm-project//"
# "@mlir-hlo//"
# "@iree_pybind11//"
# "@spirv_cross//"
# "@vulkan_headers//"
# "@com_github_yaml_libyaml//"

package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
Expand Down
8 changes: 4 additions & 4 deletions build_tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package(
cc_library(
name = "default_linkopts",
linkopts = select({
"//iree:iree_is_msvc": [],
"//iree:iree_is_android": [
"//build_tools/bazel:iree_is_msvc": [],
"//build_tools/bazel:iree_is_android": [
# Android provides its own pthreads support with no linking required.
],
"//conditions:default": [
Expand All @@ -29,8 +29,8 @@ cc_library(
cc_library(
name = "dl",
linkopts = select({
"//iree:iree_is_msvc": [],
"//iree:iree_is_android": [
"//build_tools/bazel:iree_is_msvc": [],
"//build_tools/bazel:iree_is_android": [
"-ldl",
],
"//conditions:default": [
Expand Down
18 changes: 0 additions & 18 deletions iree/BUILD.bazel → build_tools/bazel/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,12 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Main IREE build file.

package(
default_visibility = ["//visibility:public"],
features = ["layering_check"],
licenses = ["notice"], # Apache 2.0
)

exports_files(["lit.cfg.py"])

# Enables the debug service and other profiling features.
# $ bazel build --define=IREE_DEBUG=1 :some_target
config_setting(
name = "debug",
define_values = {"IREE_DEBUG": "1"},
)

config_setting(
name = "enable_tensorflow",
define_values = {
"iree_tensorflow": "true",
},
)

# Note that the "proper" way to do this is via a query on @bazel_tools,
# but as with so many things bazel, it doesn't work reliably across versions,
# variants, etc. So we just define our own since we also own the config
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions build_tools/bazel/iree_lit_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ load(":lit_test.bzl", "lit_test", "lit_test_suite")

def iree_lit_test(
name,
cfg = "//iree:lit.cfg.py",
cfg = "//iree/test:lit.cfg.py",
tools = None,
env = None,
**kwargs):
Expand Down Expand Up @@ -54,7 +54,7 @@ def iree_lit_test(

def iree_lit_test_suite(
name,
cfg = "//iree:lit.cfg.py",
cfg = "//iree/test:lit.cfg.py",
tools = None,
env = None,
**kwargs):
Expand Down
11 changes: 7 additions & 4 deletions compiler/src/iree/compiler/API/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# NOTE: This must be BUILD.bazel (not BUILD) because otherwise, you can't
# build python packages in this directory (which creates "build" directories)
# on case-inensitive file systems.
load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
# Copyright 2022 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/Common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/Dialect/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@llvm-project//mlir:tblgen.bzl", "td_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob")
load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/Interfaces/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@llvm-project//mlir:tblgen.bzl", "td_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob")
load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/LLVMCPU/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/LLVMGPU/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/SPIRV/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/Sandbox/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/Transforms/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Codegen/Utils/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Utilities for working with IREE MLIR types.

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/ConstEval/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/iree/compiler/Dialect/Flow/IR/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library", "iree_tablegen_doc")
load("@llvm-project//mlir:tblgen.bzl", "td_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob")
load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library", "iree_tablegen_doc")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/Flow/Transforms/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library")

package(
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/HAL/Analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/HAL/Conversion/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/iree/compiler/Dialect/HAL/IR/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library", "iree_tablegen_doc")
load("@llvm-project//mlir:tblgen.bzl", "td_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob")
load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:iree_tablegen.bzl", "iree_gentbl_cc_library", "iree_tablegen_doc")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/HAL/Target/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/HAL/Target/LLVM/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library", "platform_trampoline_deps")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library", "platform_trampoline_deps")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/HAL/Target/ROCM/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/HAL/Target/VMVX/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//iree:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")
load("//build_tools/bazel:build_defs.oss.bzl", "iree_cmake_extra_content", "iree_compiler_cc_library")

package(
default_visibility = ["//visibility:public"],
Expand Down
Loading

0 comments on commit e32cc76

Please sign in to comment.