Skip to content

Commit

Permalink
Merge pull request #2486 from ROCm/develop-upstream-sync-240401
Browse files Browse the repository at this point in the history
Develop upstream sync 240401
  • Loading branch information
mmakevic-amd authored Apr 15, 2024
2 parents 3b26854 + 276236d commit b707f43
Show file tree
Hide file tree
Showing 1,958 changed files with 59,758 additions and 27,830 deletions.
15 changes: 13 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,12 @@ try-import %workspace%/.bazelrc.user
# Build TensorFlow v2.
test:release_base --test_size_filters=small,medium

# Ensure release_base is set on linux
build:release_linux_base --config=release_base

# Target the AVX instruction set
build:release_linux_base --config=avx_linux

# Enable support for all targets
build:release_base --config=cpu_cross

Expand Down Expand Up @@ -719,12 +723,14 @@ build:unsupported_gpu_linux --action_env=GCC_HOST_COMPILER_PATH="/dt9/usr/bin/gc
build:unsupported_gpu_linux --crosstool_top=@ubuntu20.04-gcc9_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain

build:release_cpu_macos --config=avx_linux
test:release_cpu_macos --config=release_base

# Base build configs for macOS
build:release_macos_base --action_env DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
build:release_macos_base --define=no_nccl_support=true --output_filter=^$

# Ensure release_base is set on mac
build:release_macos_base --config=release_base

# Build configs for macOS x86
build:release_macos_x86 --config=release_macos_base
# Build with the AVX instruction set when on macOS x86
Expand Down Expand Up @@ -754,10 +760,12 @@ test:release_macos_x86 --config=release_macos_base
# Test configs for macOS Arm64
test:release_macos_arm64 --config=release_macos_base

# Ensure release_base is set on windows
build:release_cpu_windows --config=release_base

# TODO(kanglan): Update windows configs after b/289091160 is fixed
build:release_cpu_windows --config=avx_win
build:release_cpu_windows --define=no_tensorflow_py_deps=true
test:release_cpu_windows --config=release_base

# Exclude TFRT integration for anything but Linux.
build:android --config=no_tfrt
Expand Down Expand Up @@ -962,3 +970,6 @@ build:rbe_cross_compile_macos_x86 --jobs=100
test:rbe_cross_compile_macos_x86 --jobs=100
# END MACOS CROSS-COMPILE CONFIGS
# END CROSS-COMPILE CONFIGS

# Try to load the XLA warnings config if available
try-import %workspace%/warnings.bazelrc
2 changes: 1 addition & 1 deletion .github/workflows/update-rbe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
title: Update the RBE images to the latest container versions
committer: TensorFlow Release Automation <jenkins@tensorflow.org>
token: ${{ secrets.JENKINS_TOKEN }}
reviewers: angerson,mihaimaruseac,learning-to-play,nitins17
reviewers: mihaimaruseac,learning-to-play,nitins17
body: |
This PR was created by a GitHub Actions workflow to update all the SIG Build-based RBE containers to the most recent containers. See:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Before sending your pull requests, make sure you do the following:

In a graphical form, the entire lifetime of a PR looks like

![image](https://user-images.githubusercontent.com/323199/229561784-0a2f5509-b731-493f-ad88-bad487688c8d.png)
![image](https://github.com/tensorflow/tensorflow/assets/52792999/3eea4ca5-daa0-4570-b0b5-2a2b03a724a3)

### Contributor License Agreements

Expand Down
8 changes: 8 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* GPU
* Support for NVIDIA GPUs with compute capability 8.9 (e.g. L4 & L40) has
been added to TF binary distributions (Python wheels).
* Replace `DebuggerOptions` of TensorFlow Quantizer, and migrate to
`DebuggerConfig` of StableHLO Quantizer.

## Keras

Expand Down Expand Up @@ -70,6 +72,12 @@
schema globally in the converter and inference engine. The new behaviour
can be disabled via experimental
flag `converter._experimental_disable_per_channel_quantization_for_dense_layers = True`.
* C API:
* The experimental `TfLiteRegistrationExternal` type has been renamed as
`TfLiteOperator`, and likewise for the corresponding API functions.
* The Python TF Lite Interpreter bindings now have an option
`experimental_default_delegate_latest_features` to enable all default
delegate features.

## Thanks to our Contributors

Expand Down
4 changes: 3 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# buildifier: disable=load-on-top

workspace(name = "org_tensorflow")

# We must initialize hermetic python first.
Expand All @@ -23,7 +25,7 @@ load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@rules_python//python:repositories.bzl", "python_register_toolchains")
load("@rules_python//python:repositories.bzl", "python_register_toolchains") # buildifier: disable=same-origin-load
load(
"//tensorflow/tools/toolchains/python:python_repo.bzl",
"python_repository",
Expand Down
1 change: 1 addition & 0 deletions ci/official/envs/ci_default
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ TFCI_PYTHON_VERSION=
TFCI_WHL_AUDIT_ENABLE=
TFCI_WHL_AUDIT_PLAT=
TFCI_WHL_BAZEL_TEST_ENABLE=
TFCI_WHL_IMPORT_TEST_ENABLE=1
TFCI_WHL_SIZE_LIMIT=
TFCI_WHL_SIZE_LIMIT_ENABLE=
1 change: 1 addition & 0 deletions ci/official/envs/linux_x86_tpu
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ TFCI_BAZEL_TARGET_SELECTING_CONFIG_PREFIX=linux_tpu
TFCI_BUILD_PIP_PACKAGE_ARGS="--repo_env=WHEEL_NAME=tensorflow_tpu"
TFCI_LIB_SUFFIX="-tpu-linux-x86_64"
TFCI_WHL_BAZEL_TEST_ENABLE=0
TFCI_WHL_IMPORT_TEST_ENABLE=0
TFCI_WHL_SIZE_LIMIT=580M
TFCI_PYTHON_VERIFY_PIP_INSTALL_ARGS="-f https://storage.googleapis.com/libtpu-tf-releases/index.html"
2 changes: 1 addition & 1 deletion ci/official/requirements_updater/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# limitations under the License.
# ==============================================================================

load("@python//3.9:defs.bzl", compile_pip_requirements_3_9 = "compile_pip_requirements")
load("@python//3.10:defs.bzl", compile_pip_requirements_3_10 = "compile_pip_requirements")
load("@python//3.11:defs.bzl", compile_pip_requirements_3_11 = "compile_pip_requirements")
load("@python//3.12:defs.bzl", compile_pip_requirements_3_12 = "compile_pip_requirements")
load("@python//3.9:defs.bzl", compile_pip_requirements_3_9 = "compile_pip_requirements")
load("@updater_config_repository//:updater_config_repository.bzl", "REQUIREMENTS_FILE_NAME")

compile_pip_requirements_3_9(
Expand Down
4 changes: 3 additions & 1 deletion ci/official/requirements_updater/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# buildifier: disable=load-on-top

workspace(name = "requirements_updater")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand All @@ -22,7 +24,7 @@ load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@rules_python//python:repositories.bzl", "python_register_multi_toolchains")
load("@rules_python//python:repositories.bzl", "python_register_multi_toolchains") # buildifier: disable=same-origin-load
load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")

default_python_version = "3.10"
Expand Down
6 changes: 4 additions & 2 deletions ci/official/utilities/rename_and_verify_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ venv=$(mktemp -d)
"python${TFCI_PYTHON_VERSION}" -m venv "$venv"
python="$venv/bin/python3"
"$python" -m pip install *.whl $TFCI_PYTHON_VERIFY_PIP_INSTALL_ARGS
"$python" -c 'import tensorflow as tf; t1=tf.constant([1,2,3,4]); t2=tf.constant([5,6,7,8]); print(tf.add(t1,t2).shape)'
"$python" -c 'import sys; import tensorflow as tf; sys.exit(0 if "keras" in tf.keras.__name__ else 1)'
if [[ "$TFCI_WHL_IMPORT_TEST_ENABLE" == "1" ]]; then
"$python" -c 'import tensorflow as tf; t1=tf.constant([1,2,3,4]); t2=tf.constant([5,6,7,8]); print(tf.add(t1,t2).shape)'
"$python" -c 'import sys; import tensorflow as tf; sys.exit(0 if "keras" in tf.keras.__name__ else 1)'
fi
# VERY basic check to ensure the [and-cuda] package variant is installable.
# Checks TFCI_BAZEL_COMMON_ARGS for "gpu" or "cuda", implying that the test is
# relevant. All of the GPU test machines have CUDA installed via other means,
Expand Down
4 changes: 3 additions & 1 deletion ci/official/wheel_test/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# buildifier: disable=load-on-top

workspace(name = "wheel_test")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand Down Expand Up @@ -38,7 +40,7 @@ python_repository(name = "python_version_repo")
load("@python_version_repo//:py_version.bzl", "TF_PYTHON_VERSION")

# Register multi toolchains
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
load("@rules_python//python:repositories.bzl", "python_register_toolchains") # buildifier: disable=same-origin-load

python_register_toolchains(
name = "python",
Expand Down
63 changes: 60 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ def get_ndk_api_level(environ_cp, android_ndk_home_path):
android_ndk_api_level = prompt_loop_or_load_from_env(
environ_cp,
var_name='ANDROID_NDK_API_LEVEL',
var_default='26', # 26 is required to support AHardwareBuffer.
var_default='21', # 21 is required for ARM64 support.
ask_for_var=(
'Please specify the (min) Android NDK API level to use. '
'[Available levels: %s]'
Expand Down Expand Up @@ -807,6 +807,18 @@ def choose_compiler(environ_cp):
return var


def choose_compiler_Win(environ_cp):
question = 'Do you want to use Clang to build TensorFlow?'
yes_reply = 'Add "--config=win_clang" to compile TensorFlow with CLANG.'
no_reply = 'MSVC will be used to compile TensorFlow.'
var = int(
get_var(
environ_cp, 'TF_NEED_CLANG', None, True, question, yes_reply, no_reply
)
)
return var


def set_clang_compiler_path(environ_cp):
"""Set CLANG_COMPILER_PATH and environment variables.
Expand Down Expand Up @@ -848,6 +860,44 @@ def set_clang_compiler_path(environ_cp):
return clang_compiler_path


def set_clang_compiler_path_win(environ_cp):
"""Set CLANG_COMPILER_PATH and environment variables.
Loop over user prompts for clang path until receiving a valid response.
Default is used if no input is given. Set CLANG_COMPILER_PATH and write
environment variables CC and BAZEL_COMPILER to .bazelrc.
Args:
environ_cp: (Dict) copy of the os.environ.
Returns:
string value for clang_compiler_path.
"""
# Default path if clang-16 is installed by using apt-get install
default_clang_path = 'C:/Program Files/LLVM/bin/clang.exe'
if not os.path.exists(default_clang_path):
default_clang_path = which('clang') or ''

clang_compiler_path = prompt_loop_or_load_from_env(
environ_cp,
var_name='CLANG_COMPILER_PATH',
var_default=default_clang_path,
ask_for_var='Please specify the path to clang executable.',
check_success=os.path.exists,
resolve_symlinks=True,
error_msg=(
'Invalid clang path. %s cannot be found. Note that Clang is now'
'preferred compiler. You may use MSVC by removing --config=win_clang'
),
)

write_action_env_to_bazelrc('CLANG_COMPILER_PATH', clang_compiler_path)
write_to_bazelrc('build --repo_env=CC=%s' % clang_compiler_path)
write_to_bazelrc('build --repo_env=BAZEL_COMPILER=%s' % clang_compiler_path)

return clang_compiler_path


def retrieve_clang_version(clang_executable):
"""Retrieve installed clang version.
Expand Down Expand Up @@ -1386,8 +1436,9 @@ def main():
else:
raise UserInputError(
'Invalid CUDA setting were provided %d '
'times in a row. Assuming to be a scripting mistake.' %
_DEFAULT_PROMPT_ASK_ATTEMPTS)
'times in a row. Assuming to be a scripting mistake.'
% _DEFAULT_PROMPT_ASK_ATTEMPTS
)

set_tf_cuda_compute_capabilities(environ_cp)
if 'LD_LIBRARY_PATH' in environ_cp and environ_cp.get(
Expand Down Expand Up @@ -1415,6 +1466,12 @@ def main():
clang_compiler_path = set_clang_compiler_path(environ_cp)
clang_version = retrieve_clang_version(clang_compiler_path)
disable_clang_offsetof_extension(clang_version)
if is_windows():
environ_cp['TF_NEED_CLANG'] = str(choose_compiler_Win(environ_cp))
if environ_cp.get('TF_NEED_CLANG') == '1':
clang_compiler_path = set_clang_compiler_path_win(environ_cp)
clang_version = retrieve_clang_version(clang_compiler_path)
disable_clang_offsetof_extension(clang_version)

# ROCm / CUDA are mutually exclusive.
# At most 1 GPU platform can be configured.
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/c/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# C API for TensorFlow, for use by client language bindings.

load("@bazel_skylib//lib:selects.bzl", "selects")
load("@local_config_tensorrt//:build_defs.bzl", "if_tensorrt")
load("@local_tsl//tsl/platform:rules_cc.bzl", "cc_library")
load(
"//tensorflow:tensorflow.bzl",
"check_deps",
Expand All @@ -18,8 +20,6 @@ load(
"//tensorflow/core/tpu:build_defs.bzl",
"if_libtpu_tf_status",
)
load("@local_tsl//tsl/platform:rules_cc.bzl", "cc_library")
load("@local_config_tensorrt//:build_defs.bzl", "if_tensorrt")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
Expand Down
8 changes: 3 additions & 5 deletions tensorflow/c/eager/parallel_device/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
load("//tensorflow:tensorflow.default.bzl", "filegroup")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
load(
"//tensorflow:tensorflow.bzl",
"tf_cc_test",
)
load("//tensorflow:tensorflow.default.bzl", "filegroup")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
Expand Down Expand Up @@ -56,9 +56,7 @@ cc_library(
name = "parallel_device",
srcs = [":device_sources"],
hdrs = [":device_headers"],
visibility = [
"//visibility:private", # Only private by automation, not intent. Owner may accept CLs adding visibility. See go/scheuklappen#explicit-private.
],
visibility = ["//visibility:private"],
deps = [
":parallel_device_lib",
"//tensorflow/c:c_api",
Expand Down
3 changes: 1 addition & 2 deletions tensorflow/c/experimental/filesystem/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

# Experimental filesystem C APIs for TensorFlow.
# Will be moved in proper place once all filesystems are converted to the
# modular framework.
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
Expand Down
3 changes: 1 addition & 2 deletions tensorflow/c/experimental/filesystem/plugins/gcs/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

# Experimental gcs filesystem plugin.
load("//tensorflow:tensorflow.bzl", "get_win_copts", "tf_cc_shared_object", "tf_cc_test")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
Expand Down
6 changes: 4 additions & 2 deletions tensorflow/c/experimental/filesystem/plugins/posix/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

# Experimental posix filesystem plugin.
load("//tensorflow:tensorflow.bzl", "tf_cc_shared_object")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
Expand All @@ -25,6 +24,7 @@ cc_library(
hdrs = ["posix_filesystem.h"],
deps = [
":posix_filesystem_helper",
"//tensorflow/c:tf_file_statistics",
"//tensorflow/c:tf_status",
"//tensorflow/c/experimental/filesystem:filesystem_interface",
],
Expand All @@ -40,6 +40,8 @@ cc_library(
":posix_filesystem_impl",
"//tensorflow/c/experimental/filesystem:filesystem_interface",
"//tensorflow/c/experimental/filesystem:modular_filesystem",
"//tensorflow/core/platform:status",
"@com_google_absl//absl/log",
],
alwayslink = 1,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ limitations under the License.
#include <sys/stat.h>
#include <unistd.h>

#include "tensorflow/c/experimental/filesystem/filesystem_interface.h"
#include "tensorflow/c/experimental/filesystem/plugins/posix/posix_filesystem_helper.h"
#include "tensorflow/c/tf_file_statistics.h"
#include "tensorflow/c/tf_status.h"

// Implementation of a filesystem for POSIX environments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "absl/log/log.h"
#include "tensorflow/c/experimental/filesystem/filesystem_interface.h"
#include "tensorflow/c/experimental/filesystem/modular_filesystem_registration.h"
#include "tensorflow/c/experimental/filesystem/plugins/posix/posix_filesystem.h"
#include "tensorflow/core/platform/status.h"

namespace tensorflow {

Expand Down
3 changes: 1 addition & 2 deletions tensorflow/c/experimental/filesystem/plugins/windows/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

# Experimental windows filesystem plugin.
load("//tensorflow:tensorflow.bzl", "get_win_copts", "tf_cc_shared_object")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")

package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
Expand Down
Loading

0 comments on commit b707f43

Please sign in to comment.