Merge remote-tracking branch 'origin/main' into bazel-gpu
diff --git a/build_tools/docker/bazel_nvidia/Dockerfile b/build_tools/docker/bazel_nvidia/Dockerfile
new file mode 100644
index 0000000..22dd573
--- /dev/null
+++ b/build_tools/docker/bazel_nvidia/Dockerfile
@@ -0,0 +1,44 @@
+# 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.
+
+# An image for building IREE's tensorflow integrations using bazel and vulkan.
+
+# Build using:
+# docker build --tag gcr.io/iree-oss/bazel-nvidia \
+#   build_tools/docker/bazel_nvidia/
+
+# Run interactively using the following, where IREE_WORKDIR is the path to your
+# local dev environment:
+# docker run -it --rm --entrypoint bash --volume ${IREE_WORKDIR}:/usr/src/iree/ \
+#   gcr.io/iree-oss/bazel-nvidia
+
+# Set up the image and working directory.
+# We start from bazel-nvidia so this image can be used to testing TensorFlow
+# integrations.
+FROM gcr.io/iree-oss/bazel-tensorflow
+
+# Additionally, we need to install the Vulkan SDK and the NVIDIA Vulkan driver.
+
+ARG VULKAN_SDK_VERSION=1.2.141
+
+# Disable apt-key parse waring.
+ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
+
+# Disable prompt during keyboard configuration.
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | apt-key add - \
+  && wget -qO /etc/apt/sources.list.d/lunarg-vulkan-$VULKAN_SDK_VERSION-bionic.list http://packages.lunarg.com/vulkan/$VULKAN_SDK_VERSION/lunarg-vulkan-$VULKAN_SDK_VERSION-bionic.list \
+  && apt-get update \
+  && apt-get install -y vulkan-sdk nvidia-driver-440
diff --git a/kokoro/gcp_ubuntu/bazel/linux/x86-turing/build_kokoro.sh b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/build_kokoro.sh
new file mode 100644
index 0000000..93b7601
--- /dev/null
+++ b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/build_kokoro.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# 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.
+
+# Build and test IREE's integrations within the gcr.io/iree-oss/bazel-nvidia
+# image using Kokoro.
+
+set -e
+set -x
+
+# Print the UTC time when set -x is on
+export PS4='[$(date -u "+%T %Z")] '
+
+# Kokoro checks out the repository here.
+WORKDIR="${KOKORO_ARTIFACTS_DIR?}/github/iree"
+
+# Mount the checked out repository, make that the working directory and run the
+# tests in the bazel-tensorflow image.
+docker run \
+  --volume "${WORKDIR?}:${WORKDIR?}" \
+  --workdir="${WORKDIR?}" \
+  --rm \
+  --env IREE_VULKAN_DISABLE=0 \
+  --gpus all \
+  gcr.io/iree-oss/bazel-nvidia:prod \
+  kokoro/gcp_ubuntu/bazel/integrations/build.sh
+
+# Kokoro will rsync this entire directory back to the executor orchestrating the
+# build which takes forever and is totally useless.
+sudo rm -rf "${KOKORO_ARTIFACTS_DIR?}"/*
+
+# Print out artifacts dir contents after deleting them as a coherence check.
+ls -1a "${KOKORO_ARTIFACTS_DIR?}/"
diff --git a/kokoro/gcp_ubuntu/bazel/linux/x86-turing/common.cfg b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/common.cfg
new file mode 100644
index 0000000..277ffa0
--- /dev/null
+++ b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/common.cfg
@@ -0,0 +1,20 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Copyright 2019 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.
+
+# Common configuration for Kokoro builds that run the integrations build with
+# bazel on linux with NVIDIA GPUs.
+
+build_file: "iree/kokoro/gcp_ubuntu/bazel/linux/x86-turing/build_kokoro.sh"
diff --git a/kokoro/gcp_ubuntu/bazel/linux/x86-turing/continuous.cfg b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/continuous.cfg
new file mode 100644
index 0000000..50a7eed
--- /dev/null
+++ b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/continuous.cfg
@@ -0,0 +1,19 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Copyright 2019 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.
+
+# Deliberately blank as everything necessary is configured in common files, but
+# file must still exist to match corresponding (Google internal) job
+# configurations that trigger the builds.
diff --git a/kokoro/gcp_ubuntu/bazel/linux/x86-turing/google.cfg b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/google.cfg
new file mode 100644
index 0000000..50a7eed
--- /dev/null
+++ b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/google.cfg
@@ -0,0 +1,19 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Copyright 2019 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.
+
+# Deliberately blank as everything necessary is configured in common files, but
+# file must still exist to match corresponding (Google internal) job
+# configurations that trigger the builds.
diff --git a/kokoro/gcp_ubuntu/bazel/linux/x86-turing/main.cfg b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/main.cfg
new file mode 100644
index 0000000..50a7eed
--- /dev/null
+++ b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/main.cfg
@@ -0,0 +1,19 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Copyright 2019 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.
+
+# Deliberately blank as everything necessary is configured in common files, but
+# file must still exist to match corresponding (Google internal) job
+# configurations that trigger the builds.
diff --git a/kokoro/gcp_ubuntu/bazel/linux/x86-turing/presubmit.cfg b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/presubmit.cfg
new file mode 100644
index 0000000..50a7eed
--- /dev/null
+++ b/kokoro/gcp_ubuntu/bazel/linux/x86-turing/presubmit.cfg
@@ -0,0 +1,19 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Copyright 2019 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.
+
+# Deliberately blank as everything necessary is configured in common files, but
+# file must still exist to match corresponding (Google internal) job
+# configurations that trigger the builds.