Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
draganmladjenovic committed Jan 25, 2024
2 parents 330b6e2 + 7670a94 commit b14b08b
Show file tree
Hide file tree
Showing 4,606 changed files with 98,072 additions and 63,250 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
20 changes: 15 additions & 5 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ build --experimental_link_static_libraries_once=false
# Prevent regressions on those two incompatible changes
# TODO: remove those flags when they are flipped in the default Bazel version TF uses.
build --incompatible_enforce_config_setting_visibility
# TODO: also enable this flag after fixing the visbility violations
# TODO: also enable this flag after fixing the visibility violations
# build --incompatible_config_setting_private_default_visibility

# Default options should come above this line.
Expand Down Expand Up @@ -249,7 +249,7 @@ build:cuda_clang --repo_env=TF_CUDA_COMPUTE_CAPABILITIES="sm_50,sm_60,sm_70,sm_8
build:cuda_clang_official --config=cuda_clang
build:cuda_clang_official --action_env=TF_CUDA_VERSION="12"
build:cuda_clang_official --action_env=TF_CUDNN_VERSION="8"
build:cuda_clang_official --action_env=CUDA_TOOLKIT_PATH="/usr/local/cuda-12.2"
build:cuda_clang_official --action_env=CUDA_TOOLKIT_PATH="/usr/local/cuda-12.3"
build:cuda_clang_official --action_env=GCC_HOST_COMPILER_PATH="/dt9/usr/bin/gcc"
build:cuda_clang_official --action_env=CLANG_CUDA_COMPILER_PATH="/usr/lib/llvm-17/bin/clang"
build:cuda_clang_official --action_env=LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
Expand Down Expand Up @@ -307,7 +307,7 @@ build:macos --copt=-w
build:windows --copt=/W0
build:windows --host_copt=/W0

# Suppress most C++ complier warnings to reduce log size but allow
# Suppress most C++ compiler warnings to reduce log size but allow
# for specific warnings to still be present.
build:linux --copt="-Wno-all"
build:linux --copt="-Wno-extra"
Expand Down Expand Up @@ -588,7 +588,7 @@ test:release_base --test_size_filters=small,medium
# Target the AVX instruction set
build:release_linux_base --config=avx_linux

# Disable clang extention that rejects type definitions within offsetof.
# Disable clang extension that rejects type definitions within offsetof.
# This was added in clang-16 by https://reviews.llvm.org/D133574.
# Can be removed once upb is updated, since a type definition is used within
# offset of in the current version of ubp.
Expand Down Expand Up @@ -791,6 +791,14 @@ test:macos_arm64_pycpp_test_filters --test_tag_filters=-no_oss,-oss_excluded,-os
test:macos_arm64_pycpp_test_filters --build_tag_filters=-no_oss,-oss_excluded,-oss_serial,-no_oss_py39,-no_oss_py310,-nomac,-no_mac,-mac_excluded,-v1only,-gpu,-tpu,-benchmark-test,-no_mac_arm64,-no_aarch64
test:macos_arm64_pycpp_test_filters --test_lang_filters=cc,py --test_size_filters=small,medium
test:macos_arm64_pycpp_test --config=macos_arm64_pycpp_test_filters -- //tensorflow/... -//tensorflow/python/integration_testing/... -//tensorflow/compiler/tf2tensorrt/... -//tensorflow/core/tpu/... -//tensorflow/lite/... -//tensorflow/tools/toolchains/... -//tensorflow/go/... -//tensorflow/java/... -//tensorflow/compiler/aot/... -//tensorflow/core/kernels/image:resize_bicubic_op_test
# MACOS X86 PYCPP
test:macos_x86_pycpp_test_filters --test_tag_filters=-no_oss,-oss_excluded,-oss_serial,-no_oss_py38,-no_oss_py39,-no_oss_py310,-nomac,-no_mac,-mac_excluded,-v1only,-gpu,-tpu,-benchmark-test
test:macos_x86_pycpp_test_filters --build_tag_filters=-no_oss,-oss_excluded,-oss_serial,-no_oss_py38,-no_oss_py39,-no_oss_py310,-nomac,-no_mac,-mac_excluded,-v1only,-gpu,-tpu,-benchmark-test
test:macos_x86_pycpp_test_filters --keep_going --test_lang_filters=cc,py --test_size_filters=small,medium
test:macos_x86_pycpp_test --config=macos_x86_pycpp_test_filters -- //tensorflow/... -//tensorflow/compiler/tf2tensorrt/... -//tensorflow/core/tpu/... -//tensorflow/go/... -//tensorflow/java/... -//tensorflow/python/integration_testing/... -//tensorflow/tools/toolchains/... -//tensorflow/lite/... -//tensorflow/compiler/aot/...
# CROSS-COMPILE MACOS X86 PYCPP
test:cross_compile_macos_x86_pycpp_test --config=macos_x86_pycpp_test
test:cross_compile_macos_x86_pycpp_test -//tensorflow/core/kernels:quantized_conv_ops_test -//tensorflow/core/kernels:quantized_matmul_op_test -//tensorflow/python/ops:quantized_conv_ops_test -//tensorflow/tools/graph_transforms:transforms_test -//tensorflow/python/tools:aot_compiled_test
# END TF TEST SUITE OPTIONS

# START CROSS-COMPILE CONFIGS
Expand Down Expand Up @@ -836,7 +844,7 @@ build:cross_compile_macos_x86 --action_env MACOSX_DEPLOYMENT_TARGET=10.15
build:cross_compile_macos_x86 --platforms=//tensorflow/tools/toolchains/cross_compile/config:darwin_x86_64
build:cross_compile_macos_x86 --cpu=darwin
build:cross_compile_macos_x86 --crosstool_top=//tensorflow/tools/toolchains/cross_compile/cc:cross_compile_toolchain_suite
# When RBE cross-compiling for macOS, we need to explictly register the
# When RBE cross-compiling for macOS, we need to explicitly register the
# toolchain. Otherwise, oddly, RBE complains that a "docker container must be
# specified".
build:cross_compile_macos_x86 --extra_toolchains=//tensorflow/tools/toolchains/cross_compile/config:macos-x86-cross-compile-cc-toolchain
Expand All @@ -848,5 +856,7 @@ build:cross_compile_macos_x86 --platform_mappings=tensorflow/tools/toolchains/cr
build:rbe_cross_compile_macos_x86 --config=cross_compile_macos_x86
build:rbe_cross_compile_macos_x86 --config=rbe_cross_compile_base
test:rbe_cross_compile_macos_x86 --config=rbe_cross_compile_base
# Increase the test timeout as tests often take longer on mac.
test:rbe_cross_compile_macos_x86 --test_timeout=300,450,1200,3600
# END MACOS CROSS-COMPILE CONFIGS
# END CROSS-COMPILE CONFIGS
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Before sending your pull requests, make sure you do the following:
- If a change is needed, the contributor is requested to make the suggested
change.
- You make the change and submit it for the review again.
- This cycle repeats itself untill the PR gets approved.
- This cycle repeats itself until the PR gets approved.
- Note: As a friendly reminder, we may reach out to you if the PR is awaiting
your response for more than 2 weeks.

Expand Down
92 changes: 62 additions & 30 deletions ci/official/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,72 @@ from the `envs` directory that is filled with configuration options:

- Nightly jobs (Run nightly on the `nightly` branch)
- Uses `wheel.sh`, `libtensorflow.sh`, `code_check_full.sh`
- Uses `envs/nightly_...`
- Continuous jobs (Run on every GitHub commit)
- Uses `pycpp.sh`
- Uses `envs/continuous_...`
- Presubmit jobs (Run on every GitHub PR)
- Uses `pycpp.sh`, `code_check_changed_files.sh`
- Also uses `envs/continuous_...`

These "env" files match up with an environment matrix that roughly covers:

- Different Python versions
- Linux, MacOS, and Windows machines (these pool definitions are internal)
- x86 and arm64
- CPU-only, or with NVIDIA CUDA support (Linux only), or with TPUs
- Different Python versions

## How to Test Your Changes to TensorFlow

**Important for Googlers only**: Google employees can use an internal-only tool
to make Kokoro test changes without having to run locally. Search for "MLCI"
internally.
You may check how your changes will affect TensorFlow by:

1. Creating a PR and observing the presubmit test results
2. Running the CI scripts locally, as explained below
3. **Google employees only**: Google employees can use an internal-only tool
called "MLCI" that makes testing more convenient: it can execute any full CI job
against a pending change. Search for "MLCI" internally to find it.

You may invoke a CI script of your choice by following these instructions:

```bash
# Required: create a file to hold your settings
cd tensorflow-git-dir
export TFCI=$(mktemp)

# Required: choose an environment (env) to copy.
# Here is a single-line example of running a script on Linux to build the
# GPU version of TensorFlow for Python 3.12, using the public TF bazel cache and
# a local build cache:
TFCI=py312,linux_x86_cuda,multicache ci/official/wheel.sh

# First, set your TFCI variable to choose the environment settings.
# TFCI is a comma-separated list of filenames from the envs directory, which
# are all settings for the scripts. TF's CI jobs are all made of a combination
# of these env files.
#
# If you've clicked on a test result from our CI (via a dashboard or GitHub link),
# click to "Invocation Details" and find BUILD_CONFIG, which will contain a TFCI
# value in the "env_vars" list that you can choose to copy that environment.
echo >>$TFCI source ci/official/envs/nightly_linux_x86_cpu_py311

# Required: Reset settings for local execution
echo >>$TFCI source ci/official/envs/local_default
# Ex. 1: TFCI=py311,linux_x86_cuda,nightly_upload (nightly job)
# Ex. 2: TFCI=py39,linux_x86,rbe (continuous job)
# Non-Googlers should replace "nightly_upload" or "rbe" with "multicache".
# Googlers should replace "nightly_upload" with "multicache" or "rbe", if
# you have set up your system to use RBE (see further below).
#
# Here is how to choose your TFCI value:
# 1. A Python version must come first, because other scripts reference it.
# Ex. py39 -- Python 3.9
# Ex. py310 -- Python 3.10
# Ex. py311 -- Python 3.11
# Ex. py312 -- Python 3.12
# 2. Choose the platform, which corresponds to the version of TensorFlow to
# build. This should also match the system you're using--you cannot build
# the TF MacOS package from Linux.
# Ex. linux_x86 -- x86_64 Linux platform
# Ex. linux_x86_cuda -- x86_64 Linux platform, with Nvidia CUDA support
# Ex. macos_arm64 -- arm64 MacOS platform
# 3. Add modifiers. Some modifiers for local execution are:
# Ex. multicache -- Use a local cache combined with TF's public cache
# Ex. rbe -- Use RBE for faster builds (Googlers only; see below)
# Ex. no_docker -- Disable docker on enabled platforms
# See full examples below for more details on these. Some other modifiers are:
# Ex. versions_upload -- for TF official release versions
# Ex. nightly_upload -- for TF nightly official builds; changes version numbers
# Ex. no_upload -- Disable all uploads, usually for temporary CI issues

# Recommended: use a local+remote cache.
#
Expand All @@ -62,19 +94,7 @@ echo >>$TFCI source ci/official/envs/local_default
# or tests passing incorrectly.
# - Automatic LLVM updates are known to extend build time even with
# the cache; this is unavoidable.
echo >>$TFCI source ci/official/envs/local_multicache

# Advanced: Use Remote Build Execution (RBE) (internal developers only)
#
# RBE dramatically speeds up builds and testing. It also gives you a
# public URL to share your build results with collaborators. However,
# it is only available to a limited set of internal TensorFlow developers.
#
# RBE is incompatible with local caching, so you must remove
# ci/official/envs/local_multicache from your $TFCI file.
#
# To use RBE, you must first run `gcloud auth application-default login`, then:
# echo >>$TFCI source ci/official/envs/local_rbe
export TFCI=py311,linux_x86,multicache

# Recommended: Configure Docker. (Linux only)
#
Expand All @@ -98,7 +118,19 @@ echo >>$TFCI source ci/official/envs/local_multicache
# to transfer ownership to your user.
#
# Docker is enabled by default on Linux. You may disable it if you prefer:
# echo >>$TFCI source ci/official/envs/local_nodocker
# export TFCI=py311,linux_x86,no_docker

# Advanced: Use Remote Build Execution (RBE) (internal developers only)
#
# RBE dramatically speeds up builds and testing. It also gives you a
# public URL to share your build results with collaborators. However,
# it is only available to a limited set of internal TensorFlow developers.
#
# RBE is incompatible with local caching, so you must remove
# ci/official/envs/local_multicache from your $TFCI file.
#
# To use RBE, you must first run `gcloud auth application-default login`, then:
export TFCI=py311,linux_x86,rbe

# Finally: Run your script of choice.
# If you've clicked on a test result from our CI (via a dashboard or GitHub link),
Expand Down Expand Up @@ -127,9 +159,9 @@ The top-level scripts and utility scripts should be fairly well-documented. Here
is a brief explanation of how they tie together:

1. `envs/*` are lists of variables made with bash syntax. A user must set a
`TFCI` env param pointing to one of the `env` files.
`TFCI` env param pointing to a list of `env` files.
2. `utilities/setup.sh`, initialized by all top-level scripts, reads and sets
values from that `TFCI` path.
values from those `TFCI` paths.
- `set -a` / `set -o allexport` exports the variables from `env` files so
all scripts can use them.
- `utilities/setup_docker.sh` creates a container called `tf` with all
Expand Down
11 changes: 5 additions & 6 deletions ci/official/any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@
# ...
set -euxo pipefail
cd "$(dirname "$0")/../../" # tensorflow/
REQUESTED_TFCI="$TFCI"
export TFCI=$(mktemp)
echo >>$TFCI "source $REQUESTED_TFCI"
echo >>$TFCI "source ci/official/envs/disable_all_uploads"
# Any request that includes "nightly_upload" should just use the
# local multi-cache instead.
export TFCI="$(echo $TFCI | sed 's/,nightly_upload/,multicache/')"
if [[ -n "${TF_ANY_EXTRA_ENV:-}" ]]; then
echo >>$TFCI "source $TF_ANY_EXTRA_ENV"
export TFCI="$TFCI,$TF_ANY_EXTRA_ENV"
fi
if [[ -n "${TF_ANY_SCRIPT:-}" ]]; then
"$TF_ANY_SCRIPT"
elif [[ -n "${TF_ANY_TARGETS:-}" ]]; then
source "${BASH_SOURCE%/*}/utilities/setup.sh"
tfrun bazel $TFCI_BAZEL_BAZELRC_ARGS "${TF_ANY_MODE:-test}" $TFCI_BAZEL_COMMON_ARGS $TF_ANY_TARGETS
tfrun bazel "${TF_ANY_MODE:-test}" $TFCI_BAZEL_COMMON_ARGS $TF_ANY_TARGETS
else
echo 'Looks like $TF_ANY_TARGETS are $TF_ANY_SCRIPT are both empty. That is an error.'
exit 1
Expand Down
6 changes: 1 addition & 5 deletions ci/official/bisect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
# export TF_ANY_MODE=test
set -euxo pipefail
cd "$(dirname "$0")/../../" # tensorflow/
REQUESTED_TFCI="$TFCI"
export TFCI=$(mktemp)
echo >>$TFCI "source $REQUESTED_TFCI"
echo >>$TFCI "source ci/official/envs/disable_all_uploads"
echo >>$TFCI "source ci/official/envs/local_multicache"
export TFCI="$(echo $TFCI | sed 's/,nightly_upload/,multicache/')"
git bisect start "$TF_BISECT_BAD" "$TF_BISECT_GOOD"
git bisect run $TF_BISECT_SCRIPT
2 changes: 1 addition & 1 deletion ci/official/containers/linux_arm64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY apt.conf /etc/apt/
RUN /build_patchelf.sh

################################################################################
FROM nvidia/cuda:12.2.0-devel-ubuntu20.04 as devel
FROM nvidia/cuda:12.3.1-devel-ubuntu20.04 as devel
################################################################################
COPY --from=builder /dt10 /dt10
COPY --from=builder /patchelf/patchelf_0.14.3-1_arm64.deb /patchelf/patchelf_0.14.3-1_arm64.deb
Expand Down
9 changes: 7 additions & 2 deletions ci/official/containers/linux_arm64/cuda.packages.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# CuDNN: https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#ubuntu-network-installation
libcudnn8=8.9.4.25-1+cuda12.2
libcudnn8-dev=8.9.4.25-1+cuda12.2
libcudnn8=8.9.6.50-1+cuda12.2
libcudnn8-dev=8.9.6.50-1+cuda12.2

# This can be removed once NVIDIA publishes a cuda-12.3.2 Docker image.
# For now it ensures that we install at least version 12.3.107 of PTXAS,
# since 12.3.103 has a bug.
cuda-compiler-12-3=12.3.2-1
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,3 @@ teardown_file() {
source /tf/venv/bin/activate
python3 -c 'import sys; import tensorflow as tf; sys.exit(0 if "keras" in tf.keras.__name__ else 1)'
}

# Is this still useful?
@test "TensorFlow has Estimator" {
source /tf/venv/bin/activate
python3 -c 'import sys; import tensorflow as tf; sys.exit(0 if "_v2.estimator" in tf.estimator.__name__ else 1)'
}
54 changes: 36 additions & 18 deletions ci/official/envs/ci_default
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
# Note: this file gets sourced in utilities/setup.sh, which has "set -u"
# (error on undefined variables). This ensures that (a) every TFCI variable
# has an explicit default value, and (b) no script can accidentally use a
Expand All @@ -9,41 +23,45 @@
# You may also get an overview, e.g.:
# cd ci/official
# grep -o '^TFCI\w*' envs/ci_default | xargs -n 1 -I{} bash -c "echo; echo {}; grep -R -H --exclude-dir=envs --color=always '{}'"

TFCI_ARTIFACT_FINAL_GCS_ENABLE=
TFCI_ARTIFACT_FINAL_GCS_SA_PATH=
TFCI_ARTIFACT_FINAL_GCS_URI=
TFCI_ARTIFACT_FINAL_PYPI_ARGS=
TFCI_ARTIFACT_FINAL_PYPI_ENABLE=
TFCI_ARTIFACT_LATEST_GCS_URI=
TFCI_ARTIFACT_STAGING_GCS_ENABLE=
TFCI_ARTIFACT_STAGING_GCS_URI=
TFCI_BAZEL_BAZELRC_ARGS=
TFCI_BAZEL_COMMON_ARGS=
TFCI_BAZEL_TARGET_SELECTING_CONFIG_PREFIX=
TFCI_BUILD_PIP_PACKAGE_ARGS=
TFCI_DOCKER_ARGS=
TFCI_DOCKER_ENABLE=1
TFCI_DOCKER_ENABLE=
TFCI_DOCKER_IMAGE=
TFCI_DOCKER_PULL_ENABLE=1
TFCI_DOCKER_PULL_ENABLE=
TFCI_DOCKER_REBUILD_ARGS=
TFCI_DOCKER_REBUILD_ENABLE=0
TFCI_DOCKER_REBUILD_UPLOAD_ENABLE=0
TFCI_INDEX_HTML_ENABLE=1
TFCI_DOCKER_REBUILD_ENABLE=
TFCI_DOCKER_REBUILD_UPLOAD_ENABLE=
TFCI_GIT_DIR=
TFCI_INDEX_HTML_ENABLE=
TFCI_LIB_SUFFIX=
TFCI_MACOS_BAZEL_TEST_DIR_ENABLE=
TFCI_MACOS_BAZEL_TEST_DIR_PATH=
TFCI_MACOS_CROSS_COMPILE_ENABLE=
TFCI_MACOS_CROSS_COMPILE_SDK_DEST=
TFCI_MACOS_CROSS_COMPILE_SDK_SOURCE=
TFCI_MACOS_INSTALL_BAZELISK_ENABLE=
TFCI_MACOS_INSTALL_BAZELISK_URL=
TFCI_MACOS_PYENV_INSTALL_ENABLE=
TFCI_MACOS_TWINE_INSTALL_ENABLE=
TFCI_MACOS_UPGRADE_PYENV_ENABLE=
TFCI_NIGHTLY_UPDATE_VERSION_ENABLE=
TFCI_NVIDIA_SMI_ENABLE=
TFCI_OUTPUT_DIR=build_output
TFCI_OUTPUT_DIR=
TFCI_PYTHON_VERIFY_PIP_INSTALL_ARGS=
TFCI_PYTHON_VERSION=
TFCI_UPLOAD_LIB_ENABLE=
TFCI_UPLOAD_LIB_LATEST_ENABLE=
TFCI_UPLOAD_LIB_LATEST_URI=
TFCI_UPLOAD_LIB_URI=
TFCI_UPLOAD_WHL_GCS_ENABLE=
TFCI_UPLOAD_WHL_GCS_URI=
TFCI_UPLOAD_WHL_PYPI_ARGS=
TFCI_UPLOAD_WHL_PYPI_ENABLE=
TFCI_WHL_AUDIT_ENABLE=1
TFCI_WHL_AUDIT_ENABLE=
TFCI_WHL_AUDIT_PLAT=
TFCI_WHL_BAZEL_TEST_ENABLE=1
TFCI_WHL_BAZEL_TEST_ENABLE=
TFCI_WHL_SIZE_LIMIT=
TFCI_WHL_SIZE_LIMIT_ENABLE=1
TFCI_WHL_SIZE_LIMIT_ENABLE=
8 changes: 0 additions & 8 deletions ci/official/envs/ci_nightly_uploads

This file was deleted.

6 changes: 0 additions & 6 deletions ci/official/envs/continuous_linux_arm64_cpu_py310

This file was deleted.

6 changes: 0 additions & 6 deletions ci/official/envs/continuous_linux_arm64_cpu_py311

This file was deleted.

This file was deleted.

Loading

0 comments on commit b14b08b

Please sign in to comment.