Skip to content

Commit

Permalink
Merge pull request iree-org#2504 from ScottTodd:main-to-google
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 321003958
  • Loading branch information
iree-copybara-bot committed Jul 13, 2020
2 parents 5521b89 + 6706f3d commit 0c0e2ba
Show file tree
Hide file tree
Showing 54 changed files with 981 additions and 571 deletions.
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ test --define open_source_build=true
# either clang or gcc and are curated based on need.
###############################################################################

# Treat warnings in-workspace as errors.
build:generic_clang --per_file_copt=-external/.*-Werror
# ...and silence them outside of the workspace.
build:generic_clang --per_file_copt=external/.*@-w

# Disable warnings we don't care about.
build:generic_clang --copt=-Wno-unused-local-typedef
build:generic_clang --copt=-Wno-unused-private-field
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/google_to_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright 2020 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.

# Creates a PR to merge the `google` branch into the `main` branch.

name: google -> main

on:
schedule:
# Every 6 hours at 45 minutes past the hour (to be a bit behind the TF submodule update)
# 00:45, 06:45, 12:45, 18:45 UTC (04:45, 10:45, 16:45, 22:45 PST)
- cron: '45 */6 * * *'

jobs:
google_to_main:
# Don't run this in everyone's forks.
if: github.repository == 'google/iree'
runs-on: ubuntu-18.04
steps:
- name: Checking out repository
uses: actions/checkout@v2
with:
ref: "google"
# We have to explicitly fetch the main branch as well
- name: Fetching Base Branch
run: git fetch --no-tags --prune --depth=1 origin main
- name: Checking for a diff
run: |
echo "::set-env name=has_diff::false"
git diff main --exit-code || echo "::set-env name=has_diff::true"
- name: Calculating PR body
if: env.has_diff == 'true'
run: |
echo "::set-env name=pr_body::$(git log main.. --decorate=no --pretty='format:* %h %<(80,trunc)%s')"
- name: Initializing submodules
if: env.has_diff == 'true'
run: ./scripts/git/submodule_versions.py init
- name: Creating Pull Request
if: env.has_diff == 'true'
uses: peter-evans/create-pull-request@v2
with:
# Personal token is required to trigger additional automation (e.g. presubmits).
token: ${{ secrets.GITHUB_WRITE_ACCESS_TOKEN }}
commit-message: "Merge google -> main"
title: "Merge google -> main"
body: "${{ env.pr_body }}"
committer: "Integrate Action <[email protected]>"
# TODO(gcmn): Figure out a way to assign this to someone dynamically.
reviewers: gmngeoffrey
branch: "google-to-main"
base: "main"
14 changes: 14 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,17 @@ jobs:
uses: ibiqlik/action-yamllint@v1
with:
strict: true

buildifier:
runs-on: ubuntu-18.04
steps:
- name: Checking out repository
uses: actions/checkout@v2
- name: Running Buildifier
# TODO(gcmn): Look into only running on changed files.
uses: thompsonja/[email protected]
with:
excludes: "*/third_party/*"
# For compatibility with Google's internal source repository, we still
# use this.
warnings: "-native-cc"
9 changes: 7 additions & 2 deletions .github/workflows/update_tf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ jobs:
run: ./scripts/git/submodule_versions.py init
- name: Updating submodules
run: ./scripts/git/update_tf_llvm_submodules.py --llvm_commit=KEEP --update_build_files=true
- name: Calculating TF SHA
run: echo "::set-env name=TF_SHA::$(git submodule status third_party/tensorflow | cut -c -12)"
- name: Creating Pull Request
uses: peter-evans/create-pull-request@v2
with:
# Personal token is required to trigger additional automation (e.g. presubmits).
token: ${{ secrets.GITHUB_WRITE_ACCESS_TOKEN }}
commit-message: "Update TF submodule and LLVM BUILD files"
title: "Update TF submodule and LLVM BUILD files"
body: "Automated submodule bump from .github/workflows/update_tf.yml"
title: "Integrate TF at https://github.com/tensorflow/tensorflow/commit/${{ env.TF_SHA }}"
body: |
"Updates TF to current HEAD and copies latest version of LLVM BUILD files.
Automated submodule bump from .github/workflows/update_tf.yml"
committer: "Submodule Update Action <[email protected]>"
# TODO(gcmn): Figure out a way to assign this to someone dynamically.
reviewers: gmngeoffrey
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@ features and quarterly plans. Please check out for updated information.

## Build Status

CI System | Platform | Build System | Component | Status
:-------: | :------: | :----------: | :-------------: | :----:
Kokoro | Linux | Bazel | Core | [![kokoro-status-linux-bazel-core](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_result.html)
Kokoro | Linux | Bazel | Bindings | [![kokoro-status-linux-bazel-bindings](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_result.html)
Kokoro | Linux | Bazel | Integrations | [![kokoro-status-linux-bazel-integrations](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_result.html)
Kokoro | Linux | CMake | Core + Bindings | [![kokoro-status-linux-cmake](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_result.html)
CI System | Platform | Build System | Component | Status
:-------: | :------: | :----------: | :------------------: | :----:
Kokoro | Linux | Bazel | Core | [![kokoro-status-linux-bazel-core](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/core/main_result.html)
Kokoro | Linux | Bazel | Bindings | [![kokoro-status-linux-bazel-bindings](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/bindings/main_result.html)
Kokoro | Linux | Bazel | Integrations | [![kokoro-status-linux-bazel-integrations](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/bazel/integrations/main_result.html)
Kokoro | Linux | CMake | Core + Bindings | [![kokoro-status-linux-cmake](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/linux/cmake/main_result.html)
Kokoro | Android | CMake | Runtime (build only) | [![kokoro-status-android-cmake](https://storage.googleapis.com/iree-oss-build-badges/cmake/android/arm64-v8a/google_status.svg)](https://storage.googleapis.com/iree-oss-build-badges/cmake/android/arm64-v8a/google_result.html)

## License

Expand Down
112 changes: 69 additions & 43 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ http_archive(
sha256 = "cf3b76a90c86c0554c5b10f4b160f05af71d252026b71362c4674e2fb9936cf9",
strip_prefix = "rules_cc-01d4a48911d5e7591ecb1c06d3b8af47fe872371",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
"https://github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
"https://github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip",
],
)

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

###############################################################################
Expand All @@ -46,24 +48,24 @@ py_repositories()
# bazel toolchains rules for remote execution (https://releases.bazel.build/bazel-toolchains.html).
http_archive(
name = "bazel_toolchains",
# Workaround for b/150158570. This patch needs to be updated if the bazel_toolchains version is updated.
patches = ["//build_tools/bazel:bazel_toolchains.patch"],
sha256 = "4d348abfaddbcee0c077fc51bb1177065c3663191588ab3d958f027cbfe1818b",
strip_prefix = "bazel-toolchains-2.1.0",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/releases/download/2.1.0/bazel-toolchains-2.1.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/2.1.0.tar.gz",
],
# Workaround for b/150158570. This patch needs to be updated if the bazel_toolchains version is updated.
patches = ["//build_tools/bazel:bazel_toolchains.patch"],
)

load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")

rbe_autoconfig(
name = "rbe_default",
base_container_digest = 'sha256:ac36d37616b044ee77813fc7cd36607a6dc43c65357f3e2ca39f3ad723e426f6',
base_container_digest = "sha256:ac36d37616b044ee77813fc7cd36607a6dc43c65357f3e2ca39f3ad723e426f6",
digest = "sha256:61fd698572dc8b5fc9db11cb4ba4f138a915517b80617259bcaef8e1e4ffd3fb",
registry = "gcr.io",
repository = "iree-oss/rbe-toolchain"
repository = "iree-oss/rbe-toolchain",
)

###############################################################################
Expand All @@ -90,23 +92,27 @@ http_archive(
# TensorFlow
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",
],
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()
###############################################################################

###############################################################################
# llvm-project
load("@iree_core//build_tools/bazel/third_party_import/llvm-project:configure.bzl", "llvm_configure")
maybe(llvm_configure,

maybe(
llvm_configure,
name = "llvm-project",
workspace = "@iree_core//:WORKSPACE",
path = "third_party/llvm-project",
workspace = "@iree_core//:WORKSPACE",
)
###############################################################################

Expand All @@ -118,7 +124,8 @@ maybe(llvm_configure,
# TODO(laurenzo): Come up with a way to make this optional. Also, see if we can
# get the TensorFlow tf_repositories() rule to use maybe() so we can provide
# local overrides safely.
maybe(local_repository,
maybe(
local_repository,
name = "org_tensorflow",
path = "third_party/tensorflow",
)
Expand All @@ -133,108 +140,127 @@ load("//bindings/python/build_tools/python:configure.bzl", "python_configure")

# TODO(laurenzo): Scoping to "iree" to avoid conflicts with other things that
# take an opinion until we can isolate.
maybe(python_configure,
maybe(
python_configure,
name = "iree_native_python",
)
###############################################################################

###############################################################################
# Find and configure the Vulkan SDK, if installed.
load("//build_tools/third_party/vulkan_sdk:repo.bzl", "vulkan_sdk_setup")
maybe(vulkan_sdk_setup,

maybe(
vulkan_sdk_setup,
name = "vulkan_sdk",
)
###############################################################################

maybe(local_repository,
name = "com_google_absl",
path = "third_party/abseil-cpp",
maybe(
local_repository,
name = "com_google_absl",
path = "third_party/abseil-cpp",
)

maybe(local_repository,
name = "com_google_ruy",
path = "third_party/ruy",
maybe(
local_repository,
name = "com_google_ruy",
path = "third_party/ruy",
)

maybe(local_repository,
name = "com_google_googletest",
path = "third_party/googletest",
maybe(
local_repository,
name = "com_google_googletest",
path = "third_party/googletest",
)

# Note that TensorFlow provides this as "flatbuffers" which is wrong.
# It is only used for TFLite and may cause ODR issues if not fixed.
maybe(local_repository,
maybe(
local_repository,
name = "com_github_google_flatbuffers",
path = "third_party/flatbuffers",
)

# TODO(scotttodd): TensorFlow is squatting on the vulkan_headers repo name, so
# we use a temporary one until resolved. Theirs is set to an outdated version.
maybe(new_local_repository,
maybe(
new_local_repository,
name = "iree_vulkan_headers",
path = "third_party/vulkan_headers",
build_file = "build_tools/third_party/vulkan_headers/BUILD.overlay",
path = "third_party/vulkan_headers",
)

maybe(new_local_repository,
maybe(
new_local_repository,
name = "vulkan_memory_allocator",
path = "third_party/vulkan_memory_allocator",
build_file = "build_tools/third_party/vulkan_memory_allocator/BUILD.overlay",
path = "third_party/vulkan_memory_allocator",
)

maybe(new_local_repository,
maybe(
new_local_repository,
name = "glslang",
path = "third_party/glslang",
build_file = "build_tools/third_party/glslang/BUILD.overlay",
path = "third_party/glslang",
)

maybe(local_repository,
maybe(
local_repository,
name = "spirv_tools",
path = "third_party/spirv_tools",
)

maybe(local_repository,
maybe(
local_repository,
name = "spirv_headers",
path = "third_party/spirv_headers",
)

# TODO(laurenzo): TensorFlow is squatting on the pybind11 repo name, so
# we use a temporary one until resolved. Theirs pulls in a bunch of stuff.
maybe(new_local_repository,
maybe(
new_local_repository,
name = "iree_pybind11",
path = "third_party/pybind11",
build_file = "build_tools/third_party/pybind11/BUILD.overlay",
path = "third_party/pybind11",
)

maybe(local_repository,
maybe(
local_repository,
name = "com_google_benchmark",
path = "third_party/benchmark")
path = "third_party/benchmark",
)

maybe(new_local_repository,
maybe(
new_local_repository,
name = "sdl2",
path = "third_party/sdl2",
build_file = "build_tools/third_party/sdl2/BUILD.overlay",
path = "third_party/sdl2",
)

maybe(new_local_repository,
maybe(
new_local_repository,
name = "sdl2_config",
path = "build_tools/third_party/sdl2",
build_file_content = """
package(default_visibility = ["//visibility:public"])
cc_library(name = "headers", srcs = glob(["*.h"]))
""",
path = "build_tools/third_party/sdl2",
)

maybe(new_local_repository,
maybe(
new_local_repository,
name = "dear_imgui",
path = "third_party/dear_imgui",
build_file = "build_tools/third_party/dear_imgui/BUILD.overlay",
path = "third_party/dear_imgui",
)

maybe(new_local_repository,
maybe(
new_local_repository,
name = "renderdoc_api",
path = "third_party/renderdoc_api",
build_file = "build_tools/third_party/renderdoc_api/BUILD.overlay",
path = "third_party/renderdoc_api",
)

# Bootstrap TensorFlow deps last so that ours can take precedence.
Expand Down
1 change: 1 addition & 0 deletions build_tools/embed_data/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cc_binary(

cc_embed_data(
name = "testembed1",
# do not sort
srcs = [
"file1.txt",
"data/file2.txt",
Expand Down
Loading

0 comments on commit 0c0e2ba

Please sign in to comment.