Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ common:clang_local --repo_env USE_HERMETIC_CC_TOOLCHAIN=0
import %workspace%/tensorflow.bazelrc
import %workspace%/warnings.bazelrc

common --features=layering_check

try-import %workspace%/xla_configure.bazelrc
43 changes: 41 additions & 2 deletions build_tools/ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def commands(self) -> List[List[str]]:
self.type_ == BuildType.XLA_MACOS_X86_CPU_KOKORO
or self.type_ == BuildType.XLA_MACOS_ARM64_CPU_KOKORO
)
windows_build = (self.type_ == BuildType.JAX_WINDOWS_X86_CPU_GITHUB_ACTIONS)
windows_build = self.type_ == BuildType.JAX_WINDOWS_X86_CPU_GITHUB_ACTIONS
if not (macos_build or windows_build):
cmds.append(
retry(
Expand Down Expand Up @@ -302,7 +302,20 @@ def nvidia_gpu_build_with_compute_capability(
**_DEFAULT_BAZEL_OPTIONS,
},
repo_env={"TF_CUDA_COMPUTE_CAPABILITIES": f"{compute_capability/10}"},
extra_setup_commands=(["nvidia-smi"],),
override_repository=dict(
rules_ml_toolchain=f"{_GITHUB_WORKSPACE}/openxla/rules_ml_toolchain",
),
extra_setup_commands=(
["nvidia-smi"],
[
"git",
"clone",
"-b",
"layering_check_support",
"https://github.com/beckerhe/rules_ml_toolchain.git",
f"{_GITHUB_WORKSPACE}/openxla/rules_ml_toolchain",
],
),
)


Expand All @@ -321,6 +334,19 @@ def nvidia_gpu_build_with_compute_capability(
build_tag_filters=cpu_x86_tag_filter,
test_tag_filters=cpu_x86_tag_filter,
options={**_DEFAULT_BAZEL_OPTIONS, "//xla/tsl:ci_build": True},
override_repository=dict(
rules_ml_toolchain=f"{_GITHUB_WORKSPACE}/openxla/rules_ml_toolchain",
),
extra_setup_commands=(
[
"git",
"clone",
"-b",
"layering_check_support",
"https://github.com/beckerhe/rules_ml_toolchain.git",
f"{_GITHUB_WORKSPACE}/openxla/rules_ml_toolchain",
],
),
)

Build(
Expand All @@ -331,6 +357,19 @@ def nvidia_gpu_build_with_compute_capability(
build_tag_filters=cpu_x86_tag_filter,
test_tag_filters=cpu_x86_tag_filter,
options={**_DEFAULT_BAZEL_OPTIONS, "//xla/tsl:ci_build": True},
override_repository=dict(
rules_ml_toolchain=f"{_GITHUB_WORKSPACE}/openxla/rules_ml_toolchain",
),
extra_setup_commands=(
[
"git",
"clone",
"-b",
"layering_check_support",
"https://github.com/beckerhe/rules_ml_toolchain.git",
f"{_GITHUB_WORKSPACE}/openxla/rules_ml_toolchain",
],
),
)

cpu_arm_tag_filter = (
Expand Down
13 changes: 13 additions & 0 deletions third_party/boringssl.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/BUILD b/BUILD
index 206786442..3d1624382 100644
--- a/BUILD
+++ b/BUILD
@@ -145,7 +145,7 @@ cc_library(

cc_library(
name = "ssl",
- srcs = ssl_sources + ssl_internal_headers,
+ srcs = ssl_sources + ssl_internal_headers + crypto_internal_headers,
hdrs = ssl_headers,
copts = boringssl_copts_cxx,
includes = ["src/include"],
1 change: 1 addition & 0 deletions third_party/curl.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ cc_library(
"@xla//xla/tsl:ios": [],
"@xla//xla/tsl:windows": [],
"//conditions:default": [
"@boringssl//:crypto",
"@boringssl//:ssl",
],
}),
Expand Down
59 changes: 59 additions & 0 deletions third_party/gen_disable_layering_check_patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# Copyright 2020 The OpenXLA Authors.
# 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
#
# http://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.


# Generates a patch file that disables the layering check for all cc_library
# targets in the archive. Both BUILD and BUILD.bazel files are taken into account.
#
# The script takes one argument: the URL of the .tar.gz archive to download.
#
# The following tools are needed (need to be installed on the machine):
# - curl
# - git
# - buildozer (from Bazel buildtools)
#
# The tool has originally been written for ortools but should work for similarly structured
# projects as well.
#
# Example:
# gen_disable_layering_check_patch.sh https://github.com/google/or-tools/archive/v9.11.tar.gz > ortools/layering_check.diff

set -euo pipefail

readonly TMP_DIR=$(mktemp -d)
trap 'rm -rf -- $TMP_DIR' EXIT

echo "Downloading archive $1..." >&2
curl -Lqo "$TMP_DIR/archive.tar.gz" "$1" 1>&2

echo "Extracting archive..." >&2
mkdir -p "$TMP_DIR/extracted" 1>&2
tar -x -C "$TMP_DIR/extracted" -f "$TMP_DIR/archive.tar.gz" --strip-components=1 1>&2

echo "Initialzing temporary git repo..." >&2
git -C "$TMP_DIR/extracted" init 1>&2
git -C "$TMP_DIR/extracted" add . 1>&2
git -C "$TMP_DIR/extracted" commit --no-verify -m "original state" -q 1>&2

echo "Patching build targets..." >&2
find $TMP_DIR/extracted -name BUILD.bazel -or -name BUILD | while read f; do
buildozer 'add features "-layering_check"' $(dirname $f):%cc_library 1>&2 || exit_code=$?
if [[ $exit_code -ne 0 && $exit_code -ne 3 ]]; then
echo "Buildozer command failed with exit code: $exit_code" >&2
exit $exit_code
fi
done

echo "Generating diff..." >&2
git -C "$TMP_DIR/extracted" --no-pager diff
11 changes: 11 additions & 0 deletions third_party/googletest/googletest.patch
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ index cc254457..49120384 100644
],
"//conditions:default": [],
}),
@@ -178,6 +178,10 @@ alias(
cc_library(
name = "gtest_main",
srcs = ["googlemock/src/gmock_main.cc"],
+ hdrs = glob([
+ "googletest/include/gtest/*.h",
+ "googlemock/include/gmock/*.h",
+ ]),
features = select({
":windows": ["windows_export_all_symbols"],
"//conditions:default": [],
1 change: 1 addition & 0 deletions third_party/highwayhash/highwayhash.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ cc_library(
deps = [
":arch_specific",
":compiler_specific",
":endianess",
":hh_types",
":iaca",
":load3",
Expand Down
Loading
Loading